Admin_Action_Index_Push_Test::testComponentErrorsNone PHP Метод

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

    public function testComponentErrorsNone()
    {
        $this->settings->set('component_alerts', 'none');
        $response = $this->dummy_response();
        $api = $this->prophet->prophesize('\\Apple_Push_API\\API');
        $api->post_article_to_channel(Argument::cetera())->willReturn($response)->shouldBeCalled();
        // We need to create an iframe, so run as administrator
        $user_id = $this->set_admin();
        // Create post
        $post_id = $this->factory->post->create(array('post_content' => '<p><iframe width="460" height="460" src="http://unsupportedservice.com/embed.html?video=1232345&autoplay=0" frameborder="0" allowfullscreen></iframe></p>'));
        $action = new Push($this->settings, $post_id);
        $action->set_api($api->reveal());
        $action->perform();
        // The post was still quietly sent to Apple News despite the removal of the iframe
        $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));
    }