forked from chrisbjr/api-guard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
130 additions
and
4 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,55 @@ | ||
name: run-tests | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
test: | ||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository | ||
timeout-minutes: 15 | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
php: [7.2, 7.3, 7.4] | ||
dependency-version: [prefer-lowest, prefer-stable] | ||
os: [ubuntu-latest, windows-latest] | ||
|
||
name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.composer/cache/files | ||
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} | ||
restore-keys: | | ||
dependencies-php-${{ matrix.php }}-composer- | ||
dependencies-php- | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: json, dom, curl, libxml, mbstring | ||
coverage: none | ||
|
||
- name: Install dependencies | ||
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest | ||
|
||
- name: Execute tests | ||
run: vendor/bin/phpunit | ||
|
||
- name: Send Slack notification | ||
uses: 8398a7/action-slack@v2 | ||
if: failure() && github.ref == 'refs/heads/master' | ||
with: | ||
status: ${{ job.status }} | ||
author_name: ${{ github.actor }} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "chrisbjr/api-guard", | ||
"name": "expanse/api-guard", | ||
"description": "A simple way of authenticating your APIs with API keys using Laravel", | ||
"keywords": [ | ||
"api", | ||
|
@@ -9,8 +9,12 @@ | |
"api authentication", | ||
"laravel" | ||
], | ||
"homepage": "https://github.com/chrisbjr/api-guard", | ||
"homepage": "https://github.com/expanse/api-guard", | ||
"authors": [ | ||
{ | ||
"name": "Glen Solsberry", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Chris Bautista", | ||
"email": "[email protected]" | ||
|
@@ -27,11 +31,13 @@ | |
"ellipsesynergie/api-response": "*" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^4.0 || ^5.0 || ^8.0" | ||
"phpunit/phpunit": "^4.0 || ^5.0 || ^8.0", | ||
"orchestra/testbench": "^4.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Chrisbjr\\ApiGuard\\": "src" | ||
"Chrisbjr\\ApiGuard\\": "src", | ||
"Chrisbjr\\ApiGuard\\Tests\\": "tests" | ||
} | ||
}, | ||
"minimum-stability": "stable" | ||
|
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,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
verbose="true"> | ||
<testsuites> | ||
<testsuite name="ApiGuard Test Suite"> | ||
<directory suffix="Test.php">./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<php> | ||
<env name="DB_CONNECTION" value="testing"/> | ||
<env name="APP_ENV" value="testing"/> | ||
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/> | ||
</php> | ||
</phpunit> |
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,11 @@ | ||
<?php | ||
|
||
namespace Chrisbjr\ApiGuard\Tests; | ||
|
||
class BaseTest extends TestCase | ||
{ | ||
public function test_first() | ||
{ | ||
$this->assertSame(1 + 1, 2); | ||
} | ||
} |
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,30 @@ | ||
<?php | ||
|
||
namespace Chrisbjr\ApiGuard\Tests; | ||
|
||
class TestCase extends \Orchestra\Testbench\TestCase | ||
{ | ||
protected function getPackageProviders($app) | ||
{ | ||
return [ | ||
\Chrisbjr\ApiGuard\Providers\ApiGuardServiceProvider::class | ||
]; | ||
} | ||
|
||
/** | ||
* Define environment setup. | ||
* | ||
* @param \Illuminate\Foundation\Application $app | ||
* @return void | ||
*/ | ||
protected function getEnvironmentSetUp($app) | ||
{ | ||
// Setup default database to use sqlite :memory: | ||
$app['config']->set('database.default', 'testbench'); | ||
$app['config']->set('database.connections.testbench', [ | ||
'driver' => 'sqlite', | ||
'database' => ':memory:', | ||
'prefix' => '', | ||
]); | ||
} | ||
} |