示例#1
0
 public function testPersistAfterExecution()
 {
     $runId = __CLASS__ . '::' . __METHOD__;
     $request = $this->mockRequest($runId);
     $runRepository = new RunRepository();
     $pipeline = new Pipeline();
     $response = $pipeline->execute($request);
     $run = $runRepository->retrieve($response->getRunId());
     $this->assertNotEquals($runId, $run->getRunId());
     $this->assertEquals($run->getTsAccessed(), $run->getTsCreated());
 }
示例#2
0
 public function testPersistUpdatedRun()
 {
     $repository = new RunRepository();
     $run = $repository->retrieve(self::$testRunIdUpdate);
     $run->setTsCreated($run->getTsCreated() - 3600);
     $run->setTsAccessed($run->getTsAccessed() - 3600);
     $repository->persist($run);
     $dbRun = $repository->retrieve($run->getRunId());
     $this->assertEquals($run->getRunId(), $dbRun->getRunId());
     $this->assertEquals($run->getTsCreated(), $dbRun->getTsCreated());
     $this->assertGreaterThan($run->getTsAccessed(), $dbRun->getTsAccessed());
 }
示例#3
0
 /**
  * Executes the pipeline.
  *
  * @param   Request     $request
  * @return  Response
  */
 public function execute(Request $request)
 {
     $response = new Response();
     $runId = $request->getRunId();
     $run = $this->runRepository->retrieve($runId);
     if (null === $run) {
         $run = $this->runRepository->create();
         $runId = $run->getRunId();
     }
     $this->runRepository->persist($run);
     $response->setRunId($runId);
     return $response;
 }