Skip to content

Commit 46e1980

Browse files
committed
bugfixes, added test for tumblr redirect
1 parent 28e14bf commit 46e1980

File tree

7 files changed

+20
-15
lines changed

7 files changed

+20
-15
lines changed

src/Adapters/Howcast.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ public function getCode()
2828
$this->width = null;
2929
$this->height = null;
3030

31-
$dom = $this->getResponse()->getHtmlContent();
31+
if (!($dom = $this->getResponse()->getHtmlContent())) {
32+
return;
33+
}
34+
3235
// #embedModal textarea
3336
$textarea = Utils::xpathQuery($dom, "descendant-or-self::*[@id = 'embedModal']/descendant-or-self::*/textarea");
3437

src/Providers/OEmbed/DOM.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static function create(Adapter $adapter)
3232
*
3333
* @param Response $response
3434
*/
35-
public function __construct(Response $response)
35+
protected function __construct(Response $response)
3636
{
3737
$this->response = $response;
3838
}

src/Providers/OEmbed/Embedly.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static function create(Adapter $adapter)
2929
* @param Response $response
3030
* @param string $key
3131
*/
32-
private function __construct(Response $response, $key)
32+
protected function __construct(Response $response, $key)
3333
{
3434
$this->response = $response;
3535
$this->key = $key;

src/Providers/OEmbed/EndPoint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static function create(Adapter $adapter)
3232
*
3333
* @param Response $response
3434
*/
35-
private function __construct(Response $response)
35+
protected function __construct(Response $response)
3636
{
3737
$this->response = $response;
3838
}

src/Providers/OEmbed/Iframely.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static function create(Adapter $adapter)
2929
* @param Response $response
3030
* @param string $key
3131
*/
32-
private function __construct(Response $response, $key)
32+
protected function __construct(Response $response, $key)
3333
{
3434
$this->response = $response;
3535
$this->key = $key;

src/Providers/OEmbed/Tumblr.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,12 @@ class Tumblr extends EndPoint implements EndPointInterface
2020
public static function create(Adapter $adapter)
2121
{
2222
$response = $adapter->getResponse();
23+
2324
if ($response->getStartingUrl()->match(static::$pattern)) {
2425
return new static($response);
2526
}
2627
}
2728

28-
/**
29-
* Constructor.
30-
*
31-
* @param Response $response
32-
*/
33-
private function __construct(Response $response)
34-
{
35-
$this->response = $response;
36-
}
37-
3829
/**
3930
* {@inheritdoc}
4031
*/

tests/TumblrTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,15 @@ public function testOne()
1616
]
1717
);
1818
}
19+
20+
public function testRedirect()
21+
{
22+
$this->assertEmbed(
23+
'https://t.umblr.com/redirect?z=https%3A%2F%2Fcm.engineering%2Fhow-to-test-accessibility-of-emails-b68fed03f5f4&t=YmJlOWJlMDE2MTBhNjgzMGQ3OWI4YjcyYTc3ZGVmODVlMjQxZWU0OCxEMHp1MXlSVg%3D%3D&b=t%3ABS0dIKxiGtP4rIANih2MqA&p=http%3A%2F%2Ftoday.uxdesign.cc%2Fpost%2F174967774408%2Fhow-to-test-accessibility-of-emails',
24+
[
25+
'title' => 'How to test accessibility of emails – Campaign Monitor Engineering',
26+
'url' => 'https://cm.engineering/how-to-test-accessibility-of-emails-b68fed03f5f4',
27+
]
28+
);
29+
}
1930
}

0 commit comments

Comments
 (0)