Ejemplo n.º 1
0
 /**
  * @dataProvider requestsProvider
  */
 public function testLast64($request, $_1, $_2, $_3, $expected)
 {
     $requestStackMock = m::mock('Symfony\\Component\\HttpFoundation\\RequestStack');
     $requestStackMock->shouldReceive('getCurrentRequest')->andReturn($request);
     $this->containerMock->shouldReceive('has')->with('request_stack')->andReturn(true);
     $this->containerMock->shouldReceive('get')->with('request_stack')->andReturn($requestStackMock);
     $returnUrlHelper = new ReturnUrlHelper($this->containerMock);
     $value = $returnUrlHelper->last64();
     $this->assertEquals($expected, $value);
 }
 public function testGetGlobals()
 {
     $this->returnUrlHelperMock->shouldReceive('current')->andReturn('current_ru');
     $this->returnUrlHelperMock->shouldReceive('last')->andReturn('last_ru');
     $this->returnUrlHelperMock->shouldReceive('current64')->andReturn('current_ru64');
     $this->returnUrlHelperMock->shouldReceive('last64')->andReturn('last_ru64');
     $extension = new ReturnUrlExtension($this->returnUrlHelperMock);
     $globals = $extension->getGlobals();
     $this->assertEquals(4, sizeof($globals), "getGlobals must return 4 elements");
     $this->assertArrayHasKey('current_ru', $globals, "getGlobals must return current_ru");
     $this->assertEquals('current_ru', $globals['current_ru']);
     $this->assertArrayHasKey('last_ru', $globals, "getGlobals must return last_ru");
     $this->assertEquals('last_ru', $globals['last_ru']);
     $this->assertArrayHasKey('current_ru64', $globals, "getGlobals must return current_ru64");
     $this->assertEquals('current_ru64', $globals['current_ru64']);
     $this->assertArrayHasKey('last_ru64', $globals, "getGlobals must return last_ru64");
     $this->assertEquals('last_ru64', $globals['last_ru64']);
 }
Ejemplo n.º 3
0
 /**
  * @return array
  */
 public function getGlobals()
 {
     return array('current_ru' => $this->returnUrlHelper->current(), 'last_ru' => $this->returnUrlHelper->last(), 'current_ru64' => $this->returnUrlHelper->current64(), 'last_ru64' => $this->returnUrlHelper->last64());
 }