1: <?php
2:
3: namespace Chromabits\Nucleus\Testing\Mocking;
4:
5: /**
6: * Class CallAndThrowExpectation.
7: *
8: * @author Eduardo Trujillo <ed@chromabits.com>
9: * @package Chromabits\Nucleus\Testing\Mocking
10: */
11: class CallAndThrowExpectation extends CallExpectation
12: {
13: /**
14: * @var mixed|null
15: */
16: protected $exceptionClass;
17:
18: /**
19: * @var string
20: */
21: protected $exceptionMessage;
22:
23: /**
24: * @var int
25: */
26: protected $exceptionCode;
27:
28: /**
29: * Construct an instance of a CallAndThrowExpectation.
30: *
31: * @param string $methodName
32: * @param array $arguments
33: * @param mixed|null $exceptionClass
34: * @param string $exceptionMessage
35: * @param int $exceptionCode
36: */
37: public function __construct(
38: $methodName,
39: array $arguments,
40: $exceptionClass,
41: $exceptionMessage = '',
42: $exceptionCode = 0
43: ) {
44: parent::__construct($methodName, $arguments, null, 1);
45:
46: $this->exceptionClass = $exceptionClass;
47: $this->exceptionMessage = $exceptionMessage;
48: $this->exceptionCode = $exceptionCode;
49: }
50:
51: /**
52: * @return mixed|null
53: */
54: public function getExceptionClass()
55: {
56: return $this->exceptionClass;
57: }
58:
59: /**
60: * @return string
61: */
62: public function getExceptionMessage()
63: {
64: return $this->exceptionMessage;
65: }
66:
67: /**
68: * @return int
69: */
70: public function getExceptionCode()
71: {
72: return $this->exceptionCode;
73: }
74: }