Facebook\InstantArticles\Elements\InstantArticle::create PHP Method

create() public static method

Factory method
public static create ( ) : InstantArticle
return InstantArticle object.
    public static function create()
    {
        return new InstantArticle();
    }

Usage Example

    public function testInvalidSelectorToString()
    {
        $json = <<<'JSON'
{
    "class": "SocialEmbedRule",
    "selector" : "figure.op-social",
    "properties" : {
        "socialembed.url" : {
            "type" : "string",
            "selector" : "iframe",
            "attribute": "src"
        },
        "socialembed.iframe" : {
            "type" : "children",
            "selector" : "iframe"
        }
    }
}
JSON;
        $properties = json_decode($json, true);
        $instant_article = InstantArticle::create();
        $document = new \DOMDocument();
        $node = $document->createElement('figcaption');
        $rule = SocialEmbedRule::createFrom($properties);
        $warning = new InvalidSelector('field a and b', $instant_article, $node, $rule);
        $result = $warning->__toString();
        $expected = 'Invalid selector for fields (field a and b). ' . 'The node being transformed was <figcaption> in the context of' . ' InstantArticle within the Rule SocialEmbedRule with these' . ' properties: { socialembed.url=StringGetter}';
        $this->assertEquals($expected, $result);
    }
All Usage Examples Of Facebook\InstantArticles\Elements\InstantArticle::create