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\Proxy;
 13: 
 14: use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
 15: 
 16: // Note until PHPUnit_Mock_Objects 1.2 is released you cannot mock abstracts due to
 17: // https://github.com/sebastianbergmann/phpunit-mock-objects/issues/73
 18: class ConcreteProxy extends AbstractProxy
 19: {
 20: }
 21: 
 22: class ConcreteSessionHandlerInterfaceProxy extends AbstractProxy implements \SessionHandlerInterface
 23: {
 24:     public function open($savePath, $sessionName)
 25:     {
 26:     }
 27: 
 28:     public function close()
 29:     {
 30:     }
 31: 
 32:     public function read($id)
 33:     {
 34:     }
 35: 
 36:     public function write($id, $data)
 37:     {
 38:     }
 39: 
 40:     public function destroy($id)
 41:     {
 42:     }
 43: 
 44:     public function gc($maxlifetime)
 45:     {
 46:     }
 47: }
 48: 
 49: /**
 50:  * Test class for AbstractProxy.
 51:  *
 52:  * @author Drak <drak@zikula.org>
 53:  */
 54: class AbstractProxyTest extends \PHPUnit_Framework_TestCase
 55: {
 56:     /**
 57:      * @var AbstractProxy
 58:      */
 59:     protected $proxy;
 60: 
 61:     protected function setUp()
 62:     {
 63:         $this->proxy = new ConcreteProxy();
 64:     }
 65: 
 66:     protected function tearDown()
 67:     {
 68:         $this->proxy = null;
 69:     }
 70: 
 71:     public function testGetSaveHandlerName()
 72:     {
 73:         $this->assertNull($this->proxy->getSaveHandlerName());
 74:     }
 75: 
 76:     public function testIsSessionHandlerInterface()
 77:     {
 78:         $this->assertFalse($this->proxy->isSessionHandlerInterface());
 79:         $sh = new ConcreteSessionHandlerInterfaceProxy();
 80:         $this->assertTrue($sh->isSessionHandlerInterface());
 81:     }
 82: 
 83:     public function testIsWrapper()
 84:     {
 85:         $this->assertFalse($this->proxy->isWrapper());
 86:     }
 87: 
 88:     public function testIsActivePhp53()
 89:     {
 90:         if (PHP_VERSION_ID >= 50400) {
 91:             $this->markTestSkipped('Test skipped, for PHP 5.3 only.');
 92:         }
 93: 
 94:         $this->assertFalse($this->proxy->isActive());
 95:     }
 96: 
 97:     /**
 98:      * @runInSeparateProcess
 99:      * @preserveGlobalState disabled
100:      */
101:     public function testIsActivePhp54()
102:     {
103:         if (PHP_VERSION_ID < 50400) {
104:             $this->markTestSkipped('Test skipped, for PHP 5.4 only.');
105:         }
106: 
107:         $this->assertFalse($this->proxy->isActive());
108:         session_start();
109:         $this->assertTrue($this->proxy->isActive());
110:     }
111: 
112:     public function testSetActivePhp53()
113:     {
114:         if (PHP_VERSION_ID >= 50400) {
115:             $this->markTestSkipped('Test skipped, for PHP 5.3 only.');
116:         }
117: 
118:         $this->proxy->setActive(true);
119:         $this->assertTrue($this->proxy->isActive());
120:         $this->proxy->setActive(false);
121:         $this->assertFalse($this->proxy->isActive());
122:     }
123: 
124:     /**
125:      * @runInSeparateProcess
126:      * @preserveGlobalState disabled
127:      * @expectedException \LogicException
128:      */
129:     public function testSetActivePhp54()
130:     {
131:         if (PHP_VERSION_ID < 50400) {
132:             $this->markTestSkipped('Test skipped, for PHP 5.4 only.');
133:         }
134: 
135:         $this->proxy->setActive(true);
136:     }
137: 
138:     /**
139:      * @runInSeparateProcess
140:      * @preserveGlobalState disabled
141:      */
142:     public function testName()
143:     {
144:         $this->assertEquals(session_name(), $this->proxy->getName());
145:         $this->proxy->setName('foo');
146:         $this->assertEquals('foo', $this->proxy->getName());
147:         $this->assertEquals(session_name(), $this->proxy->getName());
148:     }
149: 
150:     /**
151:      * @expectedException \LogicException
152:      */
153:     public function testNameExceptionPhp53()
154:     {
155:         if (PHP_VERSION_ID >= 50400) {
156:             $this->markTestSkipped('Test skipped, for PHP 5.3 only.');
157:         }
158: 
159:         $this->proxy->setActive(true);
160:         $this->proxy->setName('foo');
161:     }
162: 
163:     /**
164:      * @runInSeparateProcess
165:      * @preserveGlobalState disabled
166:      * @expectedException \LogicException
167:      */
168:     public function testNameExceptionPhp54()
169:     {
170:         if (PHP_VERSION_ID < 50400) {
171:             $this->markTestSkipped('Test skipped, for PHP 5.4 only.');
172:         }
173: 
174:         session_start();
175:         $this->proxy->setName('foo');
176:     }
177: 
178:     /**
179:      * @runInSeparateProcess
180:      * @preserveGlobalState disabled
181:      */
182:     public function testId()
183:     {
184:         $this->assertEquals(session_id(), $this->proxy->getId());
185:         $this->proxy->setId('foo');
186:         $this->assertEquals('foo', $this->proxy->getId());
187:         $this->assertEquals(session_id(), $this->proxy->getId());
188:     }
189: 
190:     /**
191:      * @expectedException \LogicException
192:      */
193:     public function testIdExceptionPhp53()
194:     {
195:         if (PHP_VERSION_ID >= 50400) {
196:             $this->markTestSkipped('Test skipped, for PHP 5.3 only.');
197:         }
198: 
199:         $this->proxy->setActive(true);
200:         $this->proxy->setId('foo');
201:     }
202: 
203:     /**
204:      * @runInSeparateProcess
205:      * @preserveGlobalState disabled
206:      * @expectedException \LogicException
207:      */
208:     public function testIdExceptionPhp54()
209:     {
210:         if (PHP_VERSION_ID < 50400) {
211:             $this->markTestSkipped('Test skipped, for PHP 5.4 only.');
212:         }
213: 
214:         session_start();
215:         $this->proxy->setId('foo');
216:     }
217: }
218: 
Omnipay Fat Zebra / Paystream Gateway Module API Documentation API documentation generated by ApiGen