Skip to content

Commit 19aaa2a

Browse files
committed
Refactoring gears tests.
Signed-off-by: Jason Lewis <jason.lewis1991@gmail.com>
1 parent b09413d commit 19aaa2a

1 file changed

Lines changed: 21 additions & 30 deletions

File tree

tests/gear.test.php

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,43 @@
22

33
class GearTest extends PHPUnit_Framework_TestCase {
44

5-
public function testCanRegisterGear()
5+
public $feather;
6+
7+
public function setUp()
68
{
7-
$feather = $this->stub();
9+
$this->feather = Feather\Components\Support\Facade::application();
810

9-
$this->assertTrue($feather['gear']->registered('stub'));
11+
$this->feather['gear']->register(new Feather\Models\Gear(array(
12+
'identifier' => 'stub',
13+
'location' => 'path: ' . __DIR__ . DS . 'mock',
14+
'auto' => false
15+
)));
1016
}
1117

12-
public function testCanStartGear()
18+
public function testCanRegisterGear()
1319
{
14-
$feather = $this->stub();
20+
$this->assertTrue($this->feather['gear']->registered('stub'));
21+
}
1522

16-
$this->assertInstanceOf('Feather\\Components\\Gear\\Container', $gear = $feather['gear']->start('stub'));
17-
$this->assertTrue($feather['gear']->started('stub'));
23+
public function testCanStartGear()
24+
{
25+
$this->assertInstanceOf('Feather\\Components\\Gear\\Container', $gear = $this->feather['gear']->start('stub'));
26+
$this->assertTrue($this->feather['gear']->started('stub'));
1827
$this->assertInstanceOf('Feather\\Gear\\Stub\\Mock', $gear['mock']);
1928
}
2029

2130
public function testCanDisableGear()
2231
{
23-
$feather = $this->stub();
24-
25-
$this->assertTrue($feather['gear']->registered('stub'));
32+
$this->assertTrue($this->feather['gear']->registered('stub'));
2633

27-
$feather['gear']->disable('stub');
34+
$this->feather['gear']->disable('stub');
2835

29-
$this->assertTrue(!$feather['gear']->registered('stub'));
36+
$this->assertTrue(!$this->feather['gear']->registered('stub'));
3037
}
3138

3239
public function testGearEventsFire()
3340
{
34-
$feather = $this->stub();
35-
36-
$this->assertEquals('cat', $feather['gear']->first('mock.callable'));
37-
$this->assertEquals('dog', $feather['gear']->first('mock.method'));
41+
$this->assertEquals('cat', $this->feather['gear']->first('mock.callable'));
42+
$this->assertEquals('dog', $this->feather['gear']->first('mock.method'));
3843
}
39-
40-
public function stub()
41-
{
42-
$feather = Feather\Components\Support\Facade::application();
43-
44-
$feather['gear']->register(new Feather\Models\Gear(array(
45-
'identifier' => 'stub',
46-
'location' => 'path: ' . __DIR__ . DS . 'mock',
47-
'auto' => false
48-
)));
49-
50-
return $feather;
51-
}
52-
5344
}

0 commit comments

Comments
 (0)