mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 14:54:03 +00:00
Event listener arguments test
This commit is contained in:
parent
8258cc0e03
commit
91b787d76f
2 changed files with 11 additions and 1 deletions
|
|
@ -426,7 +426,7 @@ class TenantManager
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute event listeners.
|
* Trigger an event and execute event listeners.
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param mixed ...$args
|
* @param mixed ...$args
|
||||||
|
|
|
||||||
|
|
@ -320,4 +320,14 @@ class TenantManagerTest extends TestCase
|
||||||
$this->expectException(TenantDoesNotExistException::class);
|
$this->expectException(TenantDoesNotExistException::class);
|
||||||
tenancy()->find('gjnfdgf');
|
tenancy()->find('gjnfdgf');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
public function event_listeners_can_accept_arguments()
|
||||||
|
{
|
||||||
|
tenancy()->hook('tenant.creating', function ($tenantManager, $tenant) {
|
||||||
|
$this->assertSame('bar', $tenant->foo);
|
||||||
|
});
|
||||||
|
|
||||||
|
Tenant::new()->withData(['foo' => 'bar'])->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue