Skip to content

Commit

Permalink
Merge pull request #11 from ARCANEDEV/update-github_actions
Browse files Browse the repository at this point in the history
Using GitHub Actions for testing
  • Loading branch information
arcanedev-maroc authored Feb 1, 2020
2 parents 5fed5a6 + abf360a commit ac707a6
Show file tree
Hide file tree
Showing 28 changed files with 166 additions and 57 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
.gitattributes export-ignore
.gitignore export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
phpunit.xml.dist export-ignore
CONTRIBUTING.md export-ignore
46 changes: 46 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: run-tests

on: [push]

jobs:
tests:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [7.2, 7.3, 7.4]
laravel: [6.*]
dependency-version: [prefer-lowest, prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php }}
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv
coverage: xdebug

- name: Install dependencies
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest

- name: Execute tests
run: |
mkdir -p build/logs
vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
- name: Scrutinizer CI
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ checks:
tools:
external_code_coverage:
timeout: 600
runs: 2
runs: 6
php_code_sniffer:
enabled: true
config:
Expand Down
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# LaravelImpersonator [![Packagist License][badge_license]](LICENSE.md) [![For Laravel][badge_laravel]][link-github-repo]

[![Travis Status][badge_build]][link-travis]
[![Github Workflow Status][badge_build]][link-github-status]
[![Coverage Status][badge_coverage]][link-scrutinizer]
[![Scrutinizer Code Quality][badge_quality]][link-scrutinizer]
[![SensioLabs Insight][badge_insight]][link-insight]
Expand Down Expand Up @@ -45,7 +45,7 @@ Any ideas are welcome. Feel free to submit any issues or pull requests, please c

[badge_license]: https://img.shields.io/packagist/l/arcanedev/laravel-impersonator.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/Laravel-5.4%20to%206.x-orange.svg?style=flat-square
[badge_build]: https://img.shields.io/travis/ARCANEDEV/LaravelImpersonator.svg?style=flat-square
[badge_build]: https://img.shields.io/github/workflow/status/ARCANEDEV/LaravelImpersonator/run-tests?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/LaravelImpersonator.svg?style=flat-square
[badge_quality]: https://img.shields.io/scrutinizer/g/ARCANEDEV/LaravelImpersonator.svg?style=flat-square
[badge_insight]: https://img.shields.io/sensiolabs/i/a9bfffe8-8d21-434c-a1cc-07bbbee97cb7.svg?style=flat-square
Expand All @@ -56,9 +56,9 @@ Any ideas are welcome. Feel free to submit any issues or pull requests, please c

