@@ 82-111 (lines=30) @@ | ||
79 | /** |
|
80 | * @param ItemFixture $fixture |
|
81 | */ |
|
82 | protected function assertFixture(ItemFixture $fixture) |
|
83 | { |
|
84 | $this->assertOriginalId($fixture); |
|
85 | $this->assertOriginalUrl($fixture); |
|
86 | ||
87 | $expected = $fixture->getExpectedItem()->all(); |
|
88 | $actual = $fixture->getActualItem()->all(); |
|
89 | ||
90 | foreach ($expected as $key => $expectedValue) { |
|
91 | $this->assertArrayHasKey( |
|
92 | $key, |
|
93 | $actual, |
|
94 | sprintf('Key "%s" is not in item, when it should be', $key) |
|
95 | ); |
|
96 | ||
97 | $actualValue = $actual[$key]; |
|
98 | ||
99 | $this->normalizeValues($key, $expectedValue, $actualValue); |
|
100 | ||
101 | $this->assertValue($key, $expectedValue, $actualValue); |
|
102 | ||
103 | unset($actual[$key]); |
|
104 | } |
|
105 | ||
106 | if (!empty($actual)) { |
|
107 | $this->fail( |
|
108 | sprintf('The following keys in the modified item are not tested: %s', json_encode(array_keys($actual))) |
|
109 | ); |
|
110 | } |
|
111 | } |
|
112 | ||
113 | /** |
|
114 | * Asserts a value. |
@@ 110-132 (lines=23) @@ | ||
107 | /** |
|
108 | * @param ItemFixture $fixture |
|
109 | */ |
|
110 | protected function assertFixture(ItemFixture $fixture) |
|
111 | { |
|
112 | $this->assertOriginalId($fixture); |
|
113 | $this->assertOriginalUrl($fixture); |
|
114 | $expected = $fixture->getExpectedItem()->all(); |
|
115 | $actual = $fixture->getActualItem()->all(); |
|
116 | foreach ($expected as $key => $expectedValue) { |
|
117 | $this->assertArrayHasKey( |
|
118 | $key, |
|
119 | $actual, |
|
120 | sprintf('Key "%s" is not in item, when it should be', $key) |
|
121 | ); |
|
122 | $actualValue = $actual[$key]; |
|
123 | $this->normalizeValues($key, $expectedValue, $actualValue); |
|
124 | $this->assertValue($key, $expectedValue, $actualValue); |
|
125 | unset($actual[$key]); |
|
126 | } |
|
127 | if (!empty($actual)) { |
|
128 | $this->fail( |
|
129 | sprintf('The following keys in the modified item are not tested: %s', json_encode(array_keys($actual))) |
|
130 | ); |
|
131 | } |
|
132 | } |
|
133 | ||
134 | /** |
|
135 | * Asserts a value. |