Admin_Action_Index_Push_Test::testUpdate PHP Метод

testUpdate() публичный Метод

public testUpdate ( )
    public function testUpdate()
    {
        $response = $this->dummy_response();
        $api = $this->prophet->prophesize('\\Apple_Push_API\\API');
        $api->update_article("123", Argument::Any(), Argument::Any(), array(), array('data' => array()))->willReturn($response)->shouldBeCalled();
        $api->get_article("123")->willReturn($response)->shouldBeCalled();
        // Create post, simulate that the post has been synced
        $post_id = $this->factory->post->create();
        update_post_meta($post_id, 'apple_news_api_id', 123);
        $action = new Push($this->settings, $post_id);
        $action->set_api($api->reveal());
        $action->perform();
        $this->assertEquals($response->data->id, get_post_meta($post_id, 'apple_news_api_id', true));
        $this->assertEquals($response->data->createdAt, get_post_meta($post_id, 'apple_news_api_created_at', true));
        $this->assertEquals($response->data->modifiedAt, get_post_meta($post_id, 'apple_news_api_modified_at', true));
        $this->assertEquals($response->data->shareUrl, get_post_meta($post_id, 'apple_news_api_share_url', true));
        $this->assertEquals(null, get_post_meta($post_id, 'apple_news_api_deleted', true));
    }