HosipLan

Untitled

Dec 26th, 2011
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.12 KB | None | 0 0
  1. 1) Kdyby\Tests\Assets\Asset\FileAssetTest::testLoading
  2. Expectation failed for method name is equal to <string:load> when invoked 1 time(s).
  3. Parameter 0 for invocation Kdyby\Assets\IResourceLoader::load(Kdyby\Assets\Asset\FileAsset Object (...)) does not match expected value.
  4. Failed asserting that two objects are equal.
  5.  
  6. ### test
  7.  
  8.     public function testLoading()
  9.     {
  10.         $asset = new FileAsset($this->barAsset);
  11.         $this->assertEquals(NULL, $asset->getContent());
  12.  
  13.         $loader = $this->getMock('Kdyby\Assets\IResourceLoader', array('load'));
  14.         $loader->expects($this->once())
  15.             ->method('load')
  16.             ->with($this->equalTo($asset))
  17.             ->will($this->returnValue('content'));
  18.  
  19.         $this->assertTrue($asset->load($loader));
  20.         $this->assertEquals('content', $asset->getContent());
  21.     }
  22.  
  23.  
  24. ### trida
  25.  
  26.     /**
  27.      * @param \Kdyby\Assets\IResourceLoader $loader
  28.      * @return bool
  29.      */
  30.     public function load(Kdyby\Assets\IResourceLoader $loader)
  31.     {
  32.         if ($this->getContent() !== NULL) {
  33.             return TRUE;
  34.         }
  35.  
  36.         if (FALSE !== ($content = $loader->load($this))) {
  37.             $this->setContent($content);
  38.             return TRUE;
  39.         }
  40.  
  41.         return FALSE;
  42.     }
Advertisement
Add Comment
Please, Sign In to add comment