Source of file FluentStateTest.php
Size: 0,820 Bytes - Last Modified: 2021-12-23T10:53:31+00:00
/var/www/docs.ssmods.com/process/src/tests/php/State/FluentStateTest.php
12345678910111213141516171819202122232425262728 | <?php namespace TractorCow\Fluent\Tests\State; use SilverStripe\Dev\SapphireTest; use TractorCow\Fluent\State\FluentState; use TractorCow\Fluent\View\FluentTemplateGlobalProvider; class FluentStateTest extends SapphireTest { public function testWithState() { $original = new FluentState; $original->withState(function ($newState) use ($original) { $this->assertInstanceOf(FluentState::class, $newState); $this->assertNotSame($original, $newState); // Tests that the new state is injected $newState->setLocale('foo'); $this->assertSame('foo', FluentTemplateGlobalProvider::getCurrentLocale()); }); // Tests that the original state is restored $this->assertSame($original, FluentState::singleton()); } } |