refactor test
This commit is contained in:
parent
756f90e6cf
commit
cbc6346ba6
@ -254,17 +254,25 @@ class DailyImageWidgetTest extends PHPUnit_Framework_TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function testGetCachedData() {
|
function providerTestGetCachedData() {
|
||||||
$test_time = time() + 86500;
|
return array(
|
||||||
update_option('hubblesite-daily-image-cache', array($test_time, $this->sample_data));
|
array(time() + 86500, true),
|
||||||
$this->assertEquals($this->sample_data, $this->diw->_get_cached_data());
|
array(time() - 86500, false),
|
||||||
|
array(null, false)
|
||||||
$test_time = time() - 86500;
|
);
|
||||||
update_option('hubblesite-daily-image-cache', array($test_time, $this->sample_data));
|
}
|
||||||
$this->assertEquals(false, $this->diw->_get_cached_data());
|
|
||||||
|
/**
|
||||||
update_option('hubblesite-daily-image-cache', null);
|
* @dataProvider providerTestGetCachedData
|
||||||
$this->assertEquals(false, $this->diw->_get_cached_data());
|
*/
|
||||||
|
function testGetCachedData($test_time, $has_sample_data) {
|
||||||
|
if (!is_null($test_time)) {
|
||||||
|
update_option('hubblesite-daily-image-cache', array($test_time, $this->sample_data));
|
||||||
|
} else {
|
||||||
|
update_option('hubblesite-daily-image-cache', null);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertEquals($has_sample_data ? $this->sample_data : false, $this->diw->_get_cached_data());
|
||||||
}
|
}
|
||||||
|
|
||||||
function providerTestLoadData() {
|
function providerTestLoadData() {
|
||||||
|
Loading…
Reference in New Issue
Block a user