public function AssetWriterTest::testWriteManagerAssets

File

drupal/core/vendor/kriswallsmith/assetic/tests/Assetic/Test/AssetWriterTest.php, line 38

Class

AssetWriterTest

Namespace

Assetic\Test

Code

public function testWriteManagerAssets() {
  $asset = $this
    ->getMock('Assetic\\Asset\\AssetInterface');
  $am = $this
    ->getMock('Assetic\\AssetManager');
  $am
    ->expects($this
    ->once())
    ->method('getNames')
    ->will($this
    ->returnValue(array(
    'foo',
  )));
  $am
    ->expects($this
    ->once())
    ->method('get')
    ->with('foo')
    ->will($this
    ->returnValue($asset));
  $asset
    ->expects($this
    ->atLeastOnce())
    ->method('getTargetPath')
    ->will($this
    ->returnValue('target_url'));
  $asset
    ->expects($this
    ->once())
    ->method('dump')
    ->will($this
    ->returnValue('content'));
  $asset
    ->expects($this
    ->atLeastOnce())
    ->method('getVars')
    ->will($this
    ->returnValue(array()));
  $asset
    ->expects($this
    ->atLeastOnce())
    ->method('getValues')
    ->will($this
    ->returnValue(array()));
  $this->writer
    ->writeManagerAssets($am);
  $this
    ->assertFileExists($this->dir . '/target_url');
  $this
    ->assertEquals('content', file_get_contents($this->dir . '/target_url'));
}