예제 #1
0
 public function testDatabaseEmptyArrayCreation()
 {
     $factory = new RunFactory();
     $run = $factory->fromDatabaseArray([]);
     $this->assertNull($run->getRunId());
     $this->assertNull($run->getTsAccessed());
     $this->assertNull($run->getTsCreated());
 }
예제 #2
0
 /**
  * Fetches a run object from the database.
  *
  * @param   string  $runId
  *
  * @return  Run
  */
 public function retrieve($runId)
 {
     $conn = $this->database->getConnection();
     $stmt = $conn->prepare('SELECT run_id, ts_created, ts_accessed' . ' FROM runs' . ' WHERE run_id = :run_id');
     $stmt->bindValue(':run_id', $runId);
     $stmt->execute();
     $result = $stmt->fetch(\PDO::FETCH_ASSOC);
     if (false === $result) {
         return null;
     }
     return $this->runFactory->fromDatabaseArray($result);
 }