Example #1
0
 /**
  * @depends test_construct
  * @covers ::optimize
  */
 public function test_optimize()
 {
     // Valid arguments
     foreach ($this->generateOptimizations() as $Arguments) {
         list($Input, $Expected) = $Arguments;
         $Actual = strlen(file_get_contents($Input));
         $Optimized = $this->Compiler->optimize($Input);
         $this->assertNotEmpty($Optimized, 'Compiler::optimize() Returned an emtpy string');
         $this->assertLessThan($Expected, (double) strlen($Optimized) / $Actual, 'Compiler::optimmize() Failed to optimize file: ' . $Input);
     }
     // Invalid arguments
     try {
         $this->Compiler->optimize(NULL);
         $this->fail('Failed generating exception with invalid arguments');
     } catch (FileException $e) {
     }
     // Unoptimmizable file
     $this->Compiler->optimize(BLW_DIR . DIRECTORY_SEPARATOR . 'LICENSE.md');
 }