/** * @covers tfrommen\DefaultPostDate\Update\Updater::update * @dataProvider provide_update_data * * @param bool $expected * @param string $version * @param string $old_version * * @return void */ public function test_update($expected, $version, $old_version) { $testee = new Testee($version); $option_name = 'default_post_date_version'; WP_Mock::wpFunction('get_option', array('args' => array(Mockery::type('string')), 'return' => $old_version)); WP_Mock::wpFunction('update_option', array('args' => array($option_name, $version))); $this->assertSame($expected, $testee->update()); $this->assertConditionsMet(); }
/** * Constructor. Sets up the properties. * * @param Updater $updater Updater. * @param \wpdb $wpdb Database object. * @param Option $option Option model. */ public function __construct(Updater $updater, \wpdb $wpdb, Option $option) { $this->version_option_name = $updater->get_option_name(); $this->wpdb = $wpdb; $this->option = $option; }