Skip to content

Commit

Permalink
merged 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Apr 20, 2012
2 parents 0aea3d9 + 211ae4e commit 507c8b7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Debug/ContainerAwareTraceableEventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ private function getListenerInfo($listener, $eventName)
if (!is_array($listener)) {
$listener = array($listener, '__invoke');
}
$class = get_class($listener[0]);
$class = is_object($listener[0]) ? get_class($listener[0]) : $listener[0];
try {
$r = new \ReflectionMethod($class, $listener[1]);
$file = $r->getFileName();
Expand Down
2 changes: 1 addition & 1 deletion HttpCache/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function lookup(Request $request)
// find a cached entry that matches the request.
$match = null;
foreach ($entries as $entry) {
if ($this->requestsMatch(isset($entry[1]['vary']) ? $entry[1]['vary'][0] : '', $request->headers->all(), $entry[0])) {
if ($this->requestsMatch(isset($entry[1]['vary'][0]) ? $entry[1]['vary'][0] : '', $request->headers->all(), $entry[0])) {
$match = $entry;

break;
Expand Down
22 changes: 22 additions & 0 deletions Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,26 @@ public function testClosureDoesNotTriggerErrorNotice()

$this->assertTrue($triggered, 'Closure should have been executed upon dispatch');
}

public function testStaticCallable()
{
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$dispatcher = new ContainerAwareTraceableEventDispatcher($container, new StopWatch());

$dispatcher->addListener('onFooEvent', array(__NAMESPACE__.'\StaticClassFixture', 'staticListener'));

$dispatcher->dispatch('onFooEvent');

$this->assertTrue(StaticClassFixture::$called);
}
}

class StaticClassFixture
{
static public $called = false;

static public function staticListener($event)
{
self::$called = true;
}
}

0 comments on commit 507c8b7

Please sign in to comment.