コード例 #1
0
 public function testTestCaseFinishedEvent()
 {
     Allure::lifecycle()->getStepStorage()->clear();
     Allure::lifecycle()->getStepStorage()->getLast();
     //To initialize root step
     Allure::lifecycle()->getTestCaseStorage()->clear();
     $step = new Step();
     $step->setName(self::STEP_NAME);
     $attachment = new Attachment(self::STEP_ATTACHMENT_TITLE, self::STEP_ATTACHMENT_SOURCE, self::STEP_ATTACHMENT_TYPE);
     Allure::lifecycle()->getStepStorage()->getLast()->addStep($step);
     Allure::lifecycle()->getStepStorage()->getLast()->addAttachment($attachment);
     $testCaseFromStorage = Allure::lifecycle()->getTestCaseStorage()->get();
     Allure::lifecycle()->fire(new TestCaseFinishedEvent());
     //Checking that attachments were moved
     $attachments = $testCaseFromStorage->getAttachments();
     $this->assertEquals(1, sizeof($attachments));
     $attachment = array_pop($attachments);
     $this->assertTrue($attachment instanceof Attachment && $attachment->getTitle() === self::STEP_ATTACHMENT_TITLE && $attachment->getSource() === self::STEP_ATTACHMENT_SOURCE && $attachment->getType() === self::STEP_ATTACHMENT_TYPE);
     //Checking that steps were moved
     $steps = $testCaseFromStorage->getSteps();
     $this->assertEquals(1, sizeof($steps));
     $stepFromStorage = array_pop($steps);
     $this->assertTrue($stepFromStorage instanceof Step && $stepFromStorage->getName() === self::STEP_NAME);
     $this->assertTrue(Allure::lifecycle()->getTestCaseStorage()->isEmpty());
 }
コード例 #2
0
 public function testNonEmptyStorage()
 {
     $storage = new Fixtures\MockedRootStepStorage();
     $step = new Step();
     $step->setName(self::TEST_STEP_NAME);
     $storage->put($step);
     $this->assertEquals($storage->getLast()->getName(), self::TEST_STEP_NAME);
 }
コード例 #3
0
 /**
  * @return Step
  */
 protected function getRootStep()
 {
     $step = new Step();
     $step->setName(self::ROOT_STEP_NAME);
     $step->setTitle("If you're seeing this then there's an error in step processing. " . "Please send feedback to allure@yandex-team.ru. Thank you.");
     $step->setStart(self::getTimestamp());
     $step->setStatus(Status::BROKEN);
     return $step;
 }
コード例 #4
0
 protected function getRootStep()
 {
     $rootStep = new Step();
     $rootStep->setName('root-step');
     return $rootStep;
 }