Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
Sorry it was late, I forgot to commit these in the previous release :(
  • Loading branch information
Van Hocht, Joren authored and Van Hocht, Joren committed May 18, 2018
1 parent 10cb82a commit 0e6bd0c
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 33 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ All Notable changes to `laravel-share` will be documented in this file
- Add support for Font Awesome 5, next to Font Awesome 4. PR #16

## 2.0.1 - 2018-05-18
- Urlencode optional title & message parameters (Fixes issue #23)
- Urlencode optional title & message parameters (Fixes issue #23)

## 2.0.2 - 2018-05-18
- Adapt tests to changed responses with urlencoded title & message parameters
22 changes: 14 additions & 8 deletions tests/CombinedShareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public function it_can_generate_generate_multiple_share_links_at_once()
->twitter()
->linkedin()
->googlePlus();
$expected = '<div id="social-links"><ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button " id=""><span class="fa fa-facebook-official"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My share title&url=https://codeswitch.be" class="social-button " id=""><span class="fa fa-twitter"></span></a></li><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=My share title&summary=" class="social-button " id=""><span class="fa fa-linkedin"></span></a></li><li><a href="https://plus.google.com/share?url=https://codeswitch.be" class="social-button " id=""><span class="fa fa-google-plus"></span></a></li></ul></div>';

$expected = '<div id="social-links"><ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button " id=""><span class="fa fa-facebook-official"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My+share+title&url=https://codeswitch.be" class="social-button " id=""><span class="fa fa-twitter"></span></a></li><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=My+share+title&summary=" class="social-button " id=""><span class="fa fa-linkedin"></span></a></li><li><a href="https://plus.google.com/share?url=https://codeswitch.be" class="social-button " id=""><span class="fa fa-google-plus"></span></a></li></ul></div>';

$this->assertEquals($expected, $result);
}
Expand All @@ -32,7 +33,8 @@ public function it_can_generate_generate_multiple_share_links_at_once_with_fa5()
->twitter()
->linkedin()
->googlePlus();
$expected = '<div id="social-links"><ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button " id=""><span class="fab fa-facebook-square"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My share title&url=https://codeswitch.be" class="social-button " id=""><span class="fab fa-twitter"></span></a></li><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=My share title&summary=" class="social-button " id=""><span class="fab fa-linkedin"></span></a></li><li><a href="https://plus.google.com/share?url=https://codeswitch.be" class="social-button " id=""><span class="fab fa-google-plus-g"></span></a></li></ul></div>';

$expected = '<div id="social-links"><ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button " id=""><span class="fab fa-facebook-square"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My+share+title&url=https://codeswitch.be" class="social-button " id=""><span class="fab fa-twitter"></span></a></li><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=My+share+title&summary=" class="social-button " id=""><span class="fab fa-linkedin"></span></a></li><li><a href="https://plus.google.com/share?url=https://codeswitch.be" class="social-button " id=""><span class="fab fa-google-plus-g"></span></a></li></ul></div>';

$this->assertEquals($expected, $result);
}
Expand All @@ -47,14 +49,15 @@ public function it_can_generate_multiple_share_links_at_once_and_multiple_times_
->twitter()
->linkedin()
->googlePlus();
$expected = '<div id="social-links"><ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button " id=""><span class="fa fa-facebook-official"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My share title&url=https://codeswitch.be" class="social-button " id=""><span class="fa fa-twitter"></span></a></li><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=My share title&summary=" class="social-button " id=""><span class="fa fa-linkedin"></span></a></li><li><a href="https://plus.google.com/share?url=https://codeswitch.be" class="social-button " id=""><span class="fa fa-google-plus"></span></a></li></ul></div>';
$expected = '<div id="social-links"><ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button " id=""><span class="fa fa-facebook-official"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My+share+title&url=https://codeswitch.be" class="social-button " id=""><span class="fa fa-twitter"></span></a></li><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=My+share+title&summary=" class="social-button " id=""><span class="fa fa-linkedin"></span></a></li><li><a href="https://plus.google.com/share?url=https://codeswitch.be" class="social-button " id=""><span class="fa fa-google-plus"></span></a></li></ul></div>';

$this->assertEquals($expected, $result);

$result = ShareFacade::page('https://codeswitch.be', 'My share title')
->facebook()
->twitter();
$expected = '<div id="social-links"><ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button " id=""><span class="fa fa-facebook-official"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My share title&url=https://codeswitch.be" class="social-button " id=""><span class="fa fa-twitter"></span></a></li></ul></div>';

$expected = '<div id="social-links"><ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button " id=""><span class="fa fa-facebook-official"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My+share+title&url=https://codeswitch.be" class="social-button " id=""><span class="fa fa-twitter"></span></a></li></ul></div>';

$this->assertEquals($expected, $result);
}
Expand All @@ -70,14 +73,15 @@ public function it_can_generate_multiple_share_links_at_once_and_multiple_times_
->twitter()
->linkedin()
->googlePlus();
$expected = '<div id="social-links"><ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button " id=""><span class="fab fa-facebook-square"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My share title&url=https://codeswitch.be" class="social-button " id=""><span class="fab fa-twitter"></span></a></li><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=My share title&summary=" class="social-button " id=""><span class="fab fa-linkedin"></span></a></li><li><a href="https://plus.google.com/share?url=https://codeswitch.be" class="social-button " id=""><span class="fab fa-google-plus-g"></span></a></li></ul></div>';
$expected = '<div id="social-links"><ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button " id=""><span class="fab fa-facebook-square"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My+share+title&url=https://codeswitch.be" class="social-button " id=""><span class="fab fa-twitter"></span></a></li><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=My+share+title&summary=" class="social-button " id=""><span class="fab fa-linkedin"></span></a></li><li><a href="https://plus.google.com/share?url=https://codeswitch.be" class="social-button " id=""><span class="fab fa-google-plus-g"></span></a></li></ul></div>';

