minifier = new Minify\JS(); } /** * Cleans up the environment after running a test. */ protected function tearDown() { $this->minifier = null; parent::tearDown(); } /** * Test JS minifier rules, provided by dataProvider * * @test * @dataProvider dataProvider */ public function minify($input, $expected, $options) { $this->minifier->add($input); $result = $this->minifier->minify(false, $options); $this->assertEquals($result, $expected); } /** * Test cases [input, expected result, options] * * @return array */ public function dataProvider() { $tests = array(); $tests[] = array( '/* This is a JS comment */', '', Minify\JS::STRIP_COMMENTS ); $tests[] = array( 'alert ( "this is a test" );', 'alert("this is a test");', Minify\JS::STRIP_WHITESPACE ); return $tests; } }