Skip to content

Commit

Permalink
Merge pull request #35 from olssonm/dev
Browse files Browse the repository at this point in the history
Compat-check for Laravel 5.8
  • Loading branch information
olssonm authored Feb 28, 2019
2 parents 2ec228e + eedffbb commit 25172f3
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 32 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/vendor
composer.lock
src/config.php
.DS_Store
34 changes: 25 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,38 @@ sudo: false

before_script:
- travis_retry composer self-update
- travis_retry composer require "illuminate/support:${ILLUMINATE_VERSION}"
- travis_retry composer require "illuminate/support:${ILLUMINATE_VERSION}" "phpunit/phpunit:${PHPUNIT_VERSION}"

script:
- phpunit
- composer test

matrix:
include:
- php: 7.0
env: ILLUMINATE_VERSION=5.4.*
env:
- ILLUMINATE_VERSION=5.4.*
- PHPUNIT_VERSION=~5.7
- php: 7.1
env: ILLUMINATE_VERSION=5.5.*
env:
- ILLUMINATE_VERSION=5.5.*
- PHPUNIT_VERSION=~6.0
- php: 7.1
env: ILLUMINATE_VERSION=5.6.*
env:
- ILLUMINATE_VERSION=5.6.*
- PHPUNIT_VERSION=7.1
- php: 7.2
env: ILLUMINATE_VERSION=5.6.*
env:
- ILLUMINATE_VERSION=5.6.*
- PHPUNIT_VERSION=7.1
- php: 7.2
env: ILLUMINATE_VERSION=5.7.*
- php: nightly
env: ILLUMINATE_VERSION=5.7.*
env:
- ILLUMINATE_VERSION=5.7.*
- PHPUNIT_VERSION=7.1
- php: 7.2
env:
- ILLUMINATE_VERSION=5.8.*
- PHPUNIT_VERSION=~7.5
- php: 7.3
env:
- ILLUMINATE_VERSION=5.8.*
- PHPUNIT_VERSION=~7.5
2 changes: 1 addition & 1 deletion README.jp.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Laravel | l5-very-basic-auth
:--------------------------------------|:----------
`5.1.*/5.2.*` | `1.*`
`5.3.*` | `2.*`
`5.4.*`/`5.5.*`/`5.6.*/5.7.*` | `5.*`
`^5.4` | `5.*`

#### Laravel4.xを使っている場合

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Laravel | l5-very-basic-auth
:--------------------------------------|:----------
`5.1.*/5.2.*` | `1.*`
`5.3.*` | `2.*`
`5.4.*`/`5.5.*`/`5.6.*/5.7.*` | `5.*`
`^5.4` | `5.*`

*The odd versioning is due to breaking changes in the testing framework and PHP versions. Else, `3.x` is usable for Laravel 5.4 (PHP 5.6 and up) and `4.x` for Laravel 5.5.*

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
}
],
"require": {
"illuminate/support": ">=5.4.0",
"illuminate/support": ">=5.4",
"php" : "^7.0"
},
"require-dev": {
"phpunit/phpunit": "^6.5 || 7.1",
"phpunit/phpunit": "^6.5 || ^7.5",
"orchestra/testbench": ">=3.4.0"
},
"autoload": {
Expand All @@ -31,7 +31,7 @@
},
"autoload-dev": {
"psr-4": {
"Olssonm\\VeryBasicAuth\\Test\\": "tests"
"Olssonm\\VeryBasicAuth\\Tests\\": "tests"
}
},
"scripts": {
Expand Down
7 changes: 3 additions & 4 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
convertWarningsToExceptions="false"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
<exclude suffix=".php">./tests/app/</exclude>
<file phpVersion="7.1" phpVersionOperator="lt">./tests/PHP70.php</file>
<file phpVersion="7.1" phpVersionOperator="ge">./tests/PHP71.php</file>
</testsuite>
</testsuites>
</phpunit>
19 changes: 19 additions & 0 deletions tests/PHP70.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php namespace Olssonm\VeryBasicAuth\Tests;

use Olssonm\VeryBasicAuth\Http\Middleware\VeryBasicAuth;

class PHP70 extends \Olssonm\VeryBasicAuth\Tests\VeryBasicAuthTests {
/** Setup **/
public function setUp()
{
parent::setUp();
$this->middleware = new VeryBasicAuth;
}

/** Teardown */
public static function tearDownAfterClass()
{
parent::tearDownAfterClass();
unlink(__DIR__ . '/../src/config.php');
}
}
19 changes: 19 additions & 0 deletions tests/PHP71.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php namespace Olssonm\VeryBasicAuth\Tests;

use Olssonm\VeryBasicAuth\Http\Middleware\VeryBasicAuth;

class PHP71 extends \Olssonm\VeryBasicAuth\Tests\VeryBasicAuthTests {
/** Setup **/
public function setUp(): void
{
parent::setUp();
$this->middleware = new VeryBasicAuth;
}

/** Teardown */
public static function tearDownAfterClass(): void
{
parent::tearDownAfterClass();
unlink(__DIR__ . '/../src/config.php');
}
}
23 changes: 9 additions & 14 deletions tests/VeryBasicAuthTests.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace Olssonm\VeryBasicAuth;
<?php namespace Olssonm\VeryBasicAuth\Tests;

use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
Expand All @@ -7,11 +7,7 @@

class VeryBasicAuthTests extends \Orchestra\Testbench\TestCase {

public function setUp()
{
parent::setUp();
$this->middleware = new VeryBasicAuth;
}
protected $middleware;

/**
* Load the package
Expand Down Expand Up @@ -207,7 +203,13 @@ public function test_very_basic_auth_view_incorrect_credentials()

$this->assertEquals('Basic realm="' . $realm . '", charset="UTF-8"', $result->headers->get('WWW-Authenticate'));
$this->assertEquals(401, $result->getStatusCode());
$this->assertContains('This is the default view for the l5-very-basic-auth-package', $result->getContent());

// PHPUNIT 7.5.6+
if (method_exists($this, 'assertStringContainsStringIgnoringCase')) {
$this->assertStringContainsStringIgnoringCase('This is the default view for the l5-very-basic-auth-package', $result->getContent());
} else {
$this->assertContains('This is the default view for the l5-very-basic-auth-package', $result->getContent());
}
}

/* test */
Expand Down Expand Up @@ -269,11 +271,4 @@ public function test_very_basic_auth_env_wildcard()
$this->assertEquals(401, $result->getStatusCode());
$this->assertEquals(config('very_basic_auth.error_message'), $result->getContent());
}

/** Teardown */
public static function tearDownAfterClass()
{
parent::tearDownAfterClass();
unlink(__DIR__ . '/../src/config.php');
}
}

0 comments on commit 25172f3

Please sign in to comment.