public function test_update_list_of_installed_versions() { $initial_activation_history = $this->_addon->get_activation_history(); $this->assertEmpty($initial_activation_history); $now_string = substr(date('Y-m-d H:i:s', time()), 0, -1); //now update the list $this->_addon->update_list_of_installed_versions($initial_activation_history, '2.0.0'); //now let's try adding more to it $this->_addon->update_list_of_installed_versions($initial_activation_history, '3.0.0'); $new_activation_history = $this->_addon->get_activation_history(); $version_number = key($new_activation_history); $times_installed = array_shift($new_activation_history); $this->assertEquals('2.0.0', $version_number); $this->assertTrue(is_array($times_installed)); $time_first_installed = array_shift($times_installed); $this->assertEquals($now_string, substr($time_first_installed, 0, -1)); $second_version_number = key($new_activation_history); $times_second_v_installed = array_shift($new_activation_history); $this->assertEquals('3.0.0', $second_version_number); $this->assertTrue(is_array($times_second_v_installed)); $time_second_v_first_installed = array_shift($times_second_v_installed); $this->assertEquals($now_string, substr($time_second_v_first_installed, 0, -1)); }