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;
 13: 
 14: use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
 15: use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
 16: use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
 17: 
 18: /**
 19:  * Test class for MockArraySessionStorage.
 20:  *
 21:  * @author Drak <drak@zikula.org>
 22:  */
 23: class MockArraySessionStorageTest extends \PHPUnit_Framework_TestCase
 24: {
 25:     /**
 26:      * @var MockArraySessionStorage
 27:      */
 28:     private $storage;
 29: 
 30:     /**
 31:      * @var AttributeBag
 32:      */
 33:     private $attributes;
 34: 
 35:     /**
 36:      * @var FlashBag
 37:      */
 38:     private $flashes;
 39: 
 40:     private $data;
 41: 
 42:     protected function setUp()
 43:     {
 44:         $this->attributes = new AttributeBag();
 45:         $this->flashes = new FlashBag();
 46: 
 47:         $this->data = array(
 48:             $this->attributes->getStorageKey() => array('foo' => 'bar'),
 49:             $this->flashes->getStorageKey() => array('notice' => 'hello'),
 50:             );
 51: 
 52:         $this->storage = new MockArraySessionStorage();
 53:         $this->storage->registerBag($this->flashes);
 54:         $this->storage->registerBag($this->attributes);
 55:         $this->storage->setSessionData($this->data);
 56:     }
 57: 
 58:     protected function tearDown()
 59:     {
 60:         $this->data = null;
 61:         $this->flashes = null;
 62:         $this->attributes = null;
 63:         $this->storage = null;
 64:     }
 65: 
 66:     public function testStart()
 67:     {
 68:         $this->assertEquals('', $this->storage->getId());
 69:         $this->storage->start();
 70:         $id = $this->storage->getId();
 71:         $this->assertNotEquals('', $id);
 72:         $this->storage->start();
 73:         $this->assertEquals($id, $this->storage->getId());
 74:     }
 75: 
 76:     public function testRegenerate()
 77:     {
 78:         $this->storage->start();
 79:         $id = $this->storage->getId();
 80:         $this->storage->regenerate();
 81:         $this->assertNotEquals($id, $this->storage->getId());
 82:         $this->assertEquals(array('foo' => 'bar'), $this->storage->getBag('attributes')->all());
 83:         $this->assertEquals(array('notice' => 'hello'), $this->storage->getBag('flashes')->peekAll());
 84: 
 85:         $id = $this->storage->getId();
 86:         $this->storage->regenerate(true);
 87:         $this->assertNotEquals($id, $this->storage->getId());
 88:         $this->assertEquals(array('foo' => 'bar'), $this->storage->getBag('attributes')->all());
 89:         $this->assertEquals(array('notice' => 'hello'), $this->storage->getBag('flashes')->peekAll());
 90:     }
 91: 
 92:     public function testGetId()
 93:     {
 94:         $this->assertEquals('', $this->storage->getId());
 95:         $this->storage->start();
 96:         $this->assertNotEquals('', $this->storage->getId());
 97:     }
 98: 
 99:     /**
100:      * @expectedException \RuntimeException
101:      */
102:     public function testUnstartedSave()
103:     {
104:         $this->storage->save();
105:     }
106: }
107: 
Omnipay Fat Zebra / Paystream Gateway Module API Documentation API documentation generated by ApiGen