$this->assertEquals($expected, $result);

$result = ShareFacade::page('https://codeswitch.be', 'My share title')
->facebook()
->twitter();
$expected = '<div id="social-links"><ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button " id=""><span class="fab fa-facebook-square"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My share title&url=https://codeswitch.be" class="social-button " id=""><span class="fab fa-twitter"></span></a></li></ul></div>';

$expected = '<div id="social-links"><ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button " id=""><span class="fab fa-facebook-square"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My+share+title&url=https://codeswitch.be" class="social-button " id=""><span class="fab fa-twitter"></span></a></li></ul></div>';

$this->assertEquals($expected, $result);
}
Expand All @@ -90,7 +94,8 @@ public function it_can_generate_generate_multiple_share_links_at_once_with_extra
$result = ShareFacade::page('https://codeswitch.be', 'My share title', ['class' => 'my-class', 'id' => 'my-id'], '<ul>', '</ul>')
->facebook()
->twitter();
$expected = '<ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button my-class" id="my-id"><span class="fa fa-facebook-official"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My share title&url=https://codeswitch.be" class="social-button my-class" id="my-id"><span class="fa fa-twitter"></span></a></li></ul>';

$expected = '<ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button my-class" id="my-id"><span class="fa fa-facebook-official"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My+share+title&url=https://codeswitch.be" class="social-button my-class" id="my-id"><span class="fa fa-twitter"></span></a></li></ul>';

$this->assertEquals($expected, $result);
}
Expand All @@ -104,7 +109,8 @@ public function it_can_generate_generate_multiple_share_links_at_once_with_extra
$result = ShareFacade::page('https://codeswitch.be', 'My share title', ['class' => 'my-class', 'id' => 'my-id'], '<ul>', '</ul>')
->facebook()
->twitter();
$expected = '<ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button my-class" id="my-id"><span class="fab fa-facebook-square"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My share title&url=https://codeswitch.be" class="social-button my-class" id="my-id"><span class="fab fa-twitter"></span></a></li></ul>';

