Fake memberships

This commit is contained in:
philipp lang 2022-01-02 21:49:57 +01:00
parent 99486140bf
commit 32a451fb35
2 changed files with 20 additions and 2 deletions

View File

@ -82,6 +82,24 @@ class FakeBackend {
return Http::response(json_encode($content) ?: '{}', 200);
}
if ($request->url() === "https://nami.dpsg.de/ica/rest/nami/zugeordnete-taetigkeiten/filtered-for-navigation/gruppierung-mitglied/mitglied/{$member['id']}/flist") {
$content = [
'success' => true,
'data' => array_map(function($membership) {
return (object) [
'entries_aktivVon' => $membership['aktivVon'],
'entries_aktivBis' => $membership['aktivBis'],
'entries_gruppierung' => $membership['gruppierung'],
'id' => $membership['id'],
'entries_taetigkeit' => $membership['taetigkeit'],
'entries_untergliederung' => $membership['untergliederung'],
];
}, $member['memberships'] ?? [])
];
return Http::response(json_encode($content) ?: '{}', 200);
}
}
foreach (collect($data)->chunk(100) as $i => $chunk) {

View File

@ -2,10 +2,10 @@
namespace Zoomyboy\LaravelNami\Tests\Unit;
use Zoomyboy\LaravelNami\Nami;
use Zoomyboy\LaravelNami\Tests\TestCase;
use Illuminate\Support\Facades\Http;
use Zoomyboy\LaravelNami\Member;
use Zoomyboy\LaravelNami\Nami;
use Zoomyboy\LaravelNami\Tests\TestCase;
class PullMembershipsTest extends TestCase
{