[link-author]: https://github.com/arcanedev-maroc
[link-github-repo]: https://github.com/ARCANEDEV/LaravelImpersonator
[link-github-status]: https://github.com/ARCANEDEV/LaravelImpersonator/actions
[link-github-issues]: https://github.com/ARCANEDEV/LaravelImpersonator/issues
[link-contributors]: https://github.com/ARCANEDEV/LaravelImpersonator/graphs/contributors
[link-packagist]: https://packagist.org/packages/arcanedev/laravel-impersonator
[link-travis]: https://travis-ci.org/ARCANEDEV/LaravelImpersonator
[link-scrutinizer]: https://scrutinizer-ci.com/g/ARCANEDEV/LaravelImpersonator/?branch=master
[link-insight]: https://insight.sensiolabs.com/projects/a9bfffe8-8d21-434c-a1cc-07bbbee97cb7
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"license": "MIT",
"require": {
"php": ">=7.2.0",
"arcanedev/support": "^5.0"
"arcanedev/support": "^5.1"
},
"require-dev": {
"orchestra/testbench": "^4.0",
Expand Down
6 changes: 5 additions & 1 deletion src/Contracts/Impersonatable.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Contracts;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Contracts;

use Illuminate\Contracts\Auth\Authenticatable;

Expand Down
6 changes: 5 additions & 1 deletion src/Contracts/Impersonator.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Contracts;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Contracts;

/**
* Interface Impersonator
Expand Down
6 changes: 5 additions & 1 deletion src/Events/AbstractImpersonationEvent.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Events;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Events;

use Arcanedev\LaravelImpersonator\Contracts\Impersonatable;
use Illuminate\Broadcasting\InteractsWithSockets;
Expand Down
6 changes: 5 additions & 1 deletion src/Events/ImpersonationStarted.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Events;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Events;

/**
* Class ImpersonationStarted
Expand Down
6 changes: 5 additions & 1 deletion src/Events/ImpersonationStopped.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Events;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Events;

/**
* Class ImpersonationEnded
Expand Down
10 changes: 7 additions & 3 deletions src/Exceptions/ImpersonationException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Exceptions;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Exceptions;

use Arcanedev\LaravelImpersonator\Contracts\Impersonatable;

Expand Down Expand Up @@ -61,7 +65,7 @@ public static function cannotImpersonate(Impersonatable $impersonater): self
*
* @return static
*/
public static function cannotBeImpersonated(Impersonatable $impersonated)
public static function cannotBeImpersonated(Impersonatable $impersonated): self
{
return static::make(
__('The impersonated with `:impersonated_name`=[:impersonated_id] cannot be impersonated.', [
Expand All @@ -76,7 +80,7 @@ public static function cannotBeImpersonated(Impersonatable $impersonated)
*
* @return static
*/
public static function impersonaterAndImpersonatedAreSame()
public static function impersonaterAndImpersonatedAreSame(): self
{
return static::make(
__('The impersonater & impersonated with must be different.')
Expand Down
6 changes: 5 additions & 1 deletion src/Guard/SessionGuard.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Guard;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Guard;

use Illuminate\Auth\SessionGuard as BaseSessionGuard;
use Illuminate\Contracts\Auth\Authenticatable;
Expand Down
6 changes: 5 additions & 1 deletion src/Http/Middleware/ImpersonationNotAllowed.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Http\Middleware;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Http\Middleware;

use Arcanedev\LaravelImpersonator\Contracts\Impersonator;
use Closure;
Expand Down
12 changes: 8 additions & 4 deletions src/Impersonator.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?php namespace Arcanedev\LaravelImpersonator;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator;

use Arcanedev\LaravelImpersonator\Contracts\Impersonatable;
use Arcanedev\LaravelImpersonator\Contracts\Impersonator as ImpersonatorContract;
use Arcanedev\LaravelImpersonator\Exceptions\ImpersonationException;
use Exception;
use Illuminate\Contracts\Foundation\Application;
Expand All @@ -11,7 +16,7 @@
* @package Arcanedev\LaravelImpersonator
* @author ARCANEDEV <[email protected]>
*/
class Impersonator implements Contracts\Impersonator
class Impersonator implements ImpersonatorContract
{
/* -----------------------------------------------------------------
| Properties
Expand Down Expand Up @@ -183,7 +188,7 @@ public function findUserById($id)
}

/* -----------------------------------------------------------------
| Check Functions
| Check Methods
| -----------------------------------------------------------------
*/

Expand Down Expand Up @@ -276,7 +281,6 @@ private function checkImpersonater(Impersonatable $impersonater): void
*/
private function checkImpersonated(Impersonatable $impersonated): void
{

if ( ! $impersonated->canBeImpersonated())
throw ImpersonationException::cannotBeImpersonated($impersonated);
}
Expand Down
6 changes: 5 additions & 1 deletion src/ImpersonatorServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator;

use Arcanedev\Support\Providers\PackageServiceProvider;
use Illuminate\Auth\SessionGuard as IlluminateSessionGuard;
Expand Down
6 changes: 5 additions & 1 deletion src/Policies/ImpersonationPolicy.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Policies;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Policies;

use Arcanedev\LaravelImpersonator\Contracts\Impersonatable;
use Arcanedev\Support\Bases\Policy;
Expand Down
6 changes: 5 additions & 1 deletion src/Providers/AuthorizationServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Providers;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Providers;

use Arcanedev\LaravelImpersonator\Policies\ImpersonationPolicy;
use Arcanedev\Support\Providers\AuthorizationServiceProvider as ServiceProvider;
Expand Down
6 changes: 5 additions & 1 deletion src/Traits/CanImpersonate.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Traits;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Traits;

use Arcanedev\LaravelImpersonator\Contracts\Impersonatable;
use Illuminate\Database\Eloquent\Model;
Expand Down
6 changes: 5 additions & 1 deletion tests/EventsTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Tests;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Tests;

use Arcanedev\LaravelImpersonator\Events\ImpersonationStopped;
use Arcanedev\LaravelImpersonator\Events\ImpersonationStarted;
Expand Down
6 changes: 5 additions & 1 deletion tests/ImpersonationPoliciesTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Tests;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Tests;

use Symfony\Component\HttpFoundation\Response;

Expand Down
6 changes: 5 additions & 1 deletion tests/ImpersonationTraitTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Tests;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Tests;

/**
* Class ImpersonationTraitTest
Expand Down
6 changes: 5 additions & 1 deletion tests/ImpersonatorServiceProviderTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Tests;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Tests;

use Arcanedev\LaravelImpersonator\ImpersonatorServiceProvider;

Expand Down
6 changes: 5 additions & 1 deletion tests/ImpersonatorTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Tests;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Tests;

use Arcanedev\LaravelImpersonator\Tests\Stubs\Models\User;
use Arcanedev\LaravelImpersonator\Contracts\Impersonator as ImpersonatorContract;
Expand Down
6 changes: 5 additions & 1 deletion tests/MiddlewareTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Tests;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Tests;

/**
* Class MiddlewareTest
Expand Down
6 changes: 5 additions & 1 deletion tests/Stubs/Controllers/ImpersonatorController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Tests\Stubs\Controllers;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Tests\Stubs\Controllers;

use Arcanedev\LaravelImpersonator\Contracts\Impersonator;
use Arcanedev\LaravelImpersonator\Policies\ImpersonationPolicy;
Expand Down
6 changes: 5 additions & 1 deletion tests/Stubs/Models/User.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Tests\Stubs\Models;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Tests\Stubs\Models;

use Arcanedev\LaravelImpersonator\Contracts\Impersonatable;
use Arcanedev\LaravelImpersonator\Traits\CanImpersonate;
Expand Down
6 changes: 5 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace Arcanedev\LaravelImpersonator\Tests;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelImpersonator\Tests;

use Orchestra\Testbench\TestCase as BaseTestCase;

Expand Down

0 comments on commit ac707a6

Please sign in to comment.