1: <?php
2:
3: namespace Chromabits\Nucleus\Testing\Mocking;
4:
5: use Chromabits\Nucleus\Exceptions\LackOfCoffeeException;
6: use Chromabits\Nucleus\Foundation\BaseObject;
7:
8: /**
9: * Class CallExpectation.
10: *
11: * A simple structure modeling a method call expectation.
12: *
13: * @author Eduardo Trujillo <ed@chromabits.com>
14: * @package Chromabits\Nucleus\Testing\Mocking
15: */
16: class CallExpectation extends BaseObject
17: {
18: /**
19: * @var string
20: */
21: protected $methodName;
22:
23: /**
24: * @var array
25: */
26: protected $arguments;
27:
28: /**
29: * @var mixed|null
30: */
31: protected $return;
32:
33: /**
34: * @var int
35: */
36: protected $times;
37:
38: /**
39: * Construct an instance of a CallExpectation.
40: *
41: * @param string $methodName
42: * @param array $arguments
43: * @param mixed|null $return
44: * @param int $times
45: *
46: * @throws LackOfCoffeeException
47: */
48: public function __construct(
49: $methodName,
50: array $arguments,
51: $return = null,
52: $times = 1
53: ) {
54: parent::__construct();
55:
56: $this->methodName = $methodName;
57: $this->arguments = $arguments;
58: $this->return = $return;
59: $this->times = $times;
60: }
61:
62: /**
63: * @return string
64: */
65: public function getMethodName()
66: {
67: return $this->methodName;
68: }
69:
70: /**
71: * @return array
72: */
73: public function getArguments()
74: {
75: return $this->arguments;
76: }
77:
78: /**
79: * @return mixed|null
80: */
81: public function getReturn()
82: {
83: return $this->return;
84: }
85:
86: /**
87: * @return int
88: */
89: public function getTimes()
90: {
91: return $this->times;
92: }
93: }