/** * @depends test_construct * @covers ::addFile */ public function test_addFile() { $getFiles = function ($Compiler) { $Property = new ReflectionProperty($Compiler, '_Files'); $Property->setAccessible(true); return $Property->getValue($Compiler); }; // Valid arguments $this->Compiler->addFile(new GenericFile(__FILE__)); $Files = $getFiles($this->Compiler); $this->assertCount(1, $Files, 'Compiler::addFile() Failed to update $_Files'); $this->assertInstanceOf('\\BLW\\Type\\IFile', $Files[0], 'Compiler::addFile() Has corrupted $_Files'); $this->assertEquals(__FILE__, strval($Files[0]), 'Compiler::addFile() Failed to add file to $_Files'); // Invalid Arguments try { $this->Compiler->addFile(new GenericFile(__DIR__)); $this->fail('Failed generating exception with invalid arguments'); } catch (FileException $e) { } }
} $Output->write("\r\n"); // ##################### // COMPILE APPLICATION // ##################### $Print('Compiling application...'); @unlink(BLW_DIR . 'build' . DIRECTORY_SEPARATOR . 'BLW.phar'); @unlink(BLW_DIR . 'build' . DIRECTORY_SEPARATOR . 'BLW.tar.gz'); $Output->write("-Collecting files\r\n"); $Output->write('[--------------------------------------------------]'); // Create PHAR $Compiler = new Compiler(new GenericFile(BLW_DIR . 'build'), new GenericFile(BLW_DIR), new GenericFile(BLW_DIR . 'temp'), $Command->getMediator()); // Collect files $Compiler->addDir(new GenericFile(BLW_DIR . 'src'), 'php*', 'js', 'css'); $Compiler->addDir(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/composer')), 'php'); $Compiler->addFile(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/autoload.php'))); $Compiler->addDir(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/jeremeamia/SuperClosure/src')), 'php'); $Compiler->addFile(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/jeremeamia/SuperClosure/LICENSE.md'))); $Compiler->addDir(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/monolog/monolog/src/Monolog')), 'php'); $Compiler->addFile(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/monolog/monolog/LICENSE'))); $Compiler->addDir(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/mrclay/minify/min/lib')), 'php'); $Compiler->addFile(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/mrclay/minify/LICENSE.txt'))); $Compiler->addDir(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/nikic/php-parser/lib')), 'php'); $Compiler->addFile(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/nikic/php-parser/LICENSE'))); $Compiler->addDir(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/nikic/php-parser/lib')), 'php'); $Compiler->addFile(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/nikic/php-parser/LICENSE'))); $Compiler->addDir(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/psr/log/Psr')), 'php'); $Compiler->addFile(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/psr/log/LICENSE'))); $Compiler->addDir(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/symfony')), 'php'); $Compiler->addFile(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/symfony/yaml/Symfony/Component/Yaml/LICENSE'))); $Compiler->addFile(new GenericFile(BLW_DIR . str_replace('/', DIRECTORY_SEPARATOR, 'vendor/symfony/css-selector/Symfony/Component/CssSelector/LICENSE')));