update2
This commit is contained in:
parent
98419bd18d
commit
8a69e45efa
4919 changed files with 28311 additions and 224136 deletions
2
pfosten/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php
vendored
Executable file → Normal file
|
|
@ -158,7 +158,7 @@ abstract class AbstractEventDispatcherTest extends TestCase
|
|||
// 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, 'preFoo'));
|
||||
$this->dispatcher->addListener('post.foo', array($otherListener, 'postFoo'));
|
||||
$this->dispatcher->dispatch(self::postFoo);
|
||||
$this->assertTrue($this->listener->postFooInvoked);
|
||||
$this->assertFalse($otherListener->postFooInvoked);
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php
vendored
Executable file → Normal file
|
|
@ -143,7 +143,7 @@ class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
|
|||
|
||||
$listeners = $dispatcher->getListeners();
|
||||
|
||||
$this->assertTrue(isset($listeners['onEvent']));
|
||||
$this->assertArrayHasKey('onEvent', $listeners);
|
||||
|
||||
$this->assertCount(1, $dispatcher->getListeners('onEvent'));
|
||||
}
|
||||
|
|
|
|||
19
pfosten/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php
vendored
Executable file → Normal file
19
pfosten/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php
vendored
Executable file → Normal file
|
|
@ -13,10 +13,10 @@ namespace Symfony\Component\EventDispatcher\Tests\Debug;
|
|||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\Stopwatch\Stopwatch;
|
||||
|
||||
class TraceableEventDispatcherTest extends TestCase
|
||||
|
|
@ -124,6 +124,21 @@ class TraceableEventDispatcherTest extends TestCase
|
|||
$this->assertEquals(array(), $tdispatcher->getNotCalledListeners());
|
||||
}
|
||||
|
||||
public function testClearCalledListeners()
|
||||
{
|
||||
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
|
||||
$tdispatcher->addListener('foo', function () {}, 5);
|
||||
|
||||
$tdispatcher->dispatch('foo');
|
||||
$tdispatcher->reset();
|
||||
|
||||
$listeners = $tdispatcher->getNotCalledListeners();
|
||||
$this->assertArrayHasKey('stub', $listeners['foo.closure']);
|
||||
unset($listeners['foo.closure']['stub']);
|
||||
$this->assertEquals(array(), $tdispatcher->getCalledListeners());
|
||||
$this->assertEquals(array('foo.closure' => array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners);
|
||||
}
|
||||
|
||||
public function testGetCalledListenersNested()
|
||||
{
|
||||
$tdispatcher = null;
|
||||
|
|
|
|||
77
pfosten/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
vendored
Executable file → Normal file
77
pfosten/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
vendored
Executable file → Normal file
|
|
@ -27,29 +27,10 @@ class RegisterListenersPassTest extends TestCase
|
|||
*/
|
||||
public function testEventSubscriberWithoutInterface()
|
||||
{
|
||||
// one service, not implementing any interface
|
||||
$services = array(
|
||||
'my_event_subscriber' => array(0 => array()),
|
||||
);
|
||||
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$definition->expects($this->atLeastOnce())
|
||||
->method('getClass')
|
||||
->will($this->returnValue('stdClass'));
|
||||
|
||||
$builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition'))->getMock();
|
||||
$builder->expects($this->any())
|
||||
->method('hasDefinition')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
// We don't test kernel.event_listener here
|
||||
$builder->expects($this->atLeastOnce())
|
||||
->method('findTaggedServiceIds')
|
||||
->will($this->onConsecutiveCalls(array(), $services));
|
||||
|
||||
$builder->expects($this->atLeastOnce())
|
||||
->method('getDefinition')
|
||||
->will($this->returnValue($definition));
|
||||
$builder = new ContainerBuilder();
|
||||
$builder->register('event_dispatcher');
|
||||
$builder->register('my_event_subscriber', 'stdClass')
|
||||
->addTag('kernel.event_subscriber');
|
||||
|
||||
$registerListenersPass = new RegisterListenersPass();
|
||||
$registerListenersPass->process($builder);
|
||||
|
|
@ -61,31 +42,25 @@ class RegisterListenersPassTest extends TestCase
|
|||
'my_event_subscriber' => array(0 => array()),
|
||||
);
|
||||
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$definition->expects($this->atLeastOnce())
|
||||
->method('getClass')
|
||||
->will($this->returnValue('Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService'));
|
||||
|
||||
$builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition', 'findDefinition'))->getMock();
|
||||
$builder->expects($this->any())
|
||||
->method('hasDefinition')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
// We don't test kernel.event_listener here
|
||||
$builder->expects($this->atLeastOnce())
|
||||
->method('findTaggedServiceIds')
|
||||
->will($this->onConsecutiveCalls(array(), $services));
|
||||
|
||||
$builder->expects($this->atLeastOnce())
|
||||
->method('getDefinition')
|
||||
->will($this->returnValue($definition));
|
||||
|
||||
$builder->expects($this->atLeastOnce())
|
||||
->method('findDefinition')
|
||||
->will($this->returnValue($definition));
|
||||
$builder = new ContainerBuilder();
|
||||
$eventDispatcherDefinition = $builder->register('event_dispatcher');
|
||||
$builder->register('my_event_subscriber', 'Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService')
|
||||
->addTag('kernel.event_subscriber');
|
||||
|
||||
$registerListenersPass = new RegisterListenersPass();
|
||||
$registerListenersPass->process($builder);
|
||||
|
||||
$expectedCalls = array(
|
||||
array(
|
||||
'addListener',
|
||||
array(
|
||||
'event',
|
||||
array(new ServiceClosureArgument(new Reference('my_event_subscriber')), 'onEvent'),
|
||||
0,
|
||||
),
|
||||
),
|
||||
);
|
||||
$this->assertEquals($expectedCalls, $eventDispatcherDefinition->getMethodCalls());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -141,6 +116,18 @@ class RegisterListenersPassTest extends TestCase
|
|||
$this->assertEquals($expectedCalls, $definition->getMethodCalls());
|
||||
}
|
||||
|
||||
public function testHotPathEvents()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
||||
$container->register('foo', SubscriberService::class)->addTag('kernel.event_subscriber', array());
|
||||
$container->register('event_dispatcher', 'stdClass');
|
||||
|
||||
(new RegisterListenersPass())->setHotPathEvents(array('event'))->process($container);
|
||||
|
||||
$this->assertTrue($container->getDefinition('foo')->hasTag('container.hot_path'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage You have requested a non-existent parameter "subscriber.class"
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/event-dispatcher/Tests/EventDispatcherTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/event-dispatcher/Tests/EventDispatcherTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/event-dispatcher/Tests/EventTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/event-dispatcher/Tests/EventTest.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php
vendored
Executable file → Normal file
|
|
@ -114,8 +114,8 @@ class GenericEventTest extends TestCase
|
|||
|
||||
public function testOffsetIsset()
|
||||
{
|
||||
$this->assertTrue(isset($this->event['name']));
|
||||
$this->assertFalse(isset($this->event['nameNotExist']));
|
||||
$this->assertArrayHasKey('name', $this->event);
|
||||
$this->assertArrayNotHasKey('nameNotExist', $this->event);
|
||||
}
|
||||
|
||||
public function testHasArgument()
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php
vendored
Executable file → Normal file
Loading…
Add table
Add a link
Reference in a new issue