Пример #1
0
 /**
  * @covers \Magento\PageCache\Block\Javascript::getScriptOptions
  * @param bool $isSecure
  * @param string $url
  * @param string $expectedResult
  * @dataProvider getScriptOptionsDataProvider
  */
 public function testGetScriptOptions($isSecure, $url, $expectedResult)
 {
     $handles = ['some', 'handles', 'here'];
     $this->requestMock->expects($this->once())->method('isSecure')->willReturn($isSecure);
     $this->urlBuilderMock->expects($this->once())->method('getUrl')->willReturn($url);
     $this->layoutUpdateMock->expects($this->once())->method('getHandles')->willReturn($handles);
     $this->assertRegExp($expectedResult, $this->blockJavascript->getScriptOptions());
 }
Пример #2
0
 /**
  * @covers \Magento\PageCache\Block\Javascript::getScriptOptions
  * @param string $url
  * @param string $route
  * @param string $controller
  * @param string $action
  * @param string $expectedResult
  * @dataProvider getScriptOptionsPrivateContentDataProvider
  */
 public function testGetScriptOptionsPrivateContent($url, $route, $controller, $action, $expectedResult)
 {
     $handles = ['some', 'handles', 'here'];
     $this->requestMock->expects($this->once())->method('isSecure')->willReturn(false);
     $this->requestMock->expects($this->once())->method('getRouteName')->will($this->returnValue($route));
     $this->requestMock->expects($this->once())->method('getControllerName')->will($this->returnValue($controller));
     $this->requestMock->expects($this->once())->method('getActionName')->will($this->returnValue($action));
     $this->urlBuilderMock->expects($this->once())->method('getUrl')->willReturn($url);
     $this->layoutUpdateMock->expects($this->once())->method('getHandles')->willReturn($handles);
     $this->assertRegExp($expectedResult, $this->blockJavascript->getScriptOptions());
 }
 public function testGetScriptOptions()
 {
     $this->request->getQuery()->set('getparameter', 1);
     $this->assertContains('?getparameter=1', $this->javascript->getScriptOptions());
 }