-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from mybuilder/php-8
Update to PHP8
- Loading branch information
Showing
15 changed files
with
96 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Test | ||
|
||
on: [push] | ||
|
||
jobs: | ||
run: | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: [ubuntu-latest] | ||
php-versions: ['7.4', '8.1'] | ||
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} | ||
steps: | ||
# —— Setup Github actions 🐙 ————————————————————————————————————————————— | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
# https://github.com/shivammathur/setup-php (community) | ||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: mbstring, xml, ctype, iconv, intl | ||
coverage: xdebug #optional | ||
|
||
# https://github.com/marketplace/actions/setup-php-action#problem-matchers | ||
- name: Setup problem matchers for PHP | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
|
||
# https://github.com/marketplace/actions/setup-php-action#problem-matchers | ||
- name: Setup problem matchers for PHPUnit | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
|
||
# —— Composer 🧙️ ————————————————————————————————————————————————————————— | ||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
# Use composer.json for key, if composer.lock is not committed. | ||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
key: ${{ runner.os }}-composer-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer-${{ matrix.php-versions }}- | ||
|
||
- name: Validate Composer.json | ||
run: composer validate | ||
|
||
- name: Install Composer dependencies | ||
run: composer update --no-progress --no-suggest --prefer-dist --optimize-autoloader | ||
|
||
## —— Test ✅ ——————————————————————————————————————————————————————————— | ||
- name: Run Tests | ||
run: php bin/phpunit --coverage-text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
/bin/ | ||
/build/ | ||
composer.lock | ||
composer.json.old | ||
phpunit.xml | ||
.phpunit.result.cache |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,4 @@ | |
*/ | ||
class WhenIWorkApiException extends \RuntimeException | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -287,5 +287,4 @@ public function setUpdatedAt(DateTime $updatedAt = null): void | |
{ | ||
$this->updatedAt = $updatedAt; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -495,5 +495,4 @@ public function setCreatedAt($createdAt): void | |
{ | ||
$this->createdAt = $createdAt; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,5 +27,4 @@ public function findAll() | |
|
||
return $this->deserializeModel($usersRaw, 'ArrayCollection<'. User::class .'>'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,16 +6,19 @@ | |
use GuzzleHttp\Client; | ||
use GuzzleHttp\Exception\BadResponseException; | ||
use GuzzleHttp\Psr7\Request; | ||
use GuzzleHttp\Psr7\Response; | ||
use Mockery; | ||
use MyBuilder\Library\WhenIWork\Exception\WhenIWorkApiException; | ||
use MyBuilder\Library\WhenIWork\Service\WhenIWorkApi; | ||
use GuzzleHttp\Psr7\Stream; | ||
use PHPUnit\Framework\TestCase; | ||
use Psr\Http\Message\ResponseInterface; | ||
|
||
/** | ||
* @group unit | ||
* @coversDefaultClass \MyBuilder\Library\WhenIWork\Service\WhenIWorkApi | ||
*/ | ||
class WhenIWorkApiTest extends \PHPUnit_Framework_TestCase | ||
class WhenIWorkApiTest extends TestCase | ||
{ | ||
private const DEVELOPER_KEY = '12345'; | ||
private const USERNAME = '[email protected]'; | ||
|
@@ -37,9 +40,9 @@ class WhenIWorkApiTest extends \PHPUnit_Framework_TestCase | |
*/ | ||
private $request; | ||
|
||
public function setUp() | ||
public function setUp(): void | ||
{ | ||
$this->request = Mockery::mock('GuzzleHttp\Psr7\Message\Request'); | ||
$this->request = Mockery::mock(ResponseInterface::class); | ||
$this->guzzleClient = Mockery::mock(Client::class); | ||
|
||
$this->whenIWorkApi = new WhenIWorkApi( | ||
|
@@ -60,7 +63,7 @@ public function test_setup_and_exception_from_guzzle_client(): void | |
array('headers' => array('W-Token' => self::TOKEN)) | ||
) | ||
->once() | ||
->andThrow(new BadResponseException('', new Request('GET', 'foo'))); | ||
->andThrow(new BadResponseException('', new Request('GET', 'foo'), new Response())); | ||
|
||
$this->expectException(WhenIWorkApiException::class); | ||
$this->whenIWorkApi->usersListingUsers(); | ||
|