Skip to content

Commit

Permalink
Bump mockery, phpunit for 7.4 (#25)
Browse files Browse the repository at this point in the history
* Support PHP 7.2+ only (Travis)
* Drop support for old PHP, HHVM
* more fixes for changes and deprecations in phpunit
  • Loading branch information
wohali committed Jun 12, 2020
1 parent 42a6ba7 commit 0dcb505
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ composer.phar
coveralls.phar
test/log
vendor/
.phpunit.result.cache
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ sudo: false

matrix:
include:
- php: 5.6
env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest"'
- php: 7.0
- php: 7.1
- php: 7.2
- php: 7.3
- php: 7.4
Expand All @@ -19,7 +15,7 @@ matrix:

before_script:
- travis_retry composer self-update
- travis_retry composer install --no-interaction --prefer-source --dev
- travis_retry composer install --no-interaction --prefer-source
- travis_retry phpenv rehash

script:
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ This package provides Discord OAuth 2.0 support for the PHP League's [OAuth 2.0

The following versions of PHP are supported.

* PHP 5.6
* PHP 7.0
* PHP 7.1
* PHP 7.2
* HHVM
* PHP 7.3
* PHP 7.4

## Installation

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
"league/oauth2-client": "^2.0"
},
"require-dev": {
"phpunit/phpunit": "^5.0",
"mockery/mockery": "~0.9",
"phpunit/phpunit": "~8.0",
"mockery/mockery": "~1.3.0",
"squizlabs/php_codesniffer": "^2.0",
"jakub-onderka/php-parallel-lint": "~0.9"
"php-parallel-lint/php-parallel-lint": "~0.9"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 0 additions & 3 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<logging>
<log type="coverage-html"
target="./build/coverage/html"
charset="UTF-8"
highlight="false"
lowUpperBound="35"
highLowerBound="70"/>
<log type="coverage-clover"
Expand Down
12 changes: 5 additions & 7 deletions test/src/Provider/DiscordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
use League\OAuth2\Client\Tool\QueryBuilderTrait;
use Mockery as m;

class DiscordTest extends \PHPUnit_Framework_TestCase
class DiscordTest extends \PHPUnit\Framework\TestCase
{
use QueryBuilderTrait;

protected $provider;

protected function setUp()
protected function setUp(): void
{
$this->provider = new \Wohali\OAuth2\Client\Provider\Discord([
'clientId' => 'mock_client_id',
Expand All @@ -18,7 +18,7 @@ protected function setUp()
]);
}

public function tearDown()
public function tearDown(): void
{
m::close();
parent::tearDown();
Expand Down Expand Up @@ -46,7 +46,7 @@ public function testScopes()
$query = ['scope' => implode($scopeSeparator, $options['scope'])];
$url = $this->provider->getAuthorizationUrl($options);
$encodedScope = $this->buildQueryString($query);
$this->assertContains($encodedScope, $url);
$this->assertStringContainsString($encodedScope, $url);
}

public function testGetAuthorizationUrl()
Expand Down Expand Up @@ -127,11 +127,9 @@ public function testUserData()
$this->assertEquals(true, $user->toArray()['verified']);
}

/**
* @expectedException League\OAuth2\Client\Provider\Exception\IdentityProviderException
**/
public function testExceptionThrownErrorObjectReceived()
{
$this->expectException(\League\OAuth2\Client\Provider\Exception\IdentityProviderException::class);
$status = rand(400,600);
$postResponse = m::mock('Psr\Http\Message\ResponseInterface');
$postResponse->shouldReceive('getBody')->andReturn('{"client_id": ["This field is required"]}');
Expand Down

0 comments on commit 0dcb505

Please sign in to comment.