mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 19:04:03 +00:00
Add test for tenant.creating hook
This commit is contained in:
parent
eecadd6d39
commit
ccb68f5400
1 changed files with 15 additions and 0 deletions
|
|
@ -330,4 +330,19 @@ class TenantManagerTest extends TestCase
|
||||||
|
|
||||||
Tenant::new()->withData(['foo' => 'bar'])->save();
|
Tenant::new()->withData(['foo' => 'bar'])->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
public function tenant_creating_hook_can_be_used_to_modify_tenants_data()
|
||||||
|
{
|
||||||
|
tenancy()->hook('tenant.creating', function ($tm, Tenant $tenant) {
|
||||||
|
$tenant->put([
|
||||||
|
'foo' => 'bar',
|
||||||
|
'abc123' => 'def456',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
$tenant = Tenant::new()->save();
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('foo', $tenant->data);
|
||||||
|
$this->assertArrayHasKey('abc123', $tenant->data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue