Skip to content

Commit c5f5a3c

Browse files
committed
added wikipedia test #61
1 parent 358d286 commit c5f5a3c

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/Adapters/Wikipedia.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,12 @@ public function getImagesUrls()
147147

148148
return $images;
149149
}
150+
151+
/**
152+
* {@inheritdoc}
153+
*/
154+
public function getProviderName()
155+
{
156+
return 'Wikipedia';
157+
}
150158
}

tests/WikipediaTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
class WikipediaTest extends PHPUnit_Framework_TestCase
3+
{
4+
public function testOne()
5+
{
6+
$info = Embed\Embed::create('https://en.wikipedia.org/wiki/Albert_Einstein');
7+
8+
$this->assertEquals($info->title, 'Albert Einstein');
9+
$this->assertEquals($info->description, "Albert Einstein (/ˈælbərt ˈaɪnʃtaɪn/; German: [ˈalbɐrt ˈaɪnʃtaɪn]; 14 March 1879&#160;– 18 April 1955) was a German-born theoretical physicist. He developed the general theory of relativity, one of the two pillars of modern physics (alongside quantum mechanics). Einstein's work is also known for its influence on the philosophy of science. Einstein is best known in popular culture for his mass–energy equivalence formula E = mc2 (which has been dubbed \"the world's most famous equation\"). He received the 1921 Nobel Prize in Physics for his \"services to theoretical physics\", in particular his discovery of the law of the photoelectric effect, a pivotal step in the evolution of quantum theory.\nNear the beginning of his career, Einstein thought that Newtonian mechanics was no longer enough...");
10+
$this->assertEquals($info->imageWidth, 3250);
11+
$this->assertEquals($info->imageHeight, 4333);
12+
$this->assertEquals($info->type, 'link');
13+
$this->assertEquals($info->providerName, 'Wikipedia');
14+
$this->assertEquals($info->providerUrl, 'https://wikipedia.org');
15+
}
16+
}

0 commit comments

Comments
 (0)