Updated tests
This commit is contained in:
@@ -27,6 +27,11 @@ abstract class AbstractEventTestCase extends AbstractAnemicTestCase
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function objectHasHandlers()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function testEventImplementsTheCorrectInterfaces()
|
public function testEventImplementsTheCorrectInterfaces()
|
||||||
{
|
{
|
||||||
$event = $this->getObjectAndParams()['object'];
|
$event = $this->getObjectAndParams()['object'];
|
||||||
@@ -36,7 +41,7 @@ abstract class AbstractEventTestCase extends AbstractAnemicTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public function testEventHasRegisteredHandlers()
|
public function testEventHasRegisteredHandlers()
|
||||||
{
|
{
|
||||||
$property = (new ReflectionClass(EventServiceProvider::class))->getProperty('listen');
|
$property = (new ReflectionClass(EventServiceProvider::class))->getProperty('listen');
|
||||||
$property->setAccessible(true);
|
$property->setAccessible(true);
|
||||||
@@ -45,10 +50,15 @@ abstract class AbstractEventTestCase extends AbstractAnemicTestCase
|
|||||||
$mappings = $property->getValue(new EventServiceProvider($this->app));
|
$mappings = $property->getValue(new EventServiceProvider($this->app));
|
||||||
|
|
||||||
$this->assertTrue(isset($mappings[$class]));
|
$this->assertTrue(isset($mappings[$class]));
|
||||||
$this->assertGreaterThan(0, count($mappings[$class]));
|
|
||||||
|
if ($this->objectHasHandlers()) {
|
||||||
|
$this->assertGreaterThan(0, count($mappings[$class]));
|
||||||
|
} else {
|
||||||
|
$this->assertSame(0, count($mappings[$class]));
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($mappings[$class] as $handler) {
|
foreach ($mappings[$class] as $handler) {
|
||||||
$this->assertInstanceOf($handler, $this->app->make($handler));
|
$this->assertInstanceOf($handler, $this->app->make($handler));
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,11 @@ use CachetHQ\Cachet\Models\User;
|
|||||||
|
|
||||||
class UserWasAddedEventTest extends AbstractUserEventTestCase
|
class UserWasAddedEventTest extends AbstractUserEventTestCase
|
||||||
{
|
{
|
||||||
|
protected function objectHasHandlers()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getObjectAndParams()
|
protected function getObjectAndParams()
|
||||||
{
|
{
|
||||||
$params = ['user' => new User()];
|
$params = ['user' => new User()];
|
||||||
|
|||||||
Reference in New Issue
Block a user