public function testRenderBasicWithCaption()
 {
     $social_embed = SocialEmbed::create()->withSource('http://foo.com')->withCaption(Caption::create()->appendText('Some caption to the embed'));
     $expected = '<figure class="op-interactive">' . '<iframe src="http://foo.com"></iframe>' . '<figcaption>Some caption to the embed</figcaption>' . '</figure>';
     $rendered = $social_embed->render();
     $this->assertEquals($expected, $rendered);
 }
 public function testRenderWithCaption()
 {
     $slideshow = SlideShow::create()->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home.jpg'))->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home2.jpg'))->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home3.jpg'))->withCaption(Caption::create()->appendText('Some caption to the slideshow'));
     $expected = '<figure class="op-slideshow">' . '<figure>' . '<img src="https://jpeg.org/images/jpegls-home.jpg"/>' . '</figure>' . '<figure>' . '<img src="https://jpeg.org/images/jpegls-home2.jpg"/>' . '</figure>' . '<figure>' . '<img src="https://jpeg.org/images/jpegls-home3.jpg"/>' . '</figure>' . '<figcaption>Some caption to the slideshow</figcaption>' . '</figure>';
     $rendered = $slideshow->render();
     $this->assertEquals($expected, $rendered);
 }
예제 #3
0
 public function testRenderWithLikeAndComments()
 {
     $image = Image::create()->withURL('https://jpeg.org/images/jpegls-home.jpg')->withCaption(Caption::create()->appendText('Some caption to the image'))->enableLike()->enableComments();
     $expected = '<figure data-feedback="fb:likes,fb:comments">' . '<img src="https://jpeg.org/images/jpegls-home.jpg"/>' . '<figcaption>Some caption to the image</figcaption>' . '</figure>';
     $rendered = $image->render();
     $this->assertEquals($expected, $rendered);
 }
예제 #4
0
 public function testRenderWithLikeAndComments()
 {
     $video = Video::create()->withURL('http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4')->withCaption(Caption::create()->appendText('Some caption to the video'))->enableLike()->enableComments();
     $expected = '<figure data-feedback="fb:likes,fb:comments">' . '<video>' . '<source src="http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4"/>' . '</video>' . '<figcaption>Some caption to the video</figcaption>' . '</figure>';
     $rendered = $video->render();
     $this->assertEquals($expected, $rendered);
 }
 public function testRenderWithAllFormating()
 {
     $caption = Caption::create()->appendText('Caption Title')->withFontsize(Caption::SIZE_LARGE)->withPosition(Caption::POSITION_BELOW)->withTextAlignment(Caption::ALIGN_LEFT)->withVerticalAlignment(Caption::VERTICAL_BOTTOM);
     $expected = '<figcaption class="op-left op-vertical-bottom op-large op-vertical-below">' . 'Caption Title' . '</figcaption>';
     $rendered = $caption->render();
     $this->assertEquals($expected, $rendered);
 }
예제 #6
0
 public function testCompleteHeader()
 {
     date_default_timezone_set('UTC');
     $inline = '<script>alert("test & more test");</script>';
     $header = Header::create()->withTitle('Big Top Title')->withSubTitle('Smaller SubTitle')->withPublishTime(Time::create(Time::PUBLISHED)->withDatetime(\DateTime::createFromFormat('j-M-Y G:i:s', '14-Aug-1984 19:30:00')))->withModifyTime(Time::create(Time::MODIFIED)->withDatetime(\DateTime::createFromFormat('j-M-Y G:i:s', '10-Feb-2016 10:00:00')))->addAuthor(Author::create()->withName('Author One')->withDescription('Passionate coder and mountain biker'))->addAuthor(Author::create()->withName('Author Two')->withDescription('Weend surfer with heavy weight coding skils')->withURL('http://facebook.com/author'))->withKicker('Some kicker of this article')->withCover(Image::create()->withURL('https://jpeg.org/images/jpegls-home.jpg')->withCaption(Caption::create()->appendText('Some caption to the image')))->addAd(Ad::create()->withSource('http://foo.com'))->addAd(Ad::create()->withSource('http://foo.com')->withWidth(350)->withHeight(50)->enableDefaultForReuse())->addAd(Ad::create()->withWidth(300)->withHeight(250)->enableDefaultForReuse()->withHTML($inline));
     $expected = '<header>' . '<figure>' . '<img src="https://jpeg.org/images/jpegls-home.jpg"/>' . '<figcaption>Some caption to the image</figcaption>' . '</figure>' . '<h1>Big Top Title</h1>' . '<h2>Smaller SubTitle</h2>' . '<time class="op-published" datetime="1984-08-14T19:30:00+00:00">August 14th, 7:30pm</time>' . '<time class="op-modified" datetime="2016-02-10T10:00:00+00:00">February 10th, 10:00am</time>' . '<address>' . '<a>Author One</a>' . 'Passionate coder and mountain biker' . '</address>' . '<address>' . '<a href="http://facebook.com/author" rel="facebook">Author Two</a>' . 'Weend surfer with heavy weight coding skils' . '</address>' . '<h3 class="op-kicker">Some kicker of this article</h3>' . '<section class="op-ad-template">' . '<figure class="op-ad">' . '<iframe src="http://foo.com"></iframe>' . '</figure>' . '<figure class="op-ad op-ad-default">' . '<iframe src="http://foo.com" width="350" height="50"></iframe>' . '</figure>' . '<figure class="op-ad">' . '<iframe width="300" height="250">' . '<script>alert("test & more test");</script>' . '</iframe>' . '</figure>' . '</section>' . '</header>';
     $rendered = $header->render();
     $this->assertEquals($expected, $rendered);
 }
