public function testOutput() { $commit = new Commit(new Project('Twig'), '7d78d5f7a8c039059046d6c5e1d7f66765bd91c7'); $commit->setOutput('foo'); $this->assertEquals('foo', $commit->getOutput()); $commit->setOutput("[1mfoo[0m"); $this->assertEquals('<strong>foo</strong>', $commit->getDecoratedOutput()); }
public function updateCommit(Commit $commit) { $stmt = $this->db->prepare('UPDATE `commit` SET status = :status, output = :output, build_date = CURRENT_TIMESTAMP WHERE slug = :slug AND sha = :sha'); $stmt->bindValue(':slug', $commit->getProject()->getSlug(), SQLITE3_TEXT); $stmt->bindValue(':sha', $commit->getSha(), SQLITE3_TEXT); $stmt->bindValue(':status', $commit->getStatusCode(), SQLITE3_TEXT); $stmt->bindValue(':output', $commit->getOutput(), SQLITE3_TEXT); if (false === $stmt->execute()) { throw new \RuntimeException(sprintf('Unable to save build "%s@%s".', $commit->getProject()->getName(), $commit->getSha())); } }
protected function getPlaceholders(Commit $commit) { $project = $commit->getProject(); return array('%slug%' => $project->getSlug(), '%name%' => $project->getName(), '%status%' => $commit->getStatus(), '%status_code%' => $commit->getStatusCode(), '%STATUS%' => strtoupper($commit->getStatus()), '%sha%' => $commit->getSha(), '%short_sha%' => $commit->getShortSha(), '%author%' => $commit->getAuthor(), '%message%' => $commit->getMessage(), '%output%' => $commit->getOutput()); }
/** * Update the commits information. * * The commit is identified by its sha hash. * * @param Commit $commit * * @return StorageInterface $this */ public function updateCommit(Commit $commit) { $stmt = $this->db->prepare('UPDATE `commit` SET status = :status, output = :output, build_date = :current_date WHERE slug = :slug AND sha = :sha'); $stmt->bindValue(':slug', $commit->getProject()->getSlug(), \PDO::PARAM_STR); $stmt->bindValue(':sha', $commit->getSha(), \PDO::PARAM_STR); $stmt->bindValue(':status', $commit->getStatusCode(), \PDO::PARAM_STR); $stmt->bindValue(':output', $commit->getOutput(), \PDO::PARAM_STR); $stmt->bindValue(':current_date', date('Y-m-d H:i:s'), \PDO::PARAM_STR); if (false === $stmt->execute()) { // @codeCoverageIgnoreStart throw new \RuntimeException(sprintf('Unable to save build "%s@%s".', $commit->getProject()->getName(), $commit->getSha())); // @codeCoverageIgnoreEnd } }
public function testOutput() { $commit = new Commit(new Project('Twig'), '7d78d5f7a8c039059046d6c5e1d7f66765bd91c7'); $commit->setOutput('foo'); $this->assertEquals('foo', $commit->getOutput()); }