Skip to content

Commit 669ceab

Browse files
committed
Added tests
1 parent 70059cd commit 669ceab

25 files changed

+3262
-1
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"dazzle-php/util": "0.5.*"
2525
},
2626
"require-dev": {
27-
"phpunit/phpunit": ">=4.8.0 <5.4.0"
27+
"phpunit/phpunit": ">=4.8.0 <5.4.0",
28+
"react/event-loop": "0.4.*"
2829
},
2930
"suggest": {
3031
"ext-libevent": ">=0.1.0",

test/Callback.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Dazzle\Loop\Test;
4+
5+
class Callback
6+
{
7+
public function __invoke()
8+
{}
9+
}

test/TModule.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
namespace Dazzle\Loop\Test;
4+
5+
class TModule extends TUnit
6+
{}

test/TModule/LoopFactoryTest.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
namespace Dazzle\Loop\Test\TModule;
4+
5+
use Dazzle\Loop\LoopFactory;
6+
use Dazzle\Loop\LoopModelInterface;
7+
use Dazzle\Loop\Model\SelectLoop;
8+
use Dazzle\Loop\Test\TModule;
9+
10+
class LoopFactoryTest extends TModule
11+
{
12+
/**
13+
* LoopFactoryInterface
14+
*/
15+
public function createFactory()
16+
{
17+
return new LoopFactory();
18+
}
19+
20+
/**
21+
* @return string[]
22+
*/
23+
public function getModels()
24+
{
25+
return [
26+
'SelectLoop' => SelectLoop::class
27+
];
28+
}
29+
30+
/**
31+
*
32+
*/
33+
public function testCaseFactory_PossesDefinitionForAllModels()
34+
{
35+
$factory = $this->createFactory();
36+
$models = $this->getModels();
37+
38+
foreach ($models as $alias=>$class)
39+
{
40+
$this->assertTrue($factory->hasDefinition($alias));
41+
$this->assertInstanceOf($class, $model = $factory->create($alias));
42+
$this->assertInstanceOf(LoopModelInterface::class, $model);
43+
}
44+
}
45+
}

0 commit comments

Comments
 (0)