Ejemplo n.º 1
0
 /**
  * @coversNothing
  */
 public function test_doRun()
 {
     // Only Windows
     if (DIRECTORY_SEPARATOR != '\\') {
         return true;
     }
     $Expected = 'foo';
     $this->assertEquals(0, $this->Command->run($this->Input, $this->Output), 'ShellCommand::run() returned an invalid result');
     $this->assertEquals($Expected, $this->Output->stdOut->getContents(), 'ShellCommand::doRun() Failed to process command output');
     $this->assertEmpty($this->Output->stdErr->getContents(), 'ShellCommand::doRun() Failed to process command error');
 }
Ejemplo n.º 2
0
         } elseif ($path->isFile()) {
             if (!is_dir($Dir = str_replace($Src, $Dest, $path->getPath()))) {
                 mkdir($Dir);
             }
             copy($path->getPathname(), str_replace($Src, $Dest, $path->getPathname()));
         }
     }
 };
 // #####################
 // RUN COMPOSER
 // #####################
 $Print('Running Composer...');
 $ShellInput = new Input(new Handle(fopen('data:text/plain,', 'r')));
 $Composer = new ShellCommand('composer dumpautoload -o', new Config(array('Timeout' => 60, 'CWD' => dirname(__DIR__), 'Environment' => null, 'Extras' => array())), $Command->getMediator(), $Command->getMediatorID());
 // Check results
 if ($code = $Composer->run($ShellInput, $Output)) {
     return $code;
 }
 $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');
Ejemplo n.º 3
0
Application::run(function (BLW\Type\Command\IInput $Input, BLW\Type\Command\IOutput $Output, BLW\Type\Command\ICommand $Command) {
    $Print = function ($Message) use(&$Output, &$Command) {
        $Output->write("{$Message}\r\n");
        $Command->Config['Logger']->debug($Message);
    };
    // #####################
    // TEST LIBRARY
    // #####################
    $Print('Testing BLW Library...');
    // Run framework tests
    $ShellInput = new Input(new Handle(fopen('data:text/plain,', 'r')));
    $ShellInput->Options[] = new Option('testsuite', 'Types');
    $ShellInput->Options[] = new Option('coverage-php', 'temp/coverage-types.serialized');
    $PHPUnit = new ShellCommand('phpunit', new Config(array('Timeout' => 60, 'CWD' => dirname(__DIR__), 'Environment' => null, 'Extras' => array())), $Command->getMediator(), $Command->getMediatorID());
    // Check results
    if ($code = $PHPUnit->run($ShellInput, $Output)) {
        return $code;
    }
    // Run library tests
    $ShellInput = new Input(new Handle(fopen('data:text/plain,', 'r')));
    $ShellInput->Options[] = new Option('testsuite', 'Models');
    $ShellInput->Options[] = new Option('coverage-php', 'temp/coverage-models.serialized');
    $PHPUnit->run($ShellInput, $Output);
    // Merge coverage files
    // ...
    $Print('Finished testing.');
    // Done
    return 0;
});
// @codeCoverageIgnoreStart
return true;