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
php:
- 7.0
- 7.1
- 7.3
- 7.4
- 8.0
- nightly
matrix:
allow_failures:
@@ -17,4 +18,4 @@ install:
- flags="--ansi --prefer-dist --no-interaction --optimize-autoloader --no-suggest --no-progress"
- travis_wait 30 composer install $flags
script:
- ./vendor/bin/phpunit -c phpunit.xml
- ./vendor/bin/phpunit -c phpunit.xml

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]
[![Software License][ico-license]](LICENSE.md)
@@ -10,7 +10,7 @@
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.
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
@@ -27,7 +27,7 @@ You'll only want to use these generators for local development, so you don't wan
```php
public function register()
{
if ($this->app->environment() == 'local') {
if ($this->app->environment() === 'local') {
$this->app->register('SuperHelio\Commands\ServiceProvider');
}
}

View File

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

5371
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,8 +7,7 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
stopOnFailure="false">
<testsuites>
<testsuite name="Superhelio\Commands Test Suite">
@@ -24,4 +23,4 @@
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</phpunit>
</phpunit>

View File

@@ -5,6 +5,7 @@ namespace Superhelio\Commands\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
class Gozer extends Command
{
@@ -165,7 +166,7 @@ class Gozer extends Command
public function getDatabasePrefix()
{
return trim(DB::getTablePrefix());
return trim(DB::connection()->getTablePrefix());
}
/**
@@ -188,7 +189,7 @@ class Gozer extends Command
$prefix = $this->dbPrefix;
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 false;
}
}

View File

@@ -36,7 +36,7 @@ class ServiceProvider extends BaseServiceProvider
private function registerReloader()
{
$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');
}
@@ -44,7 +44,7 @@ class ServiceProvider extends BaseServiceProvider
private function registerGozer()
{
$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');
}

View File

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

View File

@@ -1,14 +1,27 @@
<?php
namespace Superhelio\Commands;
namespace Superhelio\Commands\Tests;
use Superhelio\Commands\Commands\Reload;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ReloadTest extends \PHPUnit_Framework_TestCase
class ReloadTest extends \Orchestra\Testbench\TestCase
{
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'));
}
}