Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
khelle committed Jun 24, 2017
1 parent 70059cd commit 669ceab
Show file tree
Hide file tree
Showing 25 changed files with 3,262 additions and 1 deletion.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"dazzle-php/util": "0.5.*"
},
"require-dev": {
"phpunit/phpunit": ">=4.8.0 <5.4.0"
"phpunit/phpunit": ">=4.8.0 <5.4.0",
"react/event-loop": "0.4.*"
},
"suggest": {
"ext-libevent": ">=0.1.0",
Expand Down
9 changes: 9 additions & 0 deletions test/Callback.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Dazzle\Loop\Test;

class Callback
{
public function __invoke()
{}
}
6 changes: 6 additions & 0 deletions test/TModule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

namespace Dazzle\Loop\Test;

class TModule extends TUnit
{}
45 changes: 45 additions & 0 deletions test/TModule/LoopFactoryTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Dazzle\Loop\Test\TModule;

use Dazzle\Loop\LoopFactory;
use Dazzle\Loop\LoopModelInterface;
use Dazzle\Loop\Model\SelectLoop;
use Dazzle\Loop\Test\TModule;

class LoopFactoryTest extends TModule
{
/**
* LoopFactoryInterface
*/
public function createFactory()
{
return new LoopFactory();
}

/**
* @return string[]
*/
public function getModels()
{
return [
'SelectLoop' => SelectLoop::class
];
}

/**
*
*/
public function testCaseFactory_PossesDefinitionForAllModels()
{
$factory = $this->createFactory();
$models = $this->getModels();

foreach ($models as $alias=>$class)
{
$this->assertTrue($factory->hasDefinition($alias));
$this->assertInstanceOf($class, $model = $factory->create($alias));
$this->assertInstanceOf(LoopModelInterface::class, $model);
}
}
}
Loading

0 comments on commit 669ceab

Please sign in to comment.