updated packages

This commit is contained in:
2019-05-18 09:06:43 +00:00
parent 901d16349e
commit e9487fa58a
2025 changed files with 30366 additions and 49653 deletions

View File

@@ -47,15 +47,15 @@ abstract class AbstractEventDispatcherTest extends TestCase
public function testInitialState()
{
$this->assertEquals(array(), $this->dispatcher->getListeners());
$this->assertEquals([], $this->dispatcher->getListeners());
$this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
$this->assertFalse($this->dispatcher->hasListeners(self::postFoo));
}
public function testAddListener()
{
$this->dispatcher->addListener('pre.foo', array($this->listener, 'preFoo'));
$this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'));
$this->dispatcher->addListener('pre.foo', [$this->listener, 'preFoo']);
$this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo']);
$this->assertTrue($this->dispatcher->hasListeners());
$this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
$this->assertTrue($this->dispatcher->hasListeners(self::postFoo));
@@ -73,15 +73,15 @@ abstract class AbstractEventDispatcherTest extends TestCase
$listener2->name = '2';
$listener3->name = '3';
$this->dispatcher->addListener('pre.foo', array($listener1, 'preFoo'), -10);
$this->dispatcher->addListener('pre.foo', array($listener2, 'preFoo'), 10);
$this->dispatcher->addListener('pre.foo', array($listener3, 'preFoo'));
$this->dispatcher->addListener('pre.foo', [$listener1, 'preFoo'], -10);
$this->dispatcher->addListener('pre.foo', [$listener2, 'preFoo'], 10);
$this->dispatcher->addListener('pre.foo', [$listener3, 'preFoo']);
$expected = array(
array($listener2, 'preFoo'),
array($listener3, 'preFoo'),
array($listener1, 'preFoo'),
);
$expected = [
[$listener2, 'preFoo'],
[$listener3, 'preFoo'],
[$listener1, 'preFoo'],
];
$this->assertSame($expected, $this->dispatcher->getListeners('pre.foo'));
}
@@ -102,10 +102,10 @@ abstract class AbstractEventDispatcherTest extends TestCase
$this->dispatcher->addListener('post.foo', $listener5);
$this->dispatcher->addListener('post.foo', $listener6, 10);
$expected = array(
'pre.foo' => array($listener3, $listener2, $listener1),
'post.foo' => array($listener6, $listener5, $listener4),
);
$expected = [
'pre.foo' => [$listener3, $listener2, $listener1],
'post.foo' => [$listener6, $listener5, $listener4],
];
$this->assertSame($expected, $this->dispatcher->getListeners());
}
@@ -126,8 +126,8 @@ abstract class AbstractEventDispatcherTest extends TestCase
public function testDispatch()
{
$this->dispatcher->addListener('pre.foo', array($this->listener, 'preFoo'));
$this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'));
$this->dispatcher->addListener('pre.foo', [$this->listener, 'preFoo']);
$this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo']);
$this->dispatcher->dispatch(self::preFoo);
$this->assertTrue($this->listener->preFooInvoked);
$this->assertFalse($this->listener->postFooInvoked);
@@ -157,8 +157,8 @@ abstract class AbstractEventDispatcherTest extends TestCase
// postFoo() stops the propagation, so only one listener should
// be executed
// Manually set priority to enforce $this->listener to be called first
$this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'), 10);
$this->dispatcher->addListener('post.foo', array($otherListener, 'postFoo'));
$this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo'], 10);
$this->dispatcher->addListener('post.foo', [$otherListener, 'postFoo']);
$this->dispatcher->dispatch(self::postFoo);
$this->assertTrue($this->listener->postFooInvoked);
$this->assertFalse($otherListener->postFooInvoked);
@@ -166,7 +166,7 @@ abstract class AbstractEventDispatcherTest extends TestCase
public function testDispatchByPriority()
{
$invoked = array();
$invoked = [];
$listener1 = function () use (&$invoked) {
$invoked[] = '1';
};
@@ -180,7 +180,7 @@ abstract class AbstractEventDispatcherTest extends TestCase
$this->dispatcher->addListener('pre.foo', $listener2);
$this->dispatcher->addListener('pre.foo', $listener3, 10);
$this->dispatcher->dispatch(self::preFoo);
$this->assertEquals(array('3', '2', '1'), $invoked);
$this->assertEquals(['3', '2', '1'], $invoked);
}
public function testRemoveListener()
@@ -258,7 +258,7 @@ abstract class AbstractEventDispatcherTest extends TestCase
public function testEventReceivesTheDispatcherInstanceAsArgument()
{
$listener = new TestWithDispatcher();
$this->dispatcher->addListener('test', array($listener, 'foo'));
$this->dispatcher->addListener('test', [$listener, 'foo']);
$this->assertNull($listener->name);
$this->assertNull($listener->dispatcher);
$this->dispatcher->dispatch('test');
@@ -295,7 +295,7 @@ abstract class AbstractEventDispatcherTest extends TestCase
$listener = function () {};
$this->dispatcher->addListener('foo', $listener);
$this->dispatcher->removeListener('foo', $listener);
$this->assertSame(array(), $this->dispatcher->getListeners());
$this->assertSame([], $this->dispatcher->getListeners());
}
public function testHasListenersWithoutEventsReturnsFalseAfterHasListenersWithEventHasBeenCalled()
@@ -307,7 +307,7 @@ abstract class AbstractEventDispatcherTest extends TestCase
public function testHasListenersIsLazy()
{
$called = 0;
$listener = array(function () use (&$called) { ++$called; }, 'onFoo');
$listener = [function () use (&$called) { ++$called; }, 'onFoo'];
$this->dispatcher->addListener('foo', $listener);
$this->assertTrue($this->dispatcher->hasListeners());
$this->assertTrue($this->dispatcher->hasListeners('foo'));
@@ -322,7 +322,7 @@ abstract class AbstractEventDispatcherTest extends TestCase
return new TestWithDispatcher();
};
$this->dispatcher->addListener('foo', array($factory, 'foo'));
$this->dispatcher->addListener('foo', [$factory, 'foo']);
$this->assertSame(0, $called);
$this->dispatcher->dispatch('foo', new Event());
$this->dispatcher->dispatch('foo', new Event());
@@ -334,14 +334,14 @@ abstract class AbstractEventDispatcherTest extends TestCase
$test = new TestWithDispatcher();
$factory = function () use ($test) { return $test; };
$this->dispatcher->addListener('foo', array($factory, 'foo'));
$this->dispatcher->addListener('foo', [$factory, 'foo']);
$this->assertTrue($this->dispatcher->hasListeners('foo'));
$this->dispatcher->removeListener('foo', array($test, 'foo'));
$this->dispatcher->removeListener('foo', [$test, 'foo']);
$this->assertFalse($this->dispatcher->hasListeners('foo'));
$this->dispatcher->addListener('foo', array($test, 'foo'));
$this->dispatcher->addListener('foo', [$test, 'foo']);
$this->assertTrue($this->dispatcher->hasListeners('foo'));
$this->dispatcher->removeListener('foo', array($factory, 'foo'));
$this->dispatcher->removeListener('foo', [$factory, 'foo']);
$this->assertFalse($this->dispatcher->hasListeners('foo'));
}
@@ -350,12 +350,12 @@ abstract class AbstractEventDispatcherTest extends TestCase
$test = new TestWithDispatcher();
$factory = function () use ($test) { return $test; };
$this->dispatcher->addListener('foo', array($factory, 'foo'), 3);
$this->assertSame(3, $this->dispatcher->getListenerPriority('foo', array($test, 'foo')));
$this->dispatcher->removeListener('foo', array($factory, 'foo'));
$this->dispatcher->addListener('foo', [$factory, 'foo'], 3);
$this->assertSame(3, $this->dispatcher->getListenerPriority('foo', [$test, 'foo']));
$this->dispatcher->removeListener('foo', [$factory, 'foo']);
$this->dispatcher->addListener('foo', array($test, 'foo'), 5);
$this->assertSame(5, $this->dispatcher->getListenerPriority('foo', array($factory, 'foo')));
$this->dispatcher->addListener('foo', [$test, 'foo'], 5);
$this->assertSame(5, $this->dispatcher->getListenerPriority('foo', [$factory, 'foo']));
}
public function testGetLazyListeners()
@@ -363,12 +363,12 @@ abstract class AbstractEventDispatcherTest extends TestCase
$test = new TestWithDispatcher();
$factory = function () use ($test) { return $test; };
$this->dispatcher->addListener('foo', array($factory, 'foo'), 3);
$this->assertSame(array(array($test, 'foo')), $this->dispatcher->getListeners('foo'));
$this->dispatcher->addListener('foo', [$factory, 'foo'], 3);
$this->assertSame([[$test, 'foo']], $this->dispatcher->getListeners('foo'));
$this->dispatcher->removeListener('foo', array($test, 'foo'));
$this->dispatcher->addListener('bar', array($factory, 'foo'), 3);
$this->assertSame(array('bar' => array(array($test, 'foo'))), $this->dispatcher->getListeners());
$this->dispatcher->removeListener('foo', [$test, 'foo']);
$this->dispatcher->addListener('bar', [$factory, 'foo'], 3);
$this->assertSame(['bar' => [[$test, 'foo']]], $this->dispatcher->getListeners());
}
}
@@ -415,7 +415,7 @@ class TestEventSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return array('pre.foo' => 'preFoo', 'post.foo' => 'postFoo');
return ['pre.foo' => 'preFoo', 'post.foo' => 'postFoo'];
}
}
@@ -423,10 +423,10 @@ class TestEventSubscriberWithPriorities implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return array(
'pre.foo' => array('preFoo', 10),
'post.foo' => array('postFoo'),
);
return [
'pre.foo' => ['preFoo', 10],
'post.foo' => ['postFoo'],
];
}
}
@@ -434,9 +434,9 @@ class TestEventSubscriberWithMultipleListeners implements EventSubscriberInterfa
{
public static function getSubscribedEvents()
{
return array('pre.foo' => array(
array('preFoo1'),
array('preFoo2', 10),
));
return ['pre.foo' => [
['preFoo1'],
['preFoo2', 10],
]];
}
}

