* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler; /** * @author Adrien Brault * * @group legacy */ class WriteCheckSessionHandlerTest extends TestCase { public function test() { $wrappedSessionHandlerMock = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock); $wrappedSessionHandlerMock ->expects($this->once()) ->method('close') ->with() ->will($this->returnValue(true)) ; $this->assertTrue($writeCheckSessionHandler->close()); } public function testWrite() { $wrappedSessionHandlerMock = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock); $wrappedSessionHandlerMock ->expects($this->once()) ->method('write') ->with('foo', 'bar') ->will($this->returnValue(true)) ; $this->assertTrue($writeCheckSessionHandler->write('foo', 'bar')); } public function testSkippedWrite() { $wrappedSessionHandlerMock = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock); $wrappedSessionHandlerMock ->expects($this->once()) ->method('read') ->with('foo') ->will($this->returnValue('bar')) ; $wrappedSessionHandlerMock ->expects($this->never()) ->method('write') ; $this->assertEquals('bar', $writeCheckSessionHandler->read('foo')); $this->assertTrue($writeCheckSessionHandler->write('foo', 'bar')); } public function testNonSkippedWrite() { $wrappedSessionHandlerMock = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock); $wrappedSessionHandlerMock ->expects($this->once()) ->method('read') ->with('foo') ->will($this->returnValue('bar')) ; $wrappedSessionHandlerMock ->expects($this->once()) ->method('write') ->with('foo', 'baZZZ') ->will($this->returnValue(true)) ; $this->assertEquals('bar', $writeCheckSessionHandler->read('foo')); $this->assertTrue($writeCheckSessionHandler->write('foo', 'baZZZ')); } } __halt_compiler();----SIGNATURE:----aEaVW+nwEwSua7hZbObcQOqYYZwFjmvkFStpB3uS2fKLeeBwlwDeNFXemDh7X4+520PQKKxGI/guNQs1i3lY3ITssbT9Lrghcww/+4dcAN8MYnn9gHOOVzqllRtV+cvlLCLX72X/dfCA5stEvC7usTOnhByvpYwNw7N4P88nhwsQMkiN2ASLaEt9DiWHYoJ47xFIURnhR6uO4uARI6r6NUvOJU9z+zsueB/Ify7AIX4quMQMPU7kQriT8IQZCdbAHQZHzve43/8p9DduUtcCRIWRVgJxJylIQwF6sg4w+/gqKOd1N0Rgove1ZwoLlGS9xQVWvSDBhbzPxY127AkK15kW5PHoN0pU48cCH955APUYNy5sSFQlnRRuQEcVBL63ERqdYY1Ntd0R9+Ir4dj6kDFw4UfxB/qCxVH6AdWN9cr6XySM4+so5TRoQaVxVX5hIjS7pQIOluVowMzWu9OogHY7z9TJ9BiZHGB4x1IOfVyoFgNzv67BAuUNfHMEMIhUte/zBdNf40DEv+vCJ8GCKYBiFClexn8GTbynHNPxLLrcl3g/KOtvcYuHOL3teGFcWkOCCOhd2vbQW8PuyPG/ZWbbVAyQ1qdQJY96agas7z1cnRrth6K+/OT+baiE/AhbnLC4pXTmviGUM1HZ7Skm8dqtX4pxt5deX4rvh7xz1Z8=----ATTACHMENT:----MjAxMzI4NjYyNTkyNjkzMCA4MDc4NTY0MDEyNTYwMDQgOTc5MzM3NDU5MzY0MDg5OQ==