Code Duplication    Length = 15-15 lines in 2 locations

src/TreeHouse/IoBundle/Test/Import/FeedType/AbstractFeedTypeTestCase.php 1 location

@@ 120-134 (lines=15) @@
117
     * @param $expectedValue
118
     * @param $actualValue
119
     */
120
    protected function assertValue($key, $expectedValue, $actualValue)
121
    {
122
        // if either actual or expected is an object, use equality assertion (==),
123
        // otherwise use identity assertion (===)
124
        $isObject = false;
125
        foreach ([$expectedValue, $actualValue] as $test) {
126
            $isObject = is_object($test) || (is_array($test) && isset($test[0]) && is_object($test[0]));
127
            if ($isObject) {
128
                break;
129
            }
130
        }
131
132
        $assert = $isObject ? 'assertEquals' : 'assertSame';
133
        $this->$assert($expectedValue, $actualValue, sprintf('Key "%s" is not modified properly', $key));
134
    }
135
136
    /**
137
     * Normalizes values before asserting them.

src/TreeHouse/IoBundle/Test/Scrape/Parser/ParserTypeTestCase.php 1 location

@@ 141-155 (lines=15) @@
138
     * @param $expectedValue
139
     * @param $actualValue
140
     */
141
    protected function assertValue($key, $expectedValue, $actualValue)
142
    {
143
        // if either actual or expected is an object, use equality assertion (==),
144
        // otherwise use identity assertion (===)
145
        $isObject = false;
146
        foreach ([$expectedValue, $actualValue] as $test) {
147
            $isObject = is_object($test) || (is_array($test) && isset($test[0]) && is_object($test[0]));
148
            if ($isObject) {
149
                break;
150
            }
151
        }
152
153
        $assert = $isObject ? 'assertEquals' : 'assertSame';
154
        $this->$assert($expectedValue, $actualValue, sprintf('Key "%s" is not modified properly', $key));
155
    }
156
157
    /**
158
     * Normalizes values before asserting them.