This commit is contained in:
Philipp Lang 2022-11-08 16:02:12 +01:00
parent e8df1a18e4
commit 61cc08dda0
2 changed files with 25 additions and 0 deletions

View File

@ -6,6 +6,9 @@ use Illuminate\Support\Facades\Http;
class MembershipFake extends Fake
{
/**
* @param array<int, int|array{id: int, entries_taetigkeit?: string, entries_aktivVon?: string, entries_aktivBis?: string, entries_untergliederung?: string, entries_gruppierung?: string}> $membershipIds
*/
public function fetches(int $memberId, array $membershipIds): self
{
Http::fake(function ($request) use ($memberId, $membershipIds) {
@ -54,6 +57,9 @@ class MembershipFake extends Fake
return $this;
}
/**
* @param array{id: int, gruppierung?: string, taetigkeit?: string, taetigkeitId?: int, untergliederung?: string, untergliederungId?: int, aktivVon?: string, aktivBis?: string} $data
*/
public function shows(int $memberId, array $data): self
{
Http::fake(function ($request) use ($memberId, $data) {

View File

@ -0,0 +1,19 @@
<?php
namespace Zoomyboy\LaravelNami\Tests\Unit;
use Zoomyboy\LaravelNami\Fakes\MembershipFake;
use Zoomyboy\LaravelNami\Tests\TestCase;
class PullMembershipTest extends TestCase
{
public function testGetASingleMembership(): void
{
app(MembershipFake::class)
->fetches(105, [['id' => 56, 'entries_taetigkeit' => 'Leiter']]);
$memberships = $this->login()->membershipsOf(105);
$this->assertEquals('Leiter', $memberships->first()->activity);
}
}