1 | <?php |
||
15 | class ExpectationManager |
||
16 | { |
||
17 | private $expectations = []; |
||
18 | |||
19 | /** |
||
20 | * Register an expectation |
||
21 | * |
||
22 | * @param ExpectationInterface $expectation |
||
23 | * @param string $alias |
||
24 | */ |
||
25 | 34 | public function add(ExpectationInterface $expectation, $alias) |
|
29 | |||
30 | /** |
||
31 | * Get a registered expectation by alias |
||
32 | * |
||
33 | * @param string $alias |
||
34 | * @return ExpectationInterface |
||
35 | * @throws ExpectationException\ExpectationNotFoundException |
||
36 | */ |
||
37 | 16 | public function get($alias) |
|
45 | |||
46 | /** |
||
47 | * Get a list of all expecations currently registered. |
||
48 | * |
||
49 | * @return array |
||
50 | */ |
||
51 | 2 | public function getAll() |
|
55 | |||
56 | /** |
||
57 | * A run() convienience method that: |
||
58 | * - Takes a test |
||
59 | * - Finds the correct expectation |
||
60 | * - Passes through the expected and actual values from the test |
||
61 | * - Constructs a TestResult based on captured output/thrown exceptions |
||
62 | * |
||
63 | * @param Test $test |
||
64 | * @return TestResult |
||
65 | */ |
||
66 | 12 | public function run(Test $test) |
|
100 | } |
||
101 |