Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Tests/Feature/Tenant/Mock/TenantShowMockClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class TenantShowMockClient extends ClientMock
{
public const BASIC_TENANT = [
'id' => 1,
'name' => 'Test Tenant',
'plan' => 'lite',
];
protected string $path;
Expand Down
11 changes: 11 additions & 0 deletions Tests/Feature/Tenant/ShowTenantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,15 @@ public function it_should_show_current_tenant(): void
static::assertSame(1, $tenant->id());
static::assertSame('lite', $tenant->plan());
}

/** @test */
public function it_should_show_tenant_name(): void
{
$client = new TenantShowMockClient(data: ['id' => 1]);
$service = new TenantService($client);

$tenant = $service->find();

static::assertSame('Test Tenant', $tenant->name());
}
}
1 change: 1 addition & 0 deletions src/Director/BodyTo/BodyToTenant.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public static function build(array $data): Tenant
{
return (new TenantInternal())
->setId($data['id'])
->setName($data['name'])
->setPlan($data['plan']);
}
}
6 changes: 6 additions & 0 deletions src/Entity/Tenant.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ class Tenant extends AbstractEntity
{
protected int $id;
protected string $plan;
protected string $name;

public function id(): int
{
return $this->id;
}

public function name(): string
{
return $this->name;
}

public function plan(): string
{
return $this->plan;
Expand Down
10 changes: 10 additions & 0 deletions src/Entity/TenantInternal.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ public function setId(int $id): self
return $this;
}

/**
* @internal
*/
public function setName(string $name): self
{
$this->name = $name;

return $this;
}

/**
* @internal
*/
Expand Down