PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 2.5.4
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v2.5.4
4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / vendor / ostraining / embera / Tests / TestFormatter.php
embedpress / vendor / ostraining / embera / Tests Last commit date
Autoload.php 8 years ago TestEmbera.php 8 years ago TestFakeResponse.php 8 years ago TestFormatter.php 8 years ago TestHtmlProcessor.php 8 years ago TestHttpRequest.php 8 years ago TestOembed.php 8 years ago TestProviders.php 8 years ago TestServiceAmCharts.php 8 years ago TestServiceAnimatron.php 8 years ago TestServiceAnimoto.php 8 years ago TestServiceAolOn.php 8 years ago TestServiceAppNet.php 8 years ago TestServiceAudioSnaps.php 8 years ago TestServiceBambuser.php 8 years ago TestServiceBlipTv.php 8 years ago TestServiceCacoo.php 8 years ago TestServiceChartblocks.php 8 years ago TestServiceChirbit.php 8 years ago TestServiceCircuitLab.php 8 years ago TestServiceClipland.php 8 years ago TestServiceClyp.php 8 years ago TestServiceCodepoints.php 8 years ago TestServiceCollegeHumor.php 8 years ago TestServiceCoub.php 8 years ago TestServiceCrowdRanking.php 8 years ago TestServiceDailyMile.php 8 years ago TestServiceDailyMotion.php 8 years ago TestServiceDeviantart.php 8 years ago TestServiceDidacte.php 8 years ago TestServiceDipity.php 8 years ago TestServiceDotSub.php 8 years ago TestServiceEdocr.php 8 years ago TestServiceEgliseInfo.php 8 years ago TestServiceFacebook.php 8 years ago TestServiceFlickr.php 8 years ago TestServiceFunnyOrDie.php 8 years ago TestServiceGeographCI.php 8 years ago TestServiceGeographDe.php 8 years ago TestServiceGeographUk.php 8 years ago TestServiceGettyImages.php 8 years ago TestServiceGfycat.php 8 years ago TestServiceGithubGist.php 8 years ago TestServiceGmep.php 8 years ago TestServiceHq23.php 8 years ago TestServiceHuffduffer.php 8 years ago TestServiceHulu.php 8 years ago TestServiceIFTTT.php 8 years ago TestServiceIFixIt.php 8 years ago TestServiceInfogram.php 8 years ago TestServiceInstagram.php 8 years ago TestServiceIssuu.php 8 years ago TestServiceIssuuFakeResponse.php 8 years ago TestServiceKickstarter.php 8 years ago TestServiceLearningApps.php 8 years ago TestServiceMeetup.php 8 years ago TestServiceMixCloud.php 8 years ago TestServiceMobyPicture.php 8 years ago TestServiceNFB.php 8 years ago TestServiceOfficeMix.php 8 years ago TestServiceOfficialFM.php 8 years ago TestServiceOumy.php 8 years ago TestServicePastery.php 8 years ago TestServicePollDaddy.php 8 years ago TestServicePollEverywhere.php 8 years ago TestServicePortfolium.php 8 years ago TestServiceRapidengage.php 8 years ago TestServiceRdio.php 8 years ago TestServiceReleaseWire.php 8 years ago TestServiceRepubHub.php 8 years ago TestServiceReverbnation.php 8 years ago TestServiceRevision3.php 8 years ago TestServiceRoomshare.php 8 years ago TestServiceRutube.php 8 years ago TestServiceSapo.php 8 years ago TestServiceScreenr.php 8 years ago TestServiceScribd.php 8 years ago TestServiceShortNote.php 8 years ago TestServiceShoudio.php 8 years ago TestServiceShowTheWay.php 8 years ago TestServiceSilk.php 8 years ago TestServiceSketchfab.php 8 years ago TestServiceSlideshare.php 8 years ago TestServiceSoundCloud.php 8 years ago TestServiceSpeakerDeck.php 8 years ago TestServiceSpotify.php 8 years ago TestServiceStreamOneCloud.php 8 years ago TestServiceStreamable.php 8 years ago TestServiceSway.php 8 years ago TestServiceTed.php 8 years ago TestServiceTheySaidSo.php 8 years ago TestServiceTwitter.php 8 years ago TestServiceUstream.php 8 years ago TestServiceVerse.php 8 years ago TestServiceVevo.php 8 years ago TestServiceViddler.php 8 years ago TestServiceVideoFork.php 8 years ago TestServiceVideoJug.php 8 years ago TestServiceVimeo.php 8 years ago TestServiceVine.php 8 years ago TestServiceWordpressTV.php 8 years ago TestServiceYFrog.php 8 years ago TestServiceYandex.php 8 years ago TestServiceYoutube.php 8 years ago TestUrl.php 8 years ago
TestFormatter.php
131 lines
1 <?php
2 /**
3 * TestFormatter.php
4 *
5 * @package Tests
6 * @author Michael Pratt <pratt@hablarmierda.net>
7 * @link http://www.michael-pratt.com/
8 *
9 * For the full copyright and license information, please view the LICENSE
10 * file that was distributed with this source code.
11 */
12
13 class TestFormatter extends PHPUnit_Framework_TestCase
14 {
15 public function testTemplateArray()
16 {
17 $urls = array(
18 'http://youtu.be/fSUK4WgQ3vk',
19 'http://www.youtube.com/watch?v=T3O1nffTG-k'
20 );
21
22 $embera = new \Embera\Embera();
23 $embera = new \Embera\Formatter($embera);
24 $embera->setTemplate('{html}|');
25
26 $result = $embera->transform($urls);
27 $this->assertCount(count($urls), explode('|', trim($result, '|')));
28 }
29
30 public function testTemplateString()
31 {
32 $embera = new \Embera\Embera();
33 $embera = new \Embera\Formatter($embera);
34 $embera->setTemplate('<div class="hey">{html}</div>');
35 $result = $embera->transform('Hey did you see http://www.youtube.com/watch?v=MpVHQnIvTXo');
36
37 $this->assertContains('<div class="hey"><iframe', $result);
38 }
39
40 public function testTemplateRecursionKeys()
41 {
42 $embera = new \Embera\Embera();
43 $embera = new \Embera\Formatter($embera);
44 $embera->setTemplate('{raw.html}');
45 $result = $embera->transform('https://www.facebook.com/adam.j.mccann/posts/10156943904420037?pnref=story');
46
47 $this->assertContains('fb-root', $result);
48 }
49
50 public function testOfflineSupport()
51 {
52 $urls = array(
53 'http://www.youtube.com/watch?v=MpVHQnIvTXo',
54 'http://youtu.be/fSUK4WgQ3vk',
55 );
56
57 $embera = new \Embera\Embera(array('oembed' => false));
58 $embera = new \Embera\Formatter($embera);
59 $embera->setTemplate('<div class="hi">{html}</div>');
60
61 $result = $embera->transform($urls);
62 $this->assertEmpty($result);
63 $this->assertTrue($embera->hasErrors());
64 $this->assertCount(count($urls), $embera->getErrors());
65
66 $last = $embera->getLastError();
67 $this->assertTrue(!empty($last));
68 }
69
70 public function testOfflineSupport2()
71 {
72 $urls = array('http://youtu.be/fSUK4WgQ3vk');
73
74 $embera = new \Embera\Embera(array('oembed' => false));
75 $embera = new \Embera\Formatter($embera, true);
76 $embera->setTemplate('<div class="hi">{html}</div>');
77
78 $result = $embera->transform($urls);
79 $this->assertContains('<iframe', $result);
80 }
81
82 public function testSupportForDecoratedObjectAPI()
83 {
84 $urls = array(
85 'http://www.youtube.com/watch?v=MpVHQnIvTXo',
86 'http://youtu.be/fSUK4WgQ3vk',
87 );
88
89 $embera = new \Embera\Embera(array('oembed' => false));
90 $embera = new \Embera\Formatter($embera);
91
92 $result = $embera->autoEmbed(implode(' ', $urls));
93 $this->assertTrue(!empty($result));
94 $this->assertContains('<iframe', $result);
95 }
96
97 public function testSupportForDecoratedObjectAPI2()
98 {
99 $this->setExpectedException('InvalidArgumentException');
100
101 $embera = new \Embera\Embera(array('oembed' => false));
102 $embera = new \Embera\Formatter($embera);
103
104 $last = $embera->getLastError();
105 $this->assertTrue(empty($last));
106
107 $embera->unknownMethodName();
108 }
109
110 public function testUnknownWebsites()
111 {
112 $embera = new \Embera\Embera();
113 $embera = new \Embera\Formatter($embera);
114
115 $this->assertEmpty($embera->setTemplate('{html}', array('url1.com', 'url2.com', 'url3.com')));
116 $this->assertEquals($embera->setTemplate('{html}', 'unknown url http://hey.com'), 'unknown url http://hey.com');
117 }
118
119 public function testRemoveEmptyPlaceholders()
120 {
121 $urls = array('http://youtu.be/fSUK4WgQ3vk');
122
123 $embera = new \Embera\Embera();
124 $embera = new \Embera\Formatter($embera);
125 $embera->setTemplate('{unknown_key}');
126
127 $result = $embera->transform($urls);
128 $this->assertEquals($result, '');
129 }
130 }
131