* * 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:----Ubc3CMqlxVNw7iUzVS3HgWDIFq/ja+Zm/vKH/0VfVQBWnQx6fxFraNzFPZru4BwLeb8WI1uLI7XpjZcIGUYW2z17tvBXJYucbdzUqUi7Td0+XhxBjMn5WQUXBoezSpxOEjqlImAmbRv7UpsyrwZNkYtnteDZqktTS37sBvEXYxD2iT/yK2dmM5/cZFRCzEQD1sTdufQSOttANEMx+13PMblTWcrVv4C43R4MleTZtzYgKmK84wPDdbJOs9KpDf9PgL2E2Gz+wvUGlb8qK0weqUlmHPY3gEM2OlooW2V5K4Pq5M1jPnGnCcmd8Wm/XeGMn67jLxjIT93Bp3Fj9Oej0GaelpEhSPxcsQGztULUrY5WJFlJUNRIHLrLUQqAuJeqqNcCopgxnypaPD3RSR6x149c2LLIscZx0c49QEroexUB120D+9IcaS4taJN05bCrJZx7Vn0zjhh7AZZOiAVWMFfsB73tnFj316ddeSGvwrswMmMgZuOo05mAZFFvQ1+NrxnzLgT9iaCgxe9IOy7k1opyUFS1yKy6CuZ+eyHL8rRflogjIl4V6RA2kWMwEQoa4E1P4XViYJ2EtWKRMjC4Ejz0JT3dgB9cS6uwfCtaZWpvYiKnPb9VSKlGPpmX77ygOFkyPmGS40fk27y5g6+Sh1IcRMM5CyBkhyn9+rABkuI=----ATTACHMENT:----NDYyNzA0NjM3Nzc1NDIwOCA5MTI0ODQ5Nzc2NDk1Nzk1IDk0MTQ1MTQ5MDYwMDY0NTg=