Example #1
0
 function test_mock()
 {
     Curl::initMock();
     Curl::mockResult("helloworld");
     $curl = new Curl();
     $res = $curl->exec();
     $this->assertEquals($res, "helloworld");
 }
 function setUp()
 {
     global $wpdb;
     parent::setUp();
     $wpdb->query("CREATE TABLE {$wpdb->prefix}h5p_contents ( " . "id INTEGER NOT NULL auto_increment, " . "slug VARCHAR(255) not null, " . "PRIMARY KEY(id))");
     if ($wpdb->last_error) {
         throw new Exception($wpdb->last_error);
     }
     Curl::initMock();
     RemoteSyncPlugin::instance()->setLogger(new MockJob());
 }
 function test_push()
 {
     RemoteSyncPlugin::instance()->install();
     $postId = wp_insert_post(array('post_content' => 'content', 'post_name' => 'the-slug', 'post_title' => "Hello Post"));
     update_option("rs_remote_site_url", "http://example.com/");
     Curl::mockResult(array());
     Curl::mockResult(array());
     Curl::mockResult(array());
     $op = new RemoteSyncOperations();
     $op->push();
     wp_trash_post($postId);
     Curl::initMock();
     Curl::mockResult(array(array("slug" => 'the-slug', 'revision' => "hello")));
     Curl::mockResult(array());
     Curl::mockResult(array());
     $op = new RemoteSyncOperations();
     $op->push();
 }