public function merge($test) { $this->prev = $test->prev; foreach ($this->items as $item => $values) { $this->items[$item] = otulea::merge_items($this->items[$item], $test->items[$item]); } }
echo "Failed"; } echo PHP_EOL; // TEST 2 echo "Test 2: 'data' is empty only for the first item: "; $item = '2.3.01_I'; $item1 = $test->get_items()[$item]; $item2 = $test_prev->get_items()[$item]; $merged = otulea::merge_items($item1, $item2); $cond1 = strcmp($merged['timestamp'], $test->get_prev()) === 0; $cond2 = strcmp($merged['data'], $item2['data']) === 0; if ($cond1 && $cond2) { echo "OK"; } else { echo "Failed"; } echo PHP_EOL; // TEST 3 echo "Test 3: 'data' is empty only for the second item: "; $item = '2.3.03_I'; $item1 = $test->get_items()[$item]; $item2 = $test_prev->get_items()[$item]; $merged = otulea::merge_items($item1, $item2); $cond1 = strcmp($merged['timestamp'], $timestamp) === 0; $cond2 = strcmp($merged['data'], $item1['data']) === 0; if ($cond1 && $cond2) { echo "OK"; } else { echo "Failed"; } echo PHP_EOL;