4
4
5
5
class RegistryTest extends \PHPUnit_Framework_TestCase
6
6
{
7
- use Registry ;
7
+ private $ registry ;
8
8
9
9
protected function setUp ()
10
10
{
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);
30
12
}
31
13
32
14
/** @test */
33
15
public function defaultsToNull ()
34
16
{
35
- // emulate we're in an event loop…
36
- self ::$ registry = [];
37
- $ this ->assertNull (self ::fetchState ("foobar " ));
17
+ $ this ->assertNull ($ this ->registry ->fetchState ("foobar " ));
38
18
}
39
19
40
20
/**
@@ -43,13 +23,10 @@ public function defaultsToNull()
43
23
*/
44
24
public function fetchesStoredValue ($ value )
45
25
{
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 );
51
28
52
- $ this ->assertSame ($ value , self :: fetchState ("foobar " ));
29
+ $ this ->assertSame ($ value , $ this -> registry -> fetchState ("foobar " ));
53
30
}
54
31
55
32
public function provideValues ()
0 commit comments