for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Onoi\EventDispatcher\Tests;
use Onoi\EventDispatcher\DispatchContext;
/**
* @covers \Onoi\EventDispatcher\DispatchContext
*
* @group onoi-event-dispatcher
* @license GNU GPL v2+
* @since 1.0
* @author mwjames
*/
class DispatchContextTest extends \PHPUnit_Framework_TestCase {
public function testCanConstruct() {
$this->assertInstanceOf(
'\Onoi\EventDispatcher\DispatchContext',
new DispatchContext()
);
}
public function testRoundtrip() {
$instance = new DispatchContext();
$this->assertFalse(
$instance->has( 'FOO' )
$instance->set( 'foo', 'bar' );
$this->assertTrue(
$this->assertEquals(
'bar',
$instance->get( 'FOO' )
$instance->set( 'foo', new \stdClass );
new \stdClass,
public function testNewFromArray() {
$instance = DispatchContext::newFromArray( [ 'FOO' => 123 ] );
123,
$instance->get( 'foo' )
public function testChangePropagationState() {
$instance->isPropagationStopped()
$instance->set( 'proPagationSTOP', true );
public function testUnknownKeyThrowsException() {
$this->setExpectedException( 'InvalidArgumentException' );
$instance->get( 'FOO' );