function test_save_and_retrieve_succeed()
 {
     $this->_setRole('administrator');
     $this->create_post_and_children();
     $this->zip = $this->database->query('head')->by_id($this->gistpen->ID);
     $gist = new GistTest(WP_Gistpen::$plugin_name, WP_Gistpen::$version);
     $gist->set_client($this->mock_github_client);
     App::get('sync')->gist = $gist;
     cmb2_update_option(WP_Gistpen::$plugin_name, '_wpgp_gist_token', '1234');
     $this->mock_github_client->shouldReceive('authenticate')->times(3)->shouldReceive('create')->once()->andReturn(array('id' => 'abcde1234', 'history' => array(array('version' => 'thisversion'))))->shouldReceive('update')->twice()->andReturn(array('id' => 'abcde1234', 'history' => array(array('version' => 'thisversion'))));
     $this->add_and_test_first_save();
     $this->add_and_test_first_save_export();
     $this->add_and_test_second_save();
     $this->add_and_test_second_save_export();
     $this->add_and_test_third_save();
     $this->add_and_test_third_save_export();
 }
Пример #2
0
 function tearDown()
 {
     parent::tearDown();
     App::get('ajax')->database = new Database(WP_Gistpen::$plugin_name, WP_Gistpen::$version);
     App::get('ajax')->sync = new Sync(WP_Gistpen::$plugin_name, WP_Gistpen::$version);
 }