Skip to content

Commit 237a9c4

Browse files
committed
Update registry test
1 parent 4908813 commit 237a9c4

File tree

1 file changed

+6
-29
lines changed

1 file changed

+6
-29
lines changed

test/RegistryTest.php

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,17 @@
44

55
class RegistryTest extends \PHPUnit_Framework_TestCase
66
{
7-
use Registry;
7+
private $registry;
88

99
protected function setUp()
1010
{
11-
self::$registry = null;
12-
}
13-
14-
/**
15-
* @test
16-
* @expectedException \RuntimeException
17-
*/
18-
public function fetchfailsOutsideOfLoop()
19-
{
20-
self::fetchState("foobar");
21-
}
22-
23-
/**
24-
* @test
25-
* @expectedException \RuntimeException
26-
*/
27-
public function storefailsOutsideOfLoop()
28-
{
29-
self::fetchState("store");
11+
$this->registry = $this->getMockForTrait(Registry::class);
3012
}
3113

3214
/** @test */
3315
public function defaultsToNull()
3416
{
35-
// emulate we're in an event loop…
36-
self::$registry = [];
37-
$this->assertNull(self::fetchState("foobar"));
17+
$this->assertNull($this->registry->fetchState("foobar"));
3818
}
3919

4020
/**
@@ -43,13 +23,10 @@ public function defaultsToNull()
4323
*/
4424
public function fetchesStoredValue($value)
4525
{
46-
// emulate we're in an event loop…
47-
self::$registry = [];
48-
49-
$this->assertNull(self::fetchState("foobar"));
50-
self::storeState("foobar", $value);
26+
$this->assertNull($this->registry->fetchState("foobar"));
27+
$this->registry->storeState("foobar", $value);
5128

52-
$this->assertSame($value, self::fetchState("foobar"));
29+
$this->assertSame($value, $this->registry->fetchState("foobar"));
5330
}
5431

5532
public function provideValues()

0 commit comments

Comments
 (0)