예제 #7
0
    public function testRenderWithGeotagAndCaption()
    {
        $script = <<<'JSON'
{
    "type": "Feature",
    "geometry": {
        "type": "Point",
        "coordinates": [23.166667, 89.216667]
    },
    "properties": {
        "title": "Jessore, Bangladesh",
        "radius": 750000,
        "pivot": true,
        "style": "satellite"
    }
}
JSON;
        $map = Map::create()->withGeoTag(GeoTag::create()->withScript($script))->withCaption(Caption::create()->withTitle('Title of Image caption')->withCredit('Some caption to the image')->withPosition(Caption::POSITION_BELOW));
        $expected = '<figure class="op-map">' . '<script type="application/json" class="op-geotag">' . $script . '</script>' . '<figcaption class="op-vertical-below">' . '<h1>Title of Image caption</h1>' . '<cite>Some caption to the image</cite>' . '</figcaption>' . '</figure>';
        $rendered = $map->render();
        $this->assertEquals($expected, $rendered);
    }
 protected function setUp()
 {
     date_default_timezone_set('UTC');
     $inline = '<h1>Some custom code</h1>' . '<script>alert("test & more test");</script>';
     $this->article = InstantArticle::create()->withCanonicalUrl('http://foo.com/article.html')->withStyle('myarticlestyle')->withHeader(Header::create()->withTitle('Big Top Title')->withSubTitle('Smaller SubTitle')->withPublishTime(Time::create(Time::PUBLISHED)->withDatetime(\DateTime::createFromFormat('j-M-Y G:i:s', '14-Aug-1984 19:30:00')))->withModifyTime(Time::create(Time::MODIFIED)->withDatetime(\DateTime::createFromFormat('j-M-Y G:i:s', '10-Feb-2016 10:00:00')))->addAuthor(Author::create()->withName('Author Name')->withDescription('Author more detailed description'))->addAuthor(Author::create()->withName('Author in FB')->withDescription('Author user in facebook')->withURL('http://facebook.com/author'))->withKicker('Some kicker of this article')->withCover(Image::create()->withURL('https://jpeg.org/images/jpegls-home.jpg')->withCaption(Caption::create()->appendText('Some caption to the image'))))->addChild(Paragraph::create()->appendText('Some text to be within a paragraph for testing.'))->addChild(Paragraph::create()->appendText('Other text to be within a second paragraph for testing.'))->addChild(Paragraph::create())->addChild(Paragraph::create()->appendText(" \n \t "))->addChild(SlideShow::create()->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home.jpg'))->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home2.jpg'))->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home3.jpg')))->addChild(Paragraph::create()->appendText('Some text to be within a paragraph for testing.'))->addChild(Ad::create()->withSource('http://foo.com'))->addChild(Paragraph::create()->appendText('Other text to be within a second paragraph for testing.'))->addChild(Analytics::create()->withHTML($inline))->withFooter(Footer::create()->withCredits('Some plaintext credits.'));
 }