Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@ version: 2

updates:
# Maintain dependencies for GitHub Actions
#- package-ecosystem: "github-actions"
# directory: "/"
# schedule:
# interval: "monthly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"

# Maintain dependencies for Composer
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "monthly"

# Maintain dependencies for php-cs-fixer tool
#- package-ecosystem: "composer"
# directory: "/tools/php-cs-fixer"
# schedule:
# interval: "monthly"
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
push:
branches: [ master ]
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'

- uses: "ramsey/composer-install@v3"
with:
composer-options: "--prefer-dist"

- name: Code Sniffer
run: vendor/bin/phpcs --standard=psr2 src/

test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"

steps:
- uses: actions/checkout@v2

- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"

- uses: "ramsey/composer-install@v3"
with:
composer-options: "--prefer-dist"

- name: Run tests
run: vendor/bin/phpunit
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"require-dev": {
"mockery/mockery": "^1.3",
"squizlabs/php_codesniffer": "^3.5",
"phpunit/phpunit": ">=8.0"
"phpunit/phpunit": ">=8.0 < 10"
},
"autoload": {
"psr-4": {
Expand Down
36 changes: 18 additions & 18 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
bootstrap="vendor/autoload.php"
colors="true"
verbose="true">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
</report>
</coverage>
<testsuites>
<testsuite name="SymfonyConnect OAuth2 Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
</report>
</coverage>
<testsuites>
<testsuite name="SymfonyConnect OAuth2 Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
</phpunit>
17 changes: 13 additions & 4 deletions tests/src/Provider/SymfonyConnectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ public function testGetAccessToken()
];

$response = m::mock('Psr\Http\Message\ResponseInterface');
$response->shouldReceive('getBody')->andReturn(\json_encode($testResponse));
$stream = m::mock('Psr\Http\Message\StreamInterface');
$stream->shouldReceive('__toString')->andReturn(json_encode($testResponse));
$response->shouldReceive('getBody')->andReturn($stream);
$response->shouldReceive('getHeader')->andReturn(['content-type' => 'json']);
$response->shouldReceive('getStatusCode')->andReturn(200);
$client = m::mock('GuzzleHttp\ClientInterface');
Expand All @@ -75,11 +77,16 @@ public function testUserData()
$xml = file_get_contents(dirname(__FILE__, 3) .'/current_user_response.xml');

$postResponse = m::mock('Psr\Http\Message\ResponseInterface');
$postResponse->shouldReceive('getBody')->andReturn('{"access_token":"mock_access_token"}');
$streamPost = m::mock('Psr\Http\Message\StreamInterface');
$streamPost->shouldReceive('__toString')->andReturn('{"access_token":"mock_access_token"}');
$postResponse->shouldReceive('getBody')->andReturn($streamPost);
$postResponse->shouldReceive('getHeader')->andReturn(['content-type' => 'json']);
$postResponse->shouldReceive('getStatusCode')->andReturn(200);

$userResponse = m::mock('Psr\Http\Message\ResponseInterface');
$userResponse->shouldReceive('getBody')->andReturn($xml);
$streamUser = m::mock('Psr\Http\Message\StreamInterface');
$streamUser->shouldReceive('__toString')->andReturn($xml);
$userResponse->shouldReceive('getBody')->andReturn($streamUser);
$userResponse->shouldReceive('getHeader')->andReturn(['content-type' => 'application/vnd.com.symfony.connect+xml']);
$userResponse->shouldReceive('getStatusCode')->andReturn(200);
$client = m::mock('GuzzleHttp\ClientInterface');
Expand Down Expand Up @@ -127,7 +134,9 @@ public function testExceptionThrownWhenErrorObjectReceived()
$status = rand(400, 600);
$code = uniqid();
$postResponse = m::mock('Psr\Http\Message\ResponseInterface');
$postResponse->shouldReceive('getBody')->andReturn('{"message": "'.$message.'", "error": "'.$code.'"}');
$streamPost = m::mock('Psr\Http\Message\StreamInterface');
$streamPost->shouldReceive('__toString')->andReturn('{"message": "'.$message.'", "error": "'.$code.'"}');
$postResponse->shouldReceive('getBody')->andReturn($streamPost);
$postResponse->shouldReceive('getHeader')->andReturn(['content-type' => 'json']);
$postResponse->shouldReceive('getStatusCode')->andReturn($status);
$client = m::mock('GuzzleHttp\ClientInterface');
Expand Down