View File

@@ -98,7 +98,7 @@ class TraceableEventDispatcherTest extends TestCase
$tdispatcher->addSubscriber($subscriber);
$listeners = $dispatcher->getListeners('foo');
$this->assertCount(1, $listeners);
$this->assertSame(array($subscriber, 'call'), $listeners[0]);
$this->assertSame([$subscriber, 'call'], $listeners[0]);
$tdispatcher->removeSubscriber($subscriber);
$this->assertCount(0, $dispatcher->getListeners('foo'));
@@ -112,16 +112,16 @@ class TraceableEventDispatcherTest extends TestCase
$listeners = $tdispatcher->getNotCalledListeners();
$this->assertArrayHasKey('stub', $listeners[0]);
unset($listeners[0]['stub']);
$this->assertEquals(array(), $tdispatcher->getCalledListeners());
$this->assertEquals(array(array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners);
$this->assertEquals([], $tdispatcher->getCalledListeners());
$this->assertEquals([['event' => 'foo', 'pretty' => 'closure', 'priority' => 5]], $listeners);
$tdispatcher->dispatch('foo');
$listeners = $tdispatcher->getCalledListeners();
$this->assertArrayHasKey('stub', $listeners[0]);
unset($listeners[0]['stub']);
$this->assertEquals(array(array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners);
$this->assertEquals(array(), $tdispatcher->getNotCalledListeners());
$this->assertEquals([['event' => 'foo', 'pretty' => 'closure', 'priority' => 5]], $listeners);
$this->assertEquals([], $tdispatcher->getNotCalledListeners());
}
public function testClearCalledListeners()
@@ -135,8 +135,8 @@ class TraceableEventDispatcherTest extends TestCase
$listeners = $tdispatcher->getNotCalledListeners();
$this->assertArrayHasKey('stub', $listeners[0]);
unset($listeners[0]['stub']);
$this->assertEquals(array(), $tdispatcher->getCalledListeners());
$this->assertEquals(array(array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners);
$this->assertEquals([], $tdispatcher->getCalledListeners());
$this->assertEquals([['event' => 'foo', 'pretty' => 'closure', 'priority' => 5]], $listeners);
}
public function testDispatchAfterReset()
@@ -178,7 +178,7 @@ class TraceableEventDispatcherTest extends TestCase
$tdispatcher->dispatch('foo');
$events = $tdispatcher->getOrphanedEvents();
$this->assertCount(1, $events);
$this->assertEquals(array('foo'), $events);
$this->assertEquals(['foo'], $events);
}
public function testItDoesNotReturnHandledEvents()
@@ -199,8 +199,8 @@ class TraceableEventDispatcherTest extends TestCase
$tdispatcher->addListener('foo', $listener1 = function () {});
$tdispatcher->addListener('foo', $listener2 = function () {});
$logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', array('event' => 'foo', 'listener' => 'closure'));
$logger->expects($this->at(1))->method('debug')->with('Notified event "{event}" to listener "{listener}".', array('event' => 'foo', 'listener' => 'closure'));
$logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']);
$logger->expects($this->at(1))->method('debug')->with('Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']);
$tdispatcher->dispatch('foo');
}
@@ -214,16 +214,16 @@ class TraceableEventDispatcherTest extends TestCase
$tdispatcher->addListener('foo', $listener1 = function (Event $event) { $event->stopPropagation(); });
$tdispatcher->addListener('foo', $listener2 = function () {});
$logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', array('event' => 'foo', 'listener' => 'closure'));
$logger->expects($this->at(1))->method('debug')->with('Listener "{listener}" stopped propagation of the event "{event}".', array('event' => 'foo', 'listener' => 'closure'));
$logger->expects($this->at(2))->method('debug')->with('Listener "{listener}" was not called for event "{event}".', array('event' => 'foo', 'listener' => 'closure'));
$logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']);
$logger->expects($this->at(1))->method('debug')->with('Listener "{listener}" stopped propagation of the event "{event}".', ['event' => 'foo', 'listener' => 'closure']);
$logger->expects($this->at(2))->method('debug')->with('Listener "{listener}" was not called for event "{event}".', ['event' => 'foo', 'listener' => 'closure']);
$tdispatcher->dispatch('foo');
}
public function testDispatchCallListeners()
{
$called = array();
$called = [];
$dispatcher = new EventDispatcher();
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
@@ -232,7 +232,7 @@ class TraceableEventDispatcherTest extends TestCase
$tdispatcher->dispatch('foo');
$this->assertSame(array('foo2', 'foo1'), $called);
$this->assertSame(['foo2', 'foo1'], $called);
}
public function testDispatchNested()
@@ -300,6 +300,6 @@ class EventSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return array('foo' => 'call');
return ['foo' => 'call'];
}
}

