|
@@ 603-619 (lines=17) @@
|
| 600 |
|
* |
| 601 |
|
* @param string $expectedException |
| 602 |
|
*/ |
| 603 |
|
public function iValidatedDescriptorIExpectToGetAnException($expectedException) |
| 604 |
|
{ |
| 605 |
|
$actualException = null; |
| 606 |
|
try { |
| 607 |
|
$descriptor = $this->getLastCreatedDescriptor(); |
| 608 |
|
if (!method_exists($descriptor, 'validate')) { |
| 609 |
|
$errMsg = 'Descriptor does not support validation'; |
| 610 |
|
throw new \RuntimeException($errMsg); |
| 611 |
|
} |
| 612 |
|
|
| 613 |
|
call_user_func([$descriptor, 'validate']); |
| 614 |
|
} catch (\Exception $e) { |
| 615 |
|
$actualException = $e; |
| 616 |
|
} |
| 617 |
|
|
| 618 |
|
PHPUnit_Framework_Assert::assertInstanceOf($expectedException, $actualException); |
| 619 |
|
} |
| 620 |
|
|
| 621 |
|
|
| 622 |
|
/** |
|
@@ 579-595 (lines=17) @@
|
| 576 |
|
* @param $expectedExceptionMessage |
| 577 |
|
* |
| 578 |
|
*/ |
| 579 |
|
public function iValidatedDescriptorIExpectToGetAnExceptionMessage($expectedExceptionMessage) |
| 580 |
|
{ |
| 581 |
|
$actualExceptionMessage = null; |
| 582 |
|
try { |
| 583 |
|
$descriptor = $this->getLastCreatedDescriptor(); |
| 584 |
|
if (!method_exists($descriptor, 'validate')) { |
| 585 |
|
$errMsg = 'Descriptor does not support validation'; |
| 586 |
|
throw new \RuntimeException($errMsg); |
| 587 |
|
} |
| 588 |
|
|
| 589 |
|
call_user_func_array([$descriptor, 'validate'], []); |
| 590 |
|
} catch (\Exception $e) { |
| 591 |
|
$actualExceptionMessage = $e->getMessage(); |
| 592 |
|
} |
| 593 |
|
|
| 594 |
|
PHPUnit_Framework_Assert::assertEquals($expectedExceptionMessage, $actualExceptionMessage); |
| 595 |
|
} |
| 596 |
|
|
| 597 |
|
|
| 598 |
|
/** |