Bump Laravel versions (#1022)

* Bump Laravel versions

* Test Laravel 8

* Update composer.json

* Update composer.json

* normalize composer.json

* Tweak MethodTest for Laravel 8

Co-authored-by: barryvdh <[email protected]>
This commit is contained in:
Barry vd. Heuvel
2020-08-28 22:26:05 +02:00
committed by GitHub
co-authored by barryvdh
parent a12f902b33
commit a49cb46fdf
3 changed files with 32 additions and 20 deletions
+3 -3
View File
@@ -20,11 +20,11 @@ jobs:
strategy: strategy:
matrix: matrix:
php: [7.4, 7.3, 7.2] php: [7.4, 7.3, 7.2]
laravel: [7.*, 6.*, 5.5.*] laravel: [8.*, 7.*, 6.*]
dependency-version: [prefer-lowest, prefer-stable] dependency-version: [prefer-lowest, prefer-stable]
exclude: exclude:
- laravel: 5.5.* - laravel: 8.*
php: 7.4 php: 7.2
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
+9 -7
View File
@@ -25,16 +25,16 @@
"barryvdh/reflection-docblock": "^2.0.6", "barryvdh/reflection-docblock": "^2.0.6",
"composer/composer": "^1.6 || ^2.0@dev", "composer/composer": "^1.6 || ^2.0@dev",
"doctrine/dbal": "~2.3", "doctrine/dbal": "~2.3",
"illuminate/console": "^5.5 || ^6 || ^7", "illuminate/console": "^6 || ^7 || ^8",
"illuminate/filesystem": "^5.5 || ^6 || ^7", "illuminate/filesystem": "^6 || ^7 || ^8",
"illuminate/support": "^5.5 || ^6 || ^7", "illuminate/support": "^6 || ^7 || ^8",
"phpdocumentor/type-resolver": "^1.1.0" "phpdocumentor/type-resolver": "^1.1.0"
}, },
"require-dev": { "require-dev": {
"illuminate/config": "^5.5 || ^6 || ^7", "illuminate/config": "^6 || ^7 || ^8",
"illuminate/view": "^5.5 || ^6 || ^7", "illuminate/view": "^6 || ^7 || ^8",
"mockery/mockery": "^1.3", "mockery/mockery": "^1.3",
"orchestra/testbench": "^3.5 || ^4 || ^5", "orchestra/testbench": "^4 || ^5 || ^6",
"phpro/grumphp": "^0.19.0", "phpro/grumphp": "^0.19.0",
"spatie/phpunit-snapshot-assertions": "^1.4 || ^2.2 || ^3", "spatie/phpunit-snapshot-assertions": "^1.4 || ^2.2 || ^3",
"squizlabs/php_codesniffer": "^3.5", "squizlabs/php_codesniffer": "^3.5",
@@ -45,7 +45,7 @@
}, },
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.7-dev" "dev-master": "2.8-dev"
}, },
"laravel": { "laravel": {
"providers": [ "providers": [
@@ -63,6 +63,8 @@
"Barryvdh\\LaravelIdeHelper\\Tests\\": "tests" "Barryvdh\\LaravelIdeHelper\\Tests\\": "tests"
} }
}, },
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": { "scripts": {
"analyze": "psalm", "analyze": "psalm",
"check-style": "phpcs -p --standard=PSR12 config/ resources/ src/ tests/ '--ignore=*__snapshots_*'", "check-style": "phpcs -p --standard=PSR12 config/ resources/ src/ tests/ '--ignore=*__snapshots_*'",
+20 -10
View File
@@ -4,9 +4,10 @@ namespace Barryvdh\LaravelIdeHelper\Tests;
use Barryvdh\LaravelIdeHelper\Method; use Barryvdh\LaravelIdeHelper\Method;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Foundation\Application;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase class MethodTest extends TestCase
{ {
/** /**
* Test that we can actually instantiate the class * Test that we can actually instantiate the class
@@ -31,14 +32,16 @@ class ExampleTest extends TestCase
$method = new Method($reflectionMethod, 'Example', $reflectionClass); $method = new Method($reflectionMethod, 'Example', $reflectionClass);
$output = '/** $output = <<<'DOC'
/**
* *
* *
* @param string $last * @param string $last
* @param string $first * @param string $first
* @param string $middle * @param string $middle
* @static * @static
*/'; */
DOC;
$this->assertSame($output, $method->getDocComment('')); $this->assertSame($output, $method->getDocComment(''));
$this->assertSame('setName', $method->getName()); $this->assertSame('setName', $method->getName());
$this->assertSame('\\' . ExampleClass::class, $method->getDeclaringClass()); $this->assertSame('\\' . ExampleClass::class, $method->getDeclaringClass());
@@ -54,25 +57,32 @@ class ExampleTest extends TestCase
*/ */
public function testEloquentBuilderOutput() public function testEloquentBuilderOutput()
{ {
if ((int) Application::VERSION < 8) {
$this->markTestSkipped('This test requires Laravel 8.0 or higher');
}
$reflectionClass = new \ReflectionClass(Builder::class); $reflectionClass = new \ReflectionClass(Builder::class);
$reflectionMethod = $reflectionClass->getMethod('with'); $reflectionMethod = $reflectionClass->getMethod('with');
$method = new Method($reflectionMethod, 'Builder', $reflectionClass); $method = new Method($reflectionMethod, 'Builder', $reflectionClass);
$output = '/** $output = <<<'DOC'
/**
* Set the relationships that should be eager loaded. * Set the relationships that should be eager loaded.
* *
* @param mixed $relations * @param string|array $relations
* @param string|\Closure|null $callback
* @return \Illuminate\Database\Eloquent\Builder|static * @return \Illuminate\Database\Eloquent\Builder|static
* @static * @static
*/'; */
DOC;
$this->assertSame($output, $method->getDocComment('')); $this->assertSame($output, $method->getDocComment(''));
$this->assertSame('with', $method->getName()); $this->assertSame('with', $method->getName());
$this->assertSame('\\' . Builder::class, $method->getDeclaringClass()); $this->assertSame('\\' . Builder::class, $method->getDeclaringClass());
$this->assertSame('$relations', $method->getParams(true)); $this->assertSame('$relations, $callback', $method->getParams(true));
$this->assertSame(['$relations'], $method->getParams(false)); $this->assertSame(['$relations', '$callback'], $method->getParams(false));
$this->assertSame('$relations', $method->getParamsWithDefault(true)); $this->assertSame('$relations, $callback = null', $method->getParamsWithDefault(true));
$this->assertSame(['$relations'], $method->getParamsWithDefault(false)); $this->assertSame(['$relations', '$callback = null'], $method->getParamsWithDefault(false));
$this->assertSame(true, $method->shouldReturn()); $this->assertSame(true, $method->shouldReturn());
} }