Пример #1
0
 public function testGetSkinFile()
 {
     $params = array('area' => 'some_area', 'package' => 'some_package', 'theme' => 'some_theme', 'skin' => 'some_skin', 'locale' => 'some_locale');
     $file = 'Some_Module::some_file.ext';
     $expectedParams = $params + array('module' => 'Some_Module');
     $expected = 'path/to/some_file.ext';
     $this->_model->expects($this->once())->method('_getFallback')->with($expectedParams)->will($this->returnValue($this->_fallback));
     $this->_fallback->expects($this->once())->method('getSkinFile')->with('some_file.ext', 'Some_Module')->will($this->returnValue($expected));
     $actual = $this->_model->getSkinFile($file, $params);
     $this->assertEquals($expected, $actual);
 }
Пример #2
0
 /**
  * Test that proxy caches published skin path, and further calls do not use fallback model
  */
 public function testNotifySkinFilePublished()
 {
     $module = 'Some_Module';
     $file = $this->_baseDir . DIRECTORY_SEPARATOR . 'path' . DIRECTORY_SEPARATOR . 'file.ext';
     $this->_fallback->expects($this->once())->method('getSkinFile')->with($file, $module)->will($this->returnValue(null));
     // Empty at first
     $this->assertNull($this->_model->getSkinFile($file, $module));
     // Store something
     $publicFilePath = $this->_baseDir . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'file.ext';
     $result = $this->_model->notifySkinFilePublished($publicFilePath, $file, $module);
     $this->assertSame($this->_model, $result);
     // Stored successfully
     $storedFilePath = $this->_model->getSkinFile($file, $module);
     $this->assertEquals($publicFilePath, $storedFilePath);
 }