Skip to content

Commit

Permalink
fix in anonymous function in php 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
suncat2000 committed Nov 26, 2012
1 parent 44f134b commit 5080aeb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Tests/EventListener/RequestListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public function setUp()
{
parent::setUp();

$test = $this;

$this->mobileDetector = $this->getMockBuilder('SunCat\MobileDetectBundle\DeviceDetector\MobileDetector')->disableOriginalConstructor()->getMock();
$this->deviceView = $this->getMockBuilder('SunCat\MobileDetectBundle\Helper\DeviceView')->disableOriginalConstructor()->getMock();
$this->router = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Routing\Router')->disableOriginalConstructor()->getMock();
Expand All @@ -75,8 +77,8 @@ public function setUp()
$this->equalTo('router')
))
->will($this->returnCallback(
function($param) {
return $this->serviceContainerReturnsRequestedMockClass($param);
function ($param) use ($test) {
return $test->serviceContainerReturnsRequestedMockClass($param);
}
));
}
Expand All @@ -85,7 +87,7 @@ function($param) {
* @param $param
* @return PHPUnit_Framework_MockObject_MockBuilder
*/
private function serviceContainerReturnsRequestedMockClass($param)
public function serviceContainerReturnsRequestedMockClass($param)
{
switch($param) {
case 'mobile_detect.mobile_detector':
Expand Down

0 comments on commit 5080aeb

Please sign in to comment.