Skip to content

Commit

Permalink
Merge pull request #79 from edbizarro/feature/twitter-gallery-card-de…
Browse files Browse the repository at this point in the history
…precated

twitter gallery card deprecated warning
  • Loading branch information
vinicius73 authored Oct 27, 2016
2 parents cb9675c + f71d995 commit 6cdd178
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/SEOTools/TwitterCards.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(array $defaults = [])

/**
* @param bool $minify
*
*
* @return string
*/
public function generate($minify = false)
Expand Down Expand Up @@ -150,6 +150,8 @@ public function setUrl($url)
* @param string|array $image
*
* @return TwitterCardsContract
*
* @deprecated use setImage($image) instead
*/
public function addImage($image)
{
Expand All @@ -164,11 +166,22 @@ public function addImage($image)
* @param string|array $images
*
* @return TwitterCardsContract
*
* @deprecated use setImage($image) instead
*/
public function setImages($images)
{
$this->images = [];

return $this->addImage($images);
}

/**
* @param $image
* @return TwitterCardsContract
*/
public function setImage($image)
{
return $this->addValue('image', $image);
}
}
11 changes: 10 additions & 1 deletion tests/SEOTools/TwitterCardsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function test_set_type()
$this->setRightAssertion($expected);
}

public function test_set_image()
public function test_set_images()
{
$this->twitterCards->setImages(['sayajin.png', 'namekusei.png']);

Expand All @@ -79,6 +79,15 @@ public function test_set_image()
$this->setRightAssertion($expected);
}

public function test_set_image()
{
$this->twitterCards->setImage('sayajin.png');

$expected = "<meta name=\"twitter:image\" content=\"sayajin.png\" />";

$this->setRightAssertion($expected);
}

/**
* @param $expectedString
*/
Expand Down

0 comments on commit 6cdd178

Please sign in to comment.