/** * @expectedException RuntimeException * @expectedExceptionMessage Callback MiniAsset\Test\Helpers\MyCallbackProvider::invalid() is not callable */ public function testCallbackProviderNotCallable() { $callbacksFile = APP . 'config' . DS . 'callbacks.ini'; $config = AssetConfig::buildFromIniFile($callbacksFile); $factory = new Factory($config); $target = $factory->target('callbacks_not_callable.js'); }
/** * Get an asset from the collection * * @param string $name The name of the asset you want. * @return null|AssetTarget Either null or the asset target. */ public function get($name) { if (!isset($this->indexed[$name])) { return null; } if (empty($this->indexed[$name])) { $this->indexed[$name] = $this->factory->target($name); } return $this->indexed[$name]; }
public function testTargetWithRequireIntegration() { $requireFile = APP . 'config' . DS . 'require.ini'; $config = AssetConfig::buildFromIniFile($requireFile); $factory = new Factory($config); $target = $factory->target('second.js'); $files = $target->files(); // Check the top level target $this->assertCount(2, $files); $middle = $files[0]; $this->assertInstanceOf('MiniAsset\\File\\Target', $middle); $this->assertEquals('middle.js', $middle->name()); $contents = $middle->contents(); $this->assertContains('var BaseClass', $contents, 'No baseclass, sprockets not applied'); $this->assertContains('var Template', $contents); $this->assertContains('//= require "local_script"', $contents, 'Sprockets should not be applied to intermediate build files'); }