/** * Asserts the execution of a command. * @since 1.0 * * @param string $command Command to execute. * @param string $print Last print message to compare to. * @param string $message PHPUNIT message. * * @throws PHPUnit_Framework_AssertionFailedError */ public function assertCommand($command, $print = '', $message = 'Failed asseting command result.') { $execution = exec('php ' . $this->builder->build() . ' ' . $command); $this->builder->clear(); //$this->builder->log($execution); self::assertThat($execution == $print, self::isTrue(), $message); }
/** * Generates custom temporal build. * @since 1.0 * @param string $command Command class. * @param string $args Arguments. */ public function build() { if (!is_dir($this->path)) { mkdir($this->path, 0777, true); } $id = uniqid() . '.php'; $file = fopen($this->path . $id, 'w'); fwrite($file, $this->header . $this->content . $this->footer); fclose($file); self::$lastBuilt = $this->path . $id; return self::$lastBuilt; }