Skip to content

Commit

Permalink
Merge pull request #44 from christophrumpel/feature/updateDependencies
Browse files Browse the repository at this point in the history
Update dependencies and only support Laravel 5.7
  • Loading branch information
Christoph Rumpel committed Nov 7, 2018
2 parents cda6275 + 1c30c88 commit 6f7b291
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 24 deletions.
3 changes: 2 additions & 1 deletion .styleci.yml
@@ -1,3 +1,4 @@
preset: laravel

linting: true
disabled:
- single_class_element_per_statement
11 changes: 6 additions & 5 deletions composer.json
Expand Up @@ -13,15 +13,16 @@
],
"require": {
"php": ">=5.6.4",
"abraham/twitteroauth": "^0.7.2",
"illuminate/notifications": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*",
"illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*",
"abraham/twitteroauth": "^0.9.2",
"illuminate/notifications": "5.7.*",
"illuminate/support": "5.7.*",
"kylewm/brevity": "^0.2.9"
},

"require-dev": {
"mockery/mockery": "^1.0",
"phpunit/phpunit": "5.*",
"orchestra/testbench": "~3.3|~3.4"
"phpunit/phpunit": "^7.3",
"orchestra/testbench": "~3.7"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Expand Up @@ -22,7 +22,7 @@
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-html" target="build/coverage" />
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
Expand Down
1 change: 1 addition & 0 deletions src/TwitterStatusUpdate.php
Expand Up @@ -34,6 +34,7 @@ public function __construct($content)
if ($exceededLength = $this->messageIsTooLong($content, new Brevity())) {
throw CouldNotSendNotification::statusUpdateTooLong($exceededLength);
}

$this->content = $content;
}

Expand Down
19 changes: 19 additions & 0 deletions tests/TestCase.php
@@ -0,0 +1,19 @@
<?php

namespace NotificationChannels\Twitter\Test;

use Mockery;

abstract class TestCase extends \Orchestra\Testbench\TestCase
{
public function tearDown()
{
parent::tearDown();

if ($container = \Mockery::getContainer()) {
$this->addToAssertionCount($container->mockery_getExpectationCount());
}

Mockery::close();
}
}
9 changes: 1 addition & 8 deletions tests/TwitterChannelTest.php
Expand Up @@ -4,7 +4,6 @@

use Mockery;
use stdClass;
use Orchestra\Testbench\TestCase;
use Abraham\TwitterOAuth\TwitterOAuth;
use Illuminate\Notifications\Notification;
use NotificationChannels\Twitter\TwitterChannel;
Expand All @@ -26,12 +25,6 @@ public function setUp()
$this->channel = new TwitterChannel($this->twitter);
}

public function tearDown()
{
Mockery::close();
parent::tearDown();
}

/** @test */
public function it_can_send_a_status_update_notification()
{
Expand Down Expand Up @@ -77,7 +70,7 @@ public function it_throws_an_exception_when_it_could_not_send_the_notification()

$this->twitter->shouldReceive('getLastBody')->once()->andReturn($twitterResponse);

$this->setExpectedException(CouldNotSendNotification::class);
$this->expectException(CouldNotSendNotification::class);

$this->channel->send(new TestNotifiable(), new TestNotification());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/TwitterDirectMessageTest.php
Expand Up @@ -4,7 +4,7 @@

use NotificationChannels\Twitter\TwitterDirectMessage;

class TwitterDirectMessageTest extends \PHPUnit_Framework_TestCase
class TwitterDirectMessageTest extends TestCase
{
/** @var TwitterDirectMessage */
protected $message;
Expand Down
1 change: 0 additions & 1 deletion tests/TwitterImageTest.php
Expand Up @@ -2,7 +2,6 @@

namespace NotificationChannels\Twitter\Test;

use Orchestra\Testbench\TestCase;
use NotificationChannels\Twitter\TwitterImage;

class TwitterImageTest extends TestCase
Expand Down
13 changes: 6 additions & 7 deletions tests/TwitterStatusUpdateTest.php
Expand Up @@ -6,7 +6,7 @@
use NotificationChannels\Twitter\TwitterStatusUpdate;
use NotificationChannels\Twitter\Exceptions\CouldNotSendNotification;

class TwitterStatusUpdateTest extends \PHPUnit_Framework_TestCase
class TwitterStatusUpdateTest extends TestCase
{
/** @var TwitterStatusUpdate */
protected $message;
Expand Down Expand Up @@ -64,8 +64,7 @@ public function it_constructs_a_request_body()
/** @test */
public function it_throws_an_exception_when_the_status_update_is_too_long()
{
$tooLongMessage = 'Laravel Notification Channels are awesome and this message is far too long for a Twitter
status update and this is why an exception is thrown!';
$tooLongMessage = 'This is a super intensive long new Twitter status message which includes some super useful and concrete information about an upcoming package test that will check if a certain Twitter message may be too long in the case that the character count is higher than specific prior defined count.';

try {
$statusUpdate = new TwitterStatusUpdate($tooLongMessage);
Expand All @@ -77,21 +76,21 @@ public function it_throws_an_exception_when_the_status_update_is_too_long()
/** @test */
public function it_provides_exceeded_message_count_when_the_status_update_is_too_long()
{
$tooLongMessage = 'Laravel Notification Channels are awesome and this message is far too long for a Twitter status update because of this URL https://github.com/laravel-notification-channels';
$tooLongMessage = 'This is a super intensive long new Twitter status message which includes some super useful and concrete information about an upcoming package test that will check if a certain Twitter message may be too long in the case that the character count is higher than specific prior define count.';

try {
$statusUpdate = new TwitterStatusUpdate($tooLongMessage);
} catch (CouldNotSendNotification $e) {
$this->assertEquals("Couldn't post Notification, because the status message was too long by 6 character(s).",
$this->assertEquals("Couldn't post Notification, because the status message was too long by 8 character(s).",
$e->getMessage());
}

$anotherTooLongMessage = 'Laravel Notification Channels are awesome and this message is just in length so that Twitter does not complain!!!!!!! https://github.com/laravel-notification-channels';
$anotherTooLongMessage = 'This is a super intensive long new Twitter status message which includes some super useful and concrete information about an upcoming package test that will check if a certain Twitter message may be too long in the case that the character count is higher than specific prior define count!!';

try {
$statusUpdate = new TwitterStatusUpdate($anotherTooLongMessage);
} catch (CouldNotSendNotification $e) {
$this->assertEquals("Couldn't post Notification, because the status message was too long by 1 character(s).",
$this->assertEquals("Couldn't post Notification, because the status message was too long by 9 character(s).",
$e->getMessage());
}
}
Expand Down

0 comments on commit 6f7b291

Please sign in to comment.