コード例 #1
0
 public function testComplexFormula()
 {
     $factory = new AssetFactory(__DIR__ . '/templates', true);
     $loader = new FunctionCallsFormulaLoader($factory);
     $resource = new FileResource(__DIR__ . '/templates/debug.php');
     $formulae = $loader->load($resource);
     $this->assertEquals(array('test123' => array(array('foo.css', 'bar.css'), array('?foo', 'bar'), array('name' => 'test123', 'output' => 'css/packed.css', 'debug' => true))), $formulae);
 }
コード例 #2
0
    /**
     * @dataProvider getInputs
     */
    public function testInput($inputs, $name, $expected)
    {
        $resource = $this->getMock('Assetic\\Factory\\Resource\\ResourceInterface');
        $factory = $this->getMockBuilder('Assetic\\Factory\\AssetFactory')
            ->disableOriginalConstructor()
            ->getMock();

        $resource->expects($this->once())
            ->method('getContent')
            ->will($this->returnValue('<?php assetic_assets('.$inputs.') ?>'));
        $factory->expects($this->once())
            ->method('generateAssetName')
            ->will($this->returnValue($name));

        $loader = new FunctionCallsFormulaLoader($factory, array(
            'assetic_assets(*)'      => array(),
            'assetic_javascripts(*)' => array('output' => 'js/*.js'),
            'assetic_stylesheets(*)' => array('output' => 'css/*.css'),
        ));
        $formulae = $loader->load($resource);

        $this->assertEquals($expected, $formulae);
    }