Conditions | 1 |
Paths | 1 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
11 | public function testWithState() |
||
12 | { |
||
13 | $original = new FluentState; |
||
14 | |||
15 | $original->withState(function ($newState) use ($original) { |
||
16 | $this->assertInstanceOf(FluentState::class, $newState); |
||
17 | $this->assertNotSame($original, $newState); |
||
18 | |||
19 | // Tests that the new state is injected |
||
20 | $newState->setLocale('foo'); |
||
21 | $this->assertSame('foo', FluentTemplateGlobalProvider::getCurrentLocale()); |
||
22 | }); |
||
23 | |||
24 | // Tests that the original state is restored |
||
25 | $this->assertSame($original, FluentState::singleton()); |
||
26 | } |
||
28 |