예제 #1
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->assetsHelperMock = $this->getMockBuilder('Symfony\\Component\\Templating\\Helper\\CoreAssetsHelper')->disableOriginalConstructor()->getMock();
     $this->assetsHelperMock->expects($this->any())->method('getUrl')->will($this->returnArgument(0));
     $this->assetsVersionTrimerHelperMock = $this->getMock('Ivory\\CKEditorBundle\\Helper\\AssetsVersionTrimerHelper');
     $this->assetsVersionTrimerHelperMock->expects($this->any())->method('trim')->will($this->returnArgument(0));
     $this->routerMock = $this->getMock('Symfony\\Component\\Routing\\RouterInterface');
     $this->containerMock = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $this->containerMock->expects($this->any())->method('get')->will($this->returnValueMap(array(array('templating.helper.assets', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->assetsHelperMock), array('ivory_ck_editor.helper.assets_version_trimer', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->assetsVersionTrimerHelperMock), array('router', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->routerMock))));
 }
 public function testTrimAssetVersionWithoutVersion()
 {
     $this->assertSame('/bar', $this->assetsVersionTrimerHelper->trim('/bar'));
 }
예제 #3
0
 public function testRenderTemplate()
 {
     $this->assetsHelperMock->expects($this->once())->method('getUrl')->with($this->equalTo('foo'), $this->equalTo(null))->will($this->returnValue('bar'));
     $this->assetsVersionTrimerHelperMock->expects($this->once())->method('trim')->with($this->equalTo('bar'))->will($this->returnValue('baz'));
     $this->assertSame('CKEDITOR.addTemplates("foo", {"imagesPath":"baz","filename":"bat"});', $this->helper->renderTemplate('foo', array('imagesPath' => 'foo', 'filename' => 'bat')));
 }