mirror of
https://github.com/superhelio/commands.git
synced 2026-01-27 04:44:59 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d635a04b9 | ||
|
|
6eb2e1499c | ||
|
|
2cf81a2d98 | ||
|
|
5132d97534 | ||
|
|
1ae74443c9 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1 @@
|
||||
vendor
|
||||
vendor
|
||||
|
||||
32
.travis.yml
32
.travis.yml
@@ -1,20 +1,30 @@
|
||||
language: php
|
||||
|
||||
sudo: false
|
||||
|
||||
php:
|
||||
- 7.0
|
||||
- 7.1
|
||||
- nightly
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: nightly
|
||||
fast_finish: true
|
||||
|
||||
env:
|
||||
global:
|
||||
- setup=basic
|
||||
- coverage=no
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache/files
|
||||
|
||||
before_script:
|
||||
- phpenv global "$TRAVIS_PHP_VERSION"
|
||||
- composer config extra.platform.php $TRAVIS_PHP_VERSION
|
||||
install:
|
||||
- flags="--ansi --prefer-dist --no-interaction --optimize-autoloader --no-suggest --no-progress"
|
||||
- travis_wait 30 composer install $flags
|
||||
- composer config discard-changes true
|
||||
- if [[ $setup = 'basic' ]]; then travis_retry composer install --prefer-dist --no-interaction; fi
|
||||
- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable; fi
|
||||
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable; fi
|
||||
- if [[ $setup = 'coveralls' ]]; then travis_retry composer require "satooshi/php-coveralls=~0.7" --prefer-dist --no-interaction --dev; fi
|
||||
|
||||
script:
|
||||
- ./vendor/bin/phpunit -c phpunit.xml
|
||||
- if [[ $coverage = 'yes' ]]; then ./vendor/bin/phpunit -c phpunit.xml --coverage-clover build/logs/clover.xml; fi
|
||||
- if [[ $coverage = 'no' ]]; then ./vendor/bin/phpunit -c phpunit.xml; fi
|
||||
|
||||
after_script:
|
||||
- if [[ $setup = 'coveralls' ]]; then php vendor/bin/coveralls -v; fi
|
||||
|
||||
@@ -4,14 +4,6 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [1.2.0](https://github.com/superhelio/commands/tree/1.2.0) (2017-10-19)
|
||||
- Bumped PHP version requirement to >=7.0, PHP5.6 was taking really long time to resolve
|
||||
- Included composer.lock, which is generated with PHP v7.0.23
|
||||
|
||||
## [1.1.2](https://github.com/superhelio/commands/tree/1.1.2) (2017-09-15)
|
||||
- Removed composer.lock, only to enable correct CI builds
|
||||
- Reworked travis-ci.org configuration, builds should now go green
|
||||
|
||||
## [1.1.1](https://github.com/superhelio/commands/tree/1.1.1) (2017-08-27)
|
||||
- Typo fixes
|
||||
- Removal of dead/unnecessary code
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
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.
|
||||
|
||||
## Install
|
||||
|
||||
### Step 1: Install Through Composer
|
||||
@@ -79,4 +77,3 @@ The MIT License (MIT). Please see [License File](LICENSE.md) for more informatio
|
||||
[link-downloads]: https://packagist.org/packages/superhelio/commands
|
||||
[link-author]: https://github.com/superhelio
|
||||
[link-contributors]: https://github.com/superhelio/commands/graphs/contributors
|
||||
[link-dbal]: https://packagist.org/packages/doctrine/dbal
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php" : ">=7.0",
|
||||
"illuminate/support": "^5.3|^5.4|^5.5",
|
||||
"doctrine/dbal": "^2.5|^2.6"
|
||||
"php" : ">=5.5.0",
|
||||
"illuminate/support": "~5.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit" : "^5.0",
|
||||
"orchestra/testbench": "~3.0"
|
||||
"phpunit/phpunit" : "4.*",
|
||||
"orchestra/testbench": "~3.0",
|
||||
"doctrine/dbal": "~2.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -41,11 +41,6 @@
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Superhelio\\Commands\\ServiceProvider"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1474
composer.lock
generated
1474
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -11,9 +11,7 @@ class Reload extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'superhelio:reload
|
||||
{--automate=false : Should run without questions?}
|
||||
{--loud=true : Should output reset and migrate outputs?}';
|
||||
protected $signature = 'superhelio:reload';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@@ -29,51 +27,26 @@ class Reload extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$automated = $this->automate();
|
||||
if ($this->confirm('Rollback all your database tables, recreate them and seed?')) {
|
||||
$this->call(
|
||||
'migrate:reset',
|
||||
[
|
||||
'--no-interaction' => true,
|
||||
'--env' => 'development',
|
||||
'--verbose' => 3
|
||||
]
|
||||
);
|
||||
$this->call(
|
||||
'migrate',
|
||||
[
|
||||
'--seed' => true,
|
||||
'--no-interaction' => true,
|
||||
'--env' => 'development',
|
||||
'--verbose' => 3
|
||||
]
|
||||
);
|
||||
|
||||
if ($automated && $this->confirm('Rollback all your database tables, recreate them and seed?')) {
|
||||
return $this->runReload();
|
||||
return true;
|
||||
}
|
||||
if (!$automated) {
|
||||
return $this->runReload();
|
||||
}
|
||||
}
|
||||
|
||||
public function automate()
|
||||
{
|
||||
$automate = $this->option('automate');
|
||||
|
||||
return !($automate === '1' || $automate === 1 || $automate === 'yes' || $automate === 'true');
|
||||
}
|
||||
|
||||
public function outputVerbosity()
|
||||
{
|
||||
$output = $this->option('loud');
|
||||
|
||||
return ($output === '1' || $output === 1 || $output == 'yes' || $output == 'true');
|
||||
}
|
||||
|
||||
public function runReload()
|
||||
{
|
||||
$verbose = ($this->outputVerbosity() ? 3 : 0);
|
||||
$this->call(
|
||||
'migrate:reset',
|
||||
[
|
||||
'--no-interaction' => true,
|
||||
'--env' => 'development',
|
||||
'--verbose' => $verbose
|
||||
]
|
||||
);
|
||||
$this->call(
|
||||
'migrate',
|
||||
[
|
||||
'--seed' => true,
|
||||
'--no-interaction' => true,
|
||||
'--env' => 'development',
|
||||
'--verbose' => $verbose
|
||||
]
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Superhelio\Commands;
|
||||
|
||||
class Facade extends \Illuminate\Support\Facades\Facade
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Superhelio\Commands;
|
||||
|
||||
use ReflectionClass;
|
||||
@@ -102,12 +101,12 @@ class GozerTest extends \Orchestra\Testbench\TestCase
|
||||
$connection = $gozer->getConnection();
|
||||
|
||||
$tables = $gozer->getTables($connection);
|
||||
$this->assertTrue(\in_array('gozerTest__users', $tables, false));
|
||||
$this->assertTrue(in_array('gozerTest__users', $tables, false));
|
||||
|
||||
$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));
|
||||
$this->assertTrue(in_array('gozerTest__users', $filteredTables->toArray(), false));
|
||||
}
|
||||
|
||||
public function test_gozer_table_filtering_works()
|
||||
@@ -124,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));
|
||||
$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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Superhelio\Commands;
|
||||
|
||||
use ReflectionClass;
|
||||
|
||||
class PackageTest extends \Orchestra\Testbench\TestCase
|
||||
{
|
||||
public function test_facade()
|
||||
{
|
||||
$facade = new ReflectionClass(Facade::class);
|
||||
$this->assertTrue($facade->hasMethod('getFacadeAccessor'));
|
||||
$this->assertTrue($facade->getMethod('getFacadeAccessor')->isProtected());
|
||||
$this->assertTrue($facade->getMethod('getFacadeAccessor')->isStatic());
|
||||
}
|
||||
|
||||
public function test_service_provider()
|
||||
{
|
||||
$sp = new ReflectionClass(\Superhelio\Commands\ServiceProvider::class);
|
||||
$this->assertTrue($sp->hasMethod('register'));
|
||||
$this->assertTrue($sp->hasMethod('registerReloader'));
|
||||
$this->assertTrue($sp->hasMethod('registerGozer'));
|
||||
}
|
||||
}
|
||||
@@ -1,75 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Superhelio\Commands;
|
||||
|
||||
use ReflectionClass;
|
||||
use Superhelio\Commands\Commands\Reload;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class ReloadTest extends \Orchestra\Testbench\TestCase
|
||||
class ReloadTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Setup the test environment.
|
||||
*/
|
||||
public function setUp()
|
||||
public function testReloadTest()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->artisan('migrate', ['--database' => 'testbench']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define environment setup.
|
||||
*
|
||||
* @param \Illuminate\Foundation\Application $app
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function getEnvironmentSetUp($app)
|
||||
{
|
||||
// Setup default database to use sqlite :memory:
|
||||
$app['config']->set('database.default', 'testbench');
|
||||
$app['config']->set('database.connections.testbench', [
|
||||
'driver' => 'sqlite',
|
||||
'database' => ':memory:',
|
||||
'prefix' => 'reloadTest__',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get package providers.
|
||||
* At a minimum this is the package being tested, but also
|
||||
* would include packages upon which our package depends.
|
||||
* In a normal app environment these would be added to
|
||||
* the 'providers' array in the config/app.php file.
|
||||
*
|
||||
* @param \Illuminate\Foundation\Application $app
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getPackageProviders($app)
|
||||
{
|
||||
return [
|
||||
'\Superhelio\Commands\Tests\Stubs\ServiceProvider',
|
||||
'\Superhelio\Commands\ServiceProvider'
|
||||
];
|
||||
}
|
||||
|
||||
public function test_reload_exists()
|
||||
{
|
||||
$this->assertTrue(class_exists(Reload::class));
|
||||
$reload = new Reload();
|
||||
|
||||
$this->assertInstanceOf(Reload::class, $reload);
|
||||
}
|
||||
|
||||
public function test_reload_has_required_methods_and_properties()
|
||||
{
|
||||
$reload = new Reload();
|
||||
$this->assertTrue(method_exists($reload, 'handle'), 'handle');
|
||||
$this->assertTrue(method_exists($reload, 'runReload'), 'runReload');
|
||||
$this->assertTrue(method_exists($reload, 'automate'), 'automate');
|
||||
|
||||
$reload = new ReflectionClass(Reload::class);
|
||||
$this->assertTrue($reload->hasProperty('signature'), 'signature');
|
||||
$this->assertTrue($reload->hasProperty('description'), 'description');
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,6 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
$this->loadMigrationsFrom(\dirname(__DIR__) . '/migrations');
|
||||
$this->loadMigrationsFrom(dirname(__DIR__) . '/migrations');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user