$expected = '<ul><li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codeswitch.be" class="social-button my-class" id="my-id"><span class="fab fa-facebook-square"></span></a></li><li><a href="https://twitter.com/intent/tweet?text=My+share+title&url=https://codeswitch.be" class="social-button my-class" id="my-id"><span class="fab fa-twitter"></span></a></li></ul>';

$this->assertEquals($expected, $result);
}
Expand Down
20 changes: 10 additions & 10 deletions tests/LinkedInShareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class LinkedinShareTest extends TestCase
public function it_can_generate_a_linkedin_share_link()
{
$result = ShareFacade::page('https://codeswitch.be', 'Title')->linkedin('A summary can be passed here');
$expected = '<div id="social-links"><ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A summary can be passed here" class="social-button " id=""><span class="fa fa-linkedin"></span></a></li></ul></div>';
$expected = '<div id="social-links"><ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A+summary+can+be+passed+here" class="social-button " id=""><span class="fa fa-linkedin"></span></a></li></ul></div>';

$this->assertEquals($expected, $result);
}
Expand All @@ -24,7 +24,7 @@ public function it_can_generate_a_linkedin_share_link_with_fa5()
{
config(['laravel-share.fontAwesomeVersion' => 5]);
$result = ShareFacade::page('https://codeswitch.be', 'Title')->linkedin('A summary can be passed here');
$expected = '<div id="social-links"><ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A summary can be passed here" class="social-button " id=""><span class="fab fa-linkedin"></span></a></li></ul></div>';
$expected = '<div id="social-links"><ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A+summary+can+be+passed+here" class="social-button " id=""><span class="fab fa-linkedin"></span></a></li></ul></div>';

$this->assertEquals($expected, $result);
}
Expand Down Expand Up @@ -59,7 +59,7 @@ public function it_can_generate_a_linkedin_share_link_with_a_custom_class()
{
$result = ShareFacade::page('https://codeswitch.be', 'Title', ['class' => 'my-class'])
->linkedin('A summary can be passed here');
$expected = '<div id="social-links"><ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A summary can be passed here" class="social-button my-class" id=""><span class="fa fa-linkedin"></span></a></li></ul></div>';
$expected = '<div id="social-links"><ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A+summary+can+be+passed+here" class="social-button my-class" id=""><span class="fa fa-linkedin"></span></a></li></ul></div>';

$this->assertEquals($expected, $result);
}
Expand All @@ -72,7 +72,7 @@ public function it_can_generate_a_linkedin_share_link_with_a_custom_class_with_f
config(['laravel-share.fontAwesomeVersion' => 5]);
$result = ShareFacade::page('https://codeswitch.be', 'Title', ['class' => 'my-class'])
->linkedin('A summary can be passed here');
$expected = '<div id="social-links"><ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A summary can be passed here" class="social-button my-class" id=""><span class="fab fa-linkedin"></span></a></li></ul></div>';
$expected = '<div id="social-links"><ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A+summary+can+be+passed+here" class="social-button my-class" id=""><span class="fab fa-linkedin"></span></a></li></ul></div>';