View File

@@ -30,16 +30,16 @@ class WrappedListenerTest extends TestCase
public function provideListenersToDescribe()
{
return array(
array(new FooListener(), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::__invoke'),
array(array(new FooListener(), 'listen'), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'),
array(array('Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic'), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'),
array('var_dump', 'var_dump'),
array(function () {}, 'closure'),
array(\Closure::fromCallable(array(new FooListener(), 'listen')), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'),
array(\Closure::fromCallable(array('Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic')), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'),
array(\Closure::fromCallable(function () {}), 'closure'),
);
return [
[new FooListener(), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::__invoke'],
[[new FooListener(), 'listen'], 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'],
[['Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic'], 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'],
['var_dump', 'var_dump'],
[function () {}, 'closure'],
[\Closure::fromCallable([new FooListener(), 'listen']), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'],
[\Closure::fromCallable(['Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic']), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'],
[\Closure::fromCallable(function () {}), 'closure'],
];
}
}

View File

@@ -38,9 +38,9 @@ class RegisterListenersPassTest extends TestCase
public function testValidEventSubscriber()
{
$services = array(
'my_event_subscriber' => array(0 => array()),
);
$services = [
'my_event_subscriber' => [0 => []],
];
$builder = new ContainerBuilder();
$eventDispatcherDefinition = $builder->register('event_dispatcher');
@@ -50,16 +50,16 @@ class RegisterListenersPassTest extends TestCase
$registerListenersPass = new RegisterListenersPass();
$registerListenersPass->process($builder);
$expectedCalls = array(
array(
$expectedCalls = [
[
'addListener',
array(
[
'event',
array(new ServiceClosureArgument(new Reference('my_event_subscriber')), 'onEvent'),
[new ServiceClosureArgument(new Reference('my_event_subscriber')), 'onEvent'],
0,
),
),
);
],
],
];
$this->assertEquals($expectedCalls, $eventDispatcherDefinition->getMethodCalls());
}
@@ -70,7 +70,7 @@ class RegisterListenersPassTest extends TestCase
public function testAbstractEventListener()
{
$container = new ContainerBuilder();
$container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_listener', array());
$container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_listener', []);
$container->register('event_dispatcher', 'stdClass');
$registerListenersPass = new RegisterListenersPass();
@@ -84,7 +84,7 @@ class RegisterListenersPassTest extends TestCase
public function testAbstractEventSubscriber()
{
$container = new ContainerBuilder();
$container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_subscriber', array());
$container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_subscriber', []);
$container->register('event_dispatcher', 'stdClass');
$registerListenersPass = new RegisterListenersPass();
@@ -96,23 +96,23 @@ class RegisterListenersPassTest extends TestCase
$container = new ContainerBuilder();
$container->setParameter('subscriber.class', 'Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService');
$container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', array());
$container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', []);
$container->register('event_dispatcher', 'stdClass');
$registerListenersPass = new RegisterListenersPass();
$registerListenersPass->process($container);
$definition = $container->getDefinition('event_dispatcher');
$expectedCalls = array(
array(
$expectedCalls = [
[
'addListener',
array(
[
'event',
array(new ServiceClosureArgument(new Reference('foo')), 'onEvent'),
[new ServiceClosureArgument(new Reference('foo')), 'onEvent'],
0,
),
),
);
],
],
];
$this->assertEquals($expectedCalls, $definition->getMethodCalls());
}
@@ -120,10 +120,10 @@ class RegisterListenersPassTest extends TestCase
{
$container = new ContainerBuilder();
$container->register('foo', SubscriberService::class)->addTag('kernel.event_subscriber', array());
$container->register('foo', SubscriberService::class)->addTag('kernel.event_subscriber', []);
$container->register('event_dispatcher', 'stdClass');
(new RegisterListenersPass())->setHotPathEvents(array('event'))->process($container);
(new RegisterListenersPass())->setHotPathEvents(['event'])->process($container);
$this->assertTrue($container->getDefinition('foo')->hasTag('container.hot_path'));
}
@@ -135,7 +135,7 @@ class RegisterListenersPassTest extends TestCase
public function testEventSubscriberUnresolvableClassName()
{
$container = new ContainerBuilder();
$container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', array());
$container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', []);
$container->register('event_dispatcher', 'stdClass');
$registerListenersPass = new RegisterListenersPass();
@@ -145,41 +145,41 @@ class RegisterListenersPassTest extends TestCase
public function testInvokableEventListener()
{
$container = new ContainerBuilder();
$container->register('foo', \stdClass::class)->addTag('kernel.event_listener', array('event' => 'foo.bar'));
$container->register('bar', InvokableListenerService::class)->addTag('kernel.event_listener', array('event' => 'foo.bar'));
$container->register('baz', InvokableListenerService::class)->addTag('kernel.event_listener', array('event' => 'event'));
$container->register('foo', \stdClass::class)->addTag('kernel.event_listener', ['event' => 'foo.bar']);
$container->register('bar', InvokableListenerService::class)->addTag('kernel.event_listener', ['event' => 'foo.bar']);
$container->register('baz', InvokableListenerService::class)->addTag('kernel.event_listener', ['event' => 'event']);
$container->register('event_dispatcher', \stdClass::class);
$registerListenersPass = new RegisterListenersPass();
$registerListenersPass->process($container);
$definition = $container->getDefinition('event_dispatcher');
$expectedCalls = array(
array(
$expectedCalls = [
[
'addListener',
array(
[
'foo.bar',
array(new ServiceClosureArgument(new Reference('foo')), 'onFooBar'),
[new ServiceClosureArgument(new Reference('foo')), 'onFooBar'],
0,
),
),
array(
],
],
[
'addListener',
array(
[
'foo.bar',
array(new ServiceClosureArgument(new Reference('bar')), '__invoke'),
[new ServiceClosureArgument(new Reference('bar')), '__invoke'],
0,
),
),
array(
],
],
[
'addListener',
array(
[
'event',
array(new ServiceClosureArgument(new Reference('baz')), 'onEvent'),
[new ServiceClosureArgument(new Reference('baz')), 'onEvent'],
0,
),
),
);
],
],
];
$this->assertEquals($expectedCalls, $definition->getMethodCalls());
}
}
@@ -188,9 +188,9 @@ class SubscriberService implements \Symfony\Component\EventDispatcher\EventSubsc
{
public static function getSubscribedEvents()
{
return array(
return [
'event' => 'onEvent',
);
];
}
}

View File

@@ -32,7 +32,7 @@ class GenericEventTest extends TestCase
protected function setUp()
{
$this->subject = new \stdClass();
$this->event = new GenericEvent($this->subject, array('name' => 'Event'));
$this->event = new GenericEvent($this->subject, ['name' => 'Event']);
}
/**
@@ -46,7 +46,7 @@ class GenericEventTest extends TestCase
public function testConstruct()
{
$this->assertEquals($this->event, new GenericEvent($this->subject, array('name' => 'Event')));
$this->assertEquals($this->event, new GenericEvent($this->subject, ['name' => 'Event']));
}
/**
@@ -55,20 +55,20 @@ class GenericEventTest extends TestCase
public function testGetArguments()
{
// test getting all
$this->assertSame(array('name' => 'Event'), $this->event->getArguments());
$this->assertSame(['name' => 'Event'], $this->event->getArguments());
}
public function testSetArguments()
{
$result = $this->event->setArguments(array('foo' => 'bar'));
$this->assertAttributeSame(array('foo' => 'bar'), 'arguments', $this->event);
$result = $this->event->setArguments(['foo' => 'bar']);
$this->assertAttributeSame(['foo' => 'bar'], 'arguments', $this->event);
$this->assertSame($this->event, $result);
}
public function testSetArgument()
{
$result = $this->event->setArgument('foo2', 'bar2');
$this->assertAttributeSame(array('name' => 'Event', 'foo2' => 'bar2'), 'arguments', $this->event);
$this->assertAttributeSame(['name' => 'Event', 'foo2' => 'bar2'], 'arguments', $this->event);
$this->assertEquals($this->event, $result);
}
@@ -99,13 +99,13 @@ class GenericEventTest extends TestCase
public function testOffsetSet()
{
$this->event['foo2'] = 'bar2';
$this->assertAttributeSame(array('name' => 'Event', 'foo2' => 'bar2'), 'arguments', $this->event);
$this->assertAttributeSame(['name' => 'Event', 'foo2' => 'bar2'], 'arguments', $this->event);
}
public function testOffsetUnset()
{
unset($this->event['name']);
$this->assertAttributeSame(array(), 'arguments', $this->event);
$this->assertAttributeSame([], 'arguments', $this->event);
}
public function testOffsetIsset()
@@ -127,10 +127,10 @@ class GenericEventTest extends TestCase
public function testHasIterator()
{
$data = array();
$data = [];
foreach ($this->event as $key => $value) {
$data[$key] = $value;
}
$this->assertEquals(array('name' => 'Event'), $data);
$this->assertEquals(['name' => 'Event'], $data);
}
}