Updated tests

This commit is contained in:
Graham Campbell
2015-09-14 09:13:42 +01:00
parent d40b6cef57
commit f4b569f2fd
2 changed files with 18 additions and 3 deletions

View File

@@ -27,6 +27,11 @@ abstract class AbstractEventTestCase extends AbstractAnemicTestCase
return false;
}
protected function objectHasHandlers()
{
return true;
}
public function testEventImplementsTheCorrectInterfaces()
{
$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->setAccessible(true);
@@ -45,10 +50,15 @@ abstract class AbstractEventTestCase extends AbstractAnemicTestCase
$mappings = $property->getValue(new EventServiceProvider($this->app));
$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) {
$this->assertInstanceOf($handler, $this->app->make($handler));
}
}*/
}
}

View File

@@ -16,6 +16,11 @@ use CachetHQ\Cachet\Models\User;
class UserWasAddedEventTest extends AbstractUserEventTestCase
{
protected function objectHasHandlers()
{
return false;
}
protected function getObjectAndParams()
{
$params = ['user' => new User()];