$this->assertEquals($expected, $result);
}
Expand All @@ -84,7 +84,7 @@ public function it_can_generate_a_linkedin_share_link_with_a_custom_class_and_cu
{
$result = ShareFacade::page('https://codeswitch.be', 'Title', ['class' => 'my-class', 'id' => 'my-id'])
->linkedin('A summary can be passed here');
$expected = '<div id="social-links"><ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A summary can be passed here" class="social-button my-class" id="my-id"><span class="fa fa-linkedin"></span></a></li></ul></div>';
$expected = '<div id="social-links"><ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A+summary+can+be+passed+here" class="social-button my-class" id="my-id"><span class="fa fa-linkedin"></span></a></li></ul></div>';

$this->assertEquals($expected, $result);
}
Expand All @@ -97,7 +97,7 @@ public function it_can_generate_a_linkedin_share_link_with_a_custom_class_and_cu
config(['laravel-share.fontAwesomeVersion' => 5]);
$result = ShareFacade::page('https://codeswitch.be', 'Title', ['class' => 'my-class', 'id' => 'my-id'])
->linkedin('A summary can be passed here');
$expected = '<div id="social-links"><ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A summary can be passed here" class="social-button my-class" id="my-id"><span class="fab fa-linkedin"></span></a></li></ul></div>';
$expected = '<div id="social-links"><ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A+summary+can+be+passed+here" class="social-button my-class" id="my-id"><span class="fab fa-linkedin"></span></a></li></ul></div>';

$this->assertEquals($expected, $result);
}
Expand All @@ -109,7 +109,7 @@ public function it_can_generate_a_linkedin_share_link_with_custom_prefix_and_suf
{
$result = ShareFacade::page('https://codeswitch.be', 'Title', [], '<ul>', '</ul>')
->linkedin('A summary can be passed here');
$expected = '<ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A summary can be passed here" class="social-button " id=""><span class="fa fa-linkedin"></span></a></li></ul>';
$expected = '<ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A+summary+can+be+passed+here" class="social-button " id=""><span class="fa fa-linkedin"></span></a></li></ul>';

$this->assertEquals($expected, $result);
}
Expand All @@ -122,7 +122,7 @@ public function it_can_generate_a_linkedin_share_link_with_custom_prefix_and_suf
config(['laravel-share.fontAwesomeVersion' => 5]);
$result = ShareFacade::page('https://codeswitch.be', 'Title', [], '<ul>', '</ul>')
->linkedin('A summary can be passed here');
$expected = '<ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A summary can be passed here" class="social-button " id=""><span class="fab fa-linkedin"></span></a></li></ul>';
$expected = '<ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A+summary+can+be+passed+here" class="social-button " id=""><span class="fab fa-linkedin"></span></a></li></ul>';

$this->assertEquals($expected, $result);
}
Expand All @@ -134,7 +134,7 @@ public function it_can_generate_a_linkedin_share_link_with_all_extra_options()
{
$result = ShareFacade::page('https://codeswitch.be', 'Title', ['class' => 'my-class my-class2', 'id' => 'linkedin-share'], '<ul>', '</ul>')
->linkedin('A summary can be passed here');
$expected = '<ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A summary can be passed here" class="social-button my-class my-class2" id="linkedin-share"><span class="fa fa-linkedin"></span></a></li></ul>';
$expected = '<ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A+summary+can+be+passed+here" class="social-button my-class my-class2" id="linkedin-share"><span class="fa fa-linkedin"></span></a></li></ul>';

$this->assertEquals($expected, $result);
}
Expand All @@ -147,7 +147,7 @@ public function it_can_generate_a_linkedin_share_link_with_all_extra_options_wit
config(['laravel-share.fontAwesomeVersion' => 5]);
$result = ShareFacade::page('https://codeswitch.be', 'Title', ['class' => 'my-class my-class2', 'id' => 'linkedin-share'], '<ul>', '</ul>')
->linkedin('A summary can be passed here');
$expected = '<ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A summary can be passed here" class="social-button my-class my-class2" id="linkedin-share"><span class="fab fa-linkedin"></span></a></li></ul>';
$expected = '<ul><li><a href="http://www.linkedin.com/shareArticle?mini=true&url=https://codeswitch.be&title=Title&summary=A+summary+can+be+passed+here" class="social-button my-class my-class2" id="linkedin-share"><span class="fab fa-linkedin"></span></a></li></ul>';

$this->assertEquals($expected, $result);
}
Expand Down
Loading

0 comments on commit 0e6bd0c

Please sign in to comment.