@@ 519-540 (lines=22) @@ | ||
516 | * |
|
517 | * @param string $expectedException |
|
518 | */ |
|
519 | public function iSaveToDescriptorXmlIExpectToGetAnException($expectedException) |
|
520 | { |
|
521 | $actualException = null; |
|
522 | try { |
|
523 | $dom = new \DOMDocument(); |
|
524 | $dom->encoding = 'UTF-8'; |
|
525 | $dom->xmlVersion = '1.0'; |
|
526 | $dom->formatOutput = true; |
|
527 | ||
528 | $descriptor = $this->getLastCreatedDescriptor(); |
|
529 | if (!$descriptor instanceof WriteXmlInterface) { |
|
530 | $errMsg = 'Descriptor not implement WriteXmlInterface'; |
|
531 | throw new \RuntimeException($errMsg); |
|
532 | } |
|
533 | ||
534 | $descriptor->writeXml($dom); |
|
535 | } catch (\Exception $e) { |
|
536 | $actualException = $e; |
|
537 | } |
|
538 | ||
539 | PHPUnit_Framework_Assert::assertInstanceOf($expectedException, $actualException); |
|
540 | } |
|
541 | ||
542 | /** |
|
543 | * @Then I save to descriptor xml. I expect to get an exception message :expectedException |
|
@@ 548-569 (lines=22) @@ | ||
545 | * @param $expectedExceptionMessage |
|
546 | * |
|
547 | */ |
|
548 | public function iSaveToDescriptorXmlIExpectToGetAnExceptionMessage($expectedExceptionMessage) |
|
549 | { |
|
550 | $actualExceptionMessage = null; |
|
551 | try { |
|
552 | $dom = new \DOMDocument(); |
|
553 | $dom->encoding = 'UTF-8'; |
|
554 | $dom->xmlVersion = '1.0'; |
|
555 | $dom->formatOutput = true; |
|
556 | ||
557 | $descriptor = $this->getLastCreatedDescriptor(); |
|
558 | if (!$descriptor instanceof WriteXmlInterface) { |
|
559 | $errMsg = 'Descriptor not implement WriteXmlInterface'; |
|
560 | throw new \RuntimeException($errMsg); |
|
561 | } |
|
562 | ||
563 | $descriptor->writeXml($dom); |
|
564 | } catch (\Exception $e) { |
|
565 | $actualExceptionMessage = $e->getMessage(); |
|
566 | } |
|
567 | ||
568 | PHPUnit_Framework_Assert::assertEquals($expectedExceptionMessage, $actualExceptionMessage); |
|
569 | } |
|
570 | ||
571 | ||
572 |