Overview

Namespaces

  • Composer
    • Autoload
  • Guzzle
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
        • Header
      • QueryAggregator
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Mock
    • Stream
  • Mockery
    • Adapter
      • Phpunit
    • CountValidator
    • Exception
    • Generator
      • StringManipulation
        • Pass
    • Loader
    • Matcher
  • None
  • Omnipay
    • Common
      • Exception
      • Message
    • Dummy
      • Message
    • Fatzebra
      • Message
  • PHP
  • Symfony
    • Component
      • EventDispatcher
        • Debug
        • DependencyInjection
        • Tests
          • Debug
          • DependencyInjection
      • HttpFoundation
        • File
          • Exception
          • MimeType
        • Session
          • Attribute
          • Flash
          • Storage
            • Handler
            • Proxy
        • Tests
          • File
            • MimeType
          • Session
            • Attribute
            • Flash
            • Storage
              • Handler
              • Proxy
      • Yaml
        • Exception
        • Tests

Classes

  • Symfony\Component\Yaml\Tests\A
  • Symfony\Component\Yaml\Tests\B
  • Symfony\Component\Yaml\Tests\DumperTest
  • Symfony\Component\Yaml\Tests\InlineTest
  • Symfony\Component\Yaml\Tests\ParseExceptionTest
  • Symfony\Component\Yaml\Tests\ParserTest
  • Symfony\Component\Yaml\Tests\YamlTest
  • Overview
  • Namespace
  • Function
  • Tree
 1: <?php
 2: 
 3: /*
 4:  * This file is part of the Symfony package.
 5:  *
 6:  * (c) Fabien Potencier <fabien@symfony.com>
 7:  *
 8:  * For the full copyright and license information, please view the LICENSE
 9:  * file that was distributed with this source code.
10:  */
11: 
12: namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
13: 
14: use Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler;
15: 
16: /**
17:  * @author Adrien Brault <adrien.brault@gmail.com>
18:  */
19: class WriteCheckSessionHandlerTest extends \PHPUnit_Framework_TestCase
20: {
21:     public function test()
22:     {
23:         $wrappedSessionHandlerMock = $this->getMock('SessionHandlerInterface');
24:         $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock);
25: 
26:         $wrappedSessionHandlerMock
27:             ->expects($this->once())
28:             ->method('close')
29:             ->with()
30:             ->will($this->returnValue(true))
31:         ;
32: 
33:         $this->assertTrue($writeCheckSessionHandler->close());
34:     }
35: 
36:     public function testWrite()
37:     {
38:         $wrappedSessionHandlerMock = $this->getMock('SessionHandlerInterface');
39:         $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock);
40: 
41:         $wrappedSessionHandlerMock
42:             ->expects($this->once())
43:             ->method('write')
44:             ->with('foo', 'bar')
45:             ->will($this->returnValue(true))
46:         ;
47: 
48:         $this->assertTrue($writeCheckSessionHandler->write('foo', 'bar'));
49:     }
50: 
51:     public function testSkippedWrite()
52:     {
53:         $wrappedSessionHandlerMock = $this->getMock('SessionHandlerInterface');
54:         $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock);
55: 
56:         $wrappedSessionHandlerMock
57:             ->expects($this->once())
58:             ->method('read')
59:             ->with('foo')
60:             ->will($this->returnValue('bar'))
61:         ;
62: 
63:         $wrappedSessionHandlerMock
64:             ->expects($this->never())
65:             ->method('write')
66:         ;
67: 
68:         $this->assertEquals('bar', $writeCheckSessionHandler->read('foo'));
69:         $this->assertTrue($writeCheckSessionHandler->write('foo', 'bar'));
70:     }
71: 
72:     public function testNonSkippedWrite()
73:     {
74:         $wrappedSessionHandlerMock = $this->getMock('SessionHandlerInterface');
75:         $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock);
76: 
77:         $wrappedSessionHandlerMock
78:             ->expects($this->once())
79:             ->method('read')
80:             ->with('foo')
81:             ->will($this->returnValue('bar'))
82:         ;
83: 
84:         $wrappedSessionHandlerMock
85:             ->expects($this->once())
86:             ->method('write')
87:             ->with('foo', 'baZZZ')
88:             ->will($this->returnValue(true))
89:         ;
90: 
91:         $this->assertEquals('bar', $writeCheckSessionHandler->read('foo'));
92:         $this->assertTrue($writeCheckSessionHandler->write('foo', 'baZZZ'));
93:     }
94: }
95: 
Omnipay Fat Zebra / Paystream Gateway Module API Documentation API documentation generated by ApiGen