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\EventDispatcher\Tests;
 13: 
 14: use Symfony\Component\EventDispatcher\Event;
 15: use Symfony\Component\EventDispatcher\ImmutableEventDispatcher;
 16: 
 17: /**
 18:  * @author Bernhard Schussek <bschussek@gmail.com>
 19:  */
 20: class ImmutableEventDispatcherTest extends \PHPUnit_Framework_TestCase
 21: {
 22:     /**
 23:      * @var \PHPUnit_Framework_MockObject_MockObject
 24:      */
 25:     private $innerDispatcher;
 26: 
 27:     /**
 28:      * @var ImmutableEventDispatcher
 29:      */
 30:     private $dispatcher;
 31: 
 32:     protected function setUp()
 33:     {
 34:         $this->innerDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
 35:         $this->dispatcher = new ImmutableEventDispatcher($this->innerDispatcher);
 36:     }
 37: 
 38:     public function testDispatchDelegates()
 39:     {
 40:         $event = new Event();
 41: 
 42:         $this->innerDispatcher->expects($this->once())
 43:             ->method('dispatch')
 44:             ->with('event', $event)
 45:             ->will($this->returnValue('result'));
 46: 
 47:         $this->assertSame('result', $this->dispatcher->dispatch('event', $event));
 48:     }
 49: 
 50:     public function testGetListenersDelegates()
 51:     {
 52:         $this->innerDispatcher->expects($this->once())
 53:             ->method('getListeners')
 54:             ->with('event')
 55:             ->will($this->returnValue('result'));
 56: 
 57:         $this->assertSame('result', $this->dispatcher->getListeners('event'));
 58:     }
 59: 
 60:     public function testHasListenersDelegates()
 61:     {
 62:         $this->innerDispatcher->expects($this->once())
 63:             ->method('hasListeners')
 64:             ->with('event')
 65:             ->will($this->returnValue('result'));
 66: 
 67:         $this->assertSame('result', $this->dispatcher->hasListeners('event'));
 68:     }
 69: 
 70:     /**
 71:      * @expectedException \BadMethodCallException
 72:      */
 73:     public function testAddListenerDisallowed()
 74:     {
 75:         $this->dispatcher->addListener('event', function () { return 'foo'; });
 76:     }
 77: 
 78:     /**
 79:      * @expectedException \BadMethodCallException
 80:      */
 81:     public function testAddSubscriberDisallowed()
 82:     {
 83:         $subscriber = $this->getMock('Symfony\Component\EventDispatcher\EventSubscriberInterface');
 84: 
 85:         $this->dispatcher->addSubscriber($subscriber);
 86:     }
 87: 
 88:     /**
 89:      * @expectedException \BadMethodCallException
 90:      */
 91:     public function testRemoveListenerDisallowed()
 92:     {
 93:         $this->dispatcher->removeListener('event', function () { return 'foo'; });
 94:     }
 95: 
 96:     /**
 97:      * @expectedException \BadMethodCallException
 98:      */
 99:     public function testRemoveSubscriberDisallowed()
100:     {
101:         $subscriber = $this->getMock('Symfony\Component\EventDispatcher\EventSubscriberInterface');
102: 
103:         $this->dispatcher->removeSubscriber($subscriber);
104:     }
105: }
106: 
Omnipay Fat Zebra / Paystream Gateway Module API Documentation API documentation generated by ApiGen