Updated requirements

This commit is contained in:
Ismo Vuorinen
2021-01-20 11:44:34 +02:00
parent 7985d7c777
commit dd33dcbb61
10 changed files with 4335 additions and 1135 deletions

View File

@@ -1,7 +1,8 @@
language: php language: php
php: php:
- 7.0 - 7.3
- 7.1 - 7.4
- 8.0
- nightly - nightly
matrix: matrix:
allow_failures: allow_failures:

View File

@@ -1,4 +1,4 @@
# Laravel Commands by [SuperHelio](link-author) # Laravel Commands by [SuperHelio][link-author]
[![Latest Version on Packagist][ico-version]][link-packagist] [![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE.md) [![Software License][ico-license]](LICENSE.md)
@@ -10,7 +10,7 @@
This is a collection of Laravel Artisan commands created to help everyone This is a collection of Laravel Artisan commands created to help everyone
in their development work. We try to keep these as useful as possible. in their development work. We try to keep these as useful as possible.
This package requires PHP 7.0 or later. `composer.lock` has been generated with PHP v7.0.23. This package requires PHP 7.3 or later. The `composer.lock` file has been generated with PHP v7.4.13.
## Install ## Install
@@ -27,7 +27,7 @@ You'll only want to use these generators for local development, so you don't wan
```php ```php
public function register() public function register()
{ {
if ($this->app->environment() == 'local') { if ($this->app->environment() === 'local') {
$this->app->register('SuperHelio\Commands\ServiceProvider'); $this->app->register('SuperHelio\Commands\ServiceProvider');
} }
} }

View File

@@ -17,13 +17,14 @@
} }
], ],
"require": { "require": {
"php" : ">=7.0", "php" : ">=7.3",
"illuminate/support": "^5.3|^5.4|^5.5", "illuminate/support": "^5.3|^6.0|^7.0|^8.0",
"doctrine/dbal": "^2.5|^2.6" "doctrine/dbal": "^2.5|^2.6"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit" : "^5.0", "roave/security-advisories": "dev-master",
"orchestra/testbench": "~3.0" "phpunit/phpunit" : "^8.0",
"orchestra/testbench": "^3.3|^4|^5|^6"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

5371
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,8 +7,7 @@
convertNoticesToExceptions="true" convertNoticesToExceptions="true"
convertWarningsToExceptions="true" convertWarningsToExceptions="true"
processIsolation="false" processIsolation="false"
stopOnFailure="false" stopOnFailure="false">
syntaxCheck="false">
<testsuites> <testsuites>
<testsuite name="Superhelio\Commands Test Suite"> <testsuite name="Superhelio\Commands Test Suite">

View File

@@ -5,6 +5,7 @@ namespace Superhelio\Commands\Commands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
class Gozer extends Command class Gozer extends Command
{ {
@@ -165,7 +166,7 @@ class Gozer extends Command
public function getDatabasePrefix() public function getDatabasePrefix()
{ {
return trim(DB::getTablePrefix()); return trim(DB::connection()->getTablePrefix());
} }
/** /**
@@ -188,7 +189,7 @@ class Gozer extends Command
$prefix = $this->dbPrefix; $prefix = $this->dbPrefix;
return collect($tables)->reject(function ($table) use ($prefix) { return collect($tables)->reject(function ($table) use ($prefix) {
return !starts_with($table, $prefix); return !Str::startsWith($table, $prefix);
}); });
} }
} }

View File

@@ -48,5 +48,7 @@ class Reload extends Command
return true; return true;
} }
return false;
} }
} }

View File

@@ -36,7 +36,7 @@ class ServiceProvider extends BaseServiceProvider
private function registerReloader() private function registerReloader()
{ {
$this->app->singleton('command.superhelio.reload', function ($app) { $this->app->singleton('command.superhelio.reload', function ($app) {
return $app['Superhelio\Commands\Commands\Reload']; return $app[ \Superhelio\Commands\Commands\Reload::class ];
}); });
$this->commands('command.superhelio.reload'); $this->commands('command.superhelio.reload');
} }
@@ -44,7 +44,7 @@ class ServiceProvider extends BaseServiceProvider
private function registerGozer() private function registerGozer()
{ {
$this->app->singleton('command.superhelio.gozer', function ($app) { $this->app->singleton('command.superhelio.gozer', function ($app) {
return $app['Superhelio\Commands\Commands\Gozer']; return $app[ \Superhelio\Commands\Commands\Gozer::class ];
}); });
$this->commands('command.superhelio.gozer'); $this->commands('command.superhelio.gozer');
} }

View File

@@ -1,5 +1,5 @@
<?php <?php
namespace Superhelio\Commands; namespace Superhelio\Commands\Tests;
use ReflectionClass; use ReflectionClass;
use Superhelio\Commands\Commands\Gozer; use Superhelio\Commands\Commands\Gozer;
@@ -11,7 +11,7 @@ class GozerTest extends \Orchestra\Testbench\TestCase
/** /**
* Setup the test environment. * Setup the test environment.
*/ */
public function setUp() public function setUp() : void
{ {
parent::setUp(); parent::setUp();
$this->artisan('migrate', ['--database' => 'testbench']); $this->artisan('migrate', ['--database' => 'testbench']);
@@ -49,8 +49,8 @@ class GozerTest extends \Orchestra\Testbench\TestCase
protected function getPackageProviders($app) protected function getPackageProviders($app)
{ {
return [ return [
'\Superhelio\Commands\Tests\Stubs\ServiceProvider', \Superhelio\Commands\Tests\Stubs\ServiceProvider::class,
'\Superhelio\Commands\ServiceProvider' \Superhelio\Commands\ServiceProvider::class
]; ];
} }
@@ -63,35 +63,35 @@ class GozerTest extends \Orchestra\Testbench\TestCase
]); ]);
$users = DB::table('users')->where('id', '=', 1)->first(); $users = DB::table('users')->where('id', '=', 1)->first();
$this->assertEquals('hello@gozer.dev', $users->email); self::assertEquals('hello@gozer.dev', $users->email);
$this->assertEquals('User name', $users->name); self::assertEquals('User name', $users->name);
$this->assertTrue(Hash::check('123', $users->password)); self::assertTrue(Hash::check('123', $users->password));
} }
public function test_dbal_is_installed() public function test_dbal_is_installed()
{ {
$this->assertTrue(class_exists('\\Doctrine\\DBAL\\Schema\\Schema')); self::assertTrue(class_exists('\\Doctrine\\DBAL\\Schema\\Schema'));
} }
public function test_gozer_is_installed() public function test_gozer_is_installed()
{ {
$this->assertTrue(class_exists('\\Superhelio\\Commands\\Commands\\Gozer')); self::assertTrue(class_exists('\\Superhelio\\Commands\\Commands\\Gozer'));
} }
public function test_gozer_has_required_methods_and_properties() public function test_gozer_has_required_methods_and_properties()
{ {
$gozer = new ReflectionClass('\\Superhelio\\Commands\\Commands\\Gozer'); $gozer = new ReflectionClass('\\Superhelio\\Commands\\Commands\\Gozer');
$this->assertTrue($gozer->hasMethod('handle')); self::assertTrue($gozer->hasMethod('handle'));
$this->assertTrue($gozer->hasProperty('signature')); self::assertTrue($gozer->hasProperty('signature'));
$this->assertTrue($gozer->hasProperty('description')); self::assertTrue($gozer->hasProperty('description'));
$this->assertTrue($gozer->hasProperty('dbPrefix')); self::assertTrue($gozer->hasProperty('dbPrefix'));
} }
public function test_gozer_finds_database_prefix() public function test_gozer_finds_database_prefix()
{ {
$gozer = new Gozer(); $gozer = new Gozer();
$this->assertEquals('gozerTest__', $gozer->getDatabasePrefix()); self::assertEquals('gozerTest__', $gozer->getDatabasePrefix());
} }
public function test_gozer_finds_users_table() public function test_gozer_finds_users_table()
@@ -101,12 +101,12 @@ class GozerTest extends \Orchestra\Testbench\TestCase
$connection = $gozer->getConnection(); $connection = $gozer->getConnection();
$tables = $gozer->getTables($connection); $tables = $gozer->getTables($connection);
$this->assertTrue(in_array('gozerTest__users', $tables, false)); self::assertContains( 'gozerTest__users', $tables );
$gozer->setDatabasePrefix('gozerTest__'); $gozer->setDatabasePrefix('gozerTest__');
$filteredTables = $gozer->getFilteredTables($tables); $filteredTables = $gozer->getFilteredTables($tables);
$this->assertTrue(is_a($filteredTables, \Illuminate\Support\Collection::class)); self::assertTrue(is_a($filteredTables, \Illuminate\Support\Collection::class));
$this->assertTrue(in_array('gozerTest__users', $filteredTables->toArray(), false)); self::assertContains( 'gozerTest__users', $filteredTables->toArray() );
} }
public function test_gozer_table_filtering_works() public function test_gozer_table_filtering_works()
@@ -123,9 +123,9 @@ class GozerTest extends \Orchestra\Testbench\TestCase
$filtered = $gozer->getFilteredTables($tables); $filtered = $gozer->getFilteredTables($tables);
$array = $filtered->toArray(); $array = $filtered->toArray();
$this->assertFalse(in_array('this_should_be_filtered', $array, false)); self::assertNotContains( 'this_should_be_filtered', $array );
$this->assertFalse(in_array('filter_me_too', $array, false)); self::assertNotContains( 'filter_me_too', $array );
$this->assertTrue(in_array('gozerTest__users', $array, false)); self::assertContains( 'gozerTest__users', $array );
$this->assertTrue(in_array('gozerTest__migrations', $array, false)); self::assertContains( 'gozerTest__migrations', $array );
} }
} }

View File

@@ -1,14 +1,27 @@
<?php <?php
namespace Superhelio\Commands; namespace Superhelio\Commands\Tests;
use Superhelio\Commands\Commands\Reload; use Superhelio\Commands\Commands\Reload;
use Illuminate\Foundation\Testing\DatabaseMigrations; use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\DatabaseTransactions;
class ReloadTest extends \PHPUnit_Framework_TestCase class ReloadTest extends \Orchestra\Testbench\TestCase
{ {
public function testReloadTest() public function testReloadTest()
{ {
$this->assertTrue(true); self::assertTrue(true);
}
public function test_reload_is_installed()
{
self::assertTrue(class_exists('\\Superhelio\\Commands\\Commands\\Reload'));
}
public function test_reload_has_required_methods_and_properties()
{
$reload = new \ReflectionClass('\\Superhelio\\Commands\\Commands\\Reload');
self::assertTrue($reload->hasMethod('handle'));
self::assertTrue($reload->hasProperty('signature'));
self::assertTrue($reload->hasProperty('description'));
} }
} }