/** * Builds a new minifine instance * * @param string $basePath The base path to the resources (under most common cases this will be the public web * root directory) * @param bool $production The current environment * * @return \Minifine\Minifine */ public function build($basePath, $production = false) { $minifine = new Minifine($basePath, $production); $minifine->appendJsMinifier(new MatthiasMullieJs(new JS())); $minifine->appendCssMinifier(new MatthiasMullieCss(new Css())); return $minifine; }
/** * @covers Minifine\Minifine::__construct * @covers Minifine\Minifine::appendJsMinifier * @covers Minifine\Minifine::append * @covers Minifine\Minifine::prependJsMinifier * @covers Minifine\Minifine::prepend * @covers Minifine\Minifine::css * @covers Minifine\Minifine::minify * @covers Minifine\Minifine::merge */ public function testJsDevelopmentPrependedMinifier() { $minifierMock = $this->getMock('Minifine\\Minifier\\Minifier'); $minifierMock->expects($this->once())->method('minify')->willReturn('minifiedcontent'); $prependedMock = $this->getMock('Minifine\\Minifier\\Minifier'); $prependedMock->expects($this->once())->method('minify')->willReturn('prependedcontent'); $minifier = new Minifine(TEST_DATA_DIR); $minifier->appendJsMinifier($minifierMock); $minifier->prependJsMinifier($prependedMock); $minifier->js(['/js/bootstrap.min.js', '/js/jquery.min.js', '/js/main.js'], '/js/test.js'); $this->assertSame('minifiedcontent', file_get_contents(TEST_DATA_DIR . '/js/test.js')); }