From e89ce855df12e18645f513b137ab322e77626ceb Mon Sep 17 00:00:00 2001 From: Adam Pippin Date: Fri, 1 May 2020 11:30:50 -0700 Subject: [PATCH] Code cleanup + formatting --- .phan/config.php | 3 +- app/Commands/Layout.php | 14 ++- app/Commands/Monitor.php | 24 +++-- app/Configuration.php | 71 +++++++++++-- app/Display.old.php | 71 ------------- app/Engine.php | 33 +++++- app/ILayoutDriver.php | 55 +++++++++- app/Layout.php | 77 ++++++++------ app/LayoutDriver/Xrandr.php | 27 ++++- app/Providers/AppServiceProvider.php | 28 ----- app/Providers/LayoutServiceProvider.php | 12 +++ app/Screen.php | 77 +++++++++++++- bootstrap/app.php | 12 ++- config/app.php | 109 +++++++++---------- config/commands.php | 132 ++++++++++++------------ tests/CreatesApplication.php | 24 +++-- tests/Feature/InspiringCommandTest.php | 29 ++++-- tests/TestCase.php | 4 +- tests/Unit/ExampleTest.php | 24 +++-- 19 files changed, 510 insertions(+), 316 deletions(-) delete mode 100644 app/Display.old.php delete mode 100644 app/Providers/AppServiceProvider.php diff --git a/.phan/config.php b/.phan/config.php index 60db97f..1c84616 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -12,8 +12,7 @@ return [ 'vendor/laravel-zero/', 'vendor/nunomaduro/', 'vendor/composer/', - 'vendor/symfony/', - 'vendor/aws/' + 'vendor/symfony/' ], 'exclude_analysis_directory_list' => [ diff --git a/app/Commands/Layout.php b/app/Commands/Layout.php index 0bbf45b..d1f11e2 100644 --- a/app/Commands/Layout.php +++ b/app/Commands/Layout.php @@ -1,9 +1,16 @@ + */ class Layout extends Command { /** @@ -33,19 +40,22 @@ class Layout extends Command /** * Execute the console command. * - * @return mixed + * @param \App\ILayoutDriver $driver + * @return void */ public function handle(\App\ILayoutDriver $driver) { $config_file = $this->argument('config'); if (!file_exists($config_file) || !is_readable($config_file)) + { throw new \Exception("Cannot read config file: $config_file"); + } $config = new \App\Configuration(); $config->load($config_file); - $engine = app()->make(\App\Engine::class, ['config'=>$config]); + $engine = app()->make(\App\Engine::class, ['config' => $config]); $engine->layout(); } diff --git a/app/Commands/Monitor.php b/app/Commands/Monitor.php index ea1d9f0..aa67f04 100644 --- a/app/Commands/Monitor.php +++ b/app/Commands/Monitor.php @@ -1,9 +1,16 @@ + */ class Monitor extends Command { /** @@ -11,7 +18,7 @@ class Monitor extends Command * * @var string */ - protected $signature = 'monitor {config} {--interval=5}'; + protected $signature = 'monitor {config} {--interval=5 : how often to attempt relayout in seconds}'; /** * The console command description. @@ -33,29 +40,32 @@ class Monitor extends Command /** * Execute the console command. * - * @return mixed + * @param \App\ILayoutDriver $driver + * @return void */ public function handle(\App\ILayoutDriver $driver) { $config_file = $this->argument('config'); if (!file_exists($config_file) || !is_readable($config_file)) + { throw new \Exception("Cannot read config file: $config_file"); + } $config = new \App\Configuration(); $config->load($config_file); - $engine = app()->make(\App\Engine::class, ['config'=>$config]); + $engine = app()->make(\App\Engine::class, ['config' => $config]); - declare(ticks = 1); + declare(ticks=1); - $signal_handler = function($signal) use ($config_file, &$engine) { + $signal_handler = static function(int $signal) use ($config_file, &$engine) { switch ($signal) { case SIGHUP: $config = new \App\Configuration(); $config->load($config_file); - $engine = app()->make(\App\Engine::class, ['config'=>$config]); + $engine = app()->make(\App\Engine::class, ['config' => $config]); break; } }; @@ -65,7 +75,7 @@ class Monitor extends Command while (true) { $engine->layout(); - sleep($this->option('interval')); + sleep((int)$this->option('interval')); } } } diff --git a/app/Configuration.php b/app/Configuration.php index 7ccffeb..2caff49 100644 --- a/app/Configuration.php +++ b/app/Configuration.php @@ -1,64 +1,119 @@ + */ class Configuration { + /** + * Represents the available screens and their configuration + * @var array + */ protected $_screens; + + /** + * Represents the available layouts + * @var array + */ protected $_layouts; + /** + * Initialize an empty config + */ public function __construct() { $this->_screens = []; $this->_layouts = []; } + /** + * Load a configuration from a YAML file + * + * @param string $file + * @return void + */ public function load(string $file): void { $config = Yaml::parseFile($file); - foreach ($config['screens'] as $screen_name=>$screen) + foreach ($config['screens'] as $screen_name => $screen) { $this->_screens[$screen_name] = app()->make(\App\Screen::class, [ - 'outputs'=>is_array($screen['output']) ? $screen['output'] : [$screen['output']] + 'outputs' => is_array($screen['output']) ? $screen['output'] : [$screen['output']] ]); } - foreach ($config['layouts'] as $layout=>$data) + foreach ($config['layouts'] as $layout => $data) { - $this->_layouts[$layout] = app()->make(\App\Layout::class, ['screens'=>$data['screens'], 'links'=>$data['links']]); + $this->_layouts[$layout] = app()->make(\App\Layout::class, ['screens' => $data['screens'], 'links' => $data['links']]); } } - public function getScreen(string $screen): Screen + /** + * Fetch a specific screen + * + * @param string $screen_name + * @return Screen + */ + public function getScreen(string $screen_name): Screen { - return $this->_screens[$screen]; + return $this->_screens[$screen_name]; } + /** + * Fetch the primary screen + * + * @return Screen + */ public function getPrimaryScreen(): Screen { return $this->getScreen($this->getPrimaryScreenName()); } + /** + * Fetch the name of the primary screen + * + * @return string + */ public function getPrimaryScreenName(): string { - foreach ($this->_screens as $name=>$screen) + foreach ($this->_screens as $name => $screen) { if ($screen->isPrimary()) + { return $name; + } } + + throw new \Exception("No primary screen found"); } + /** + * Fetch a specific layout + * + * @param string $layout + * @return Layout + */ public function getLayout(string $layout): Layout { return $this->_layouts[$layout]; } + /** + * Fetch all the layouts + * + * @return array + */ public function getLayouts(): array { return $this->_layouts; } - } diff --git a/app/Display.old.php b/app/Display.old.php deleted file mode 100644 index 2c4f2aa..0000000 --- a/app/Display.old.php +++ /dev/null @@ -1,71 +0,0 @@ -_names = $names; - } - - public function read() - { - foreach ($this->_names as $name) - { - $xrandr = trim(shell_exec('xrandr | grep "^'.$name.'"')); - if (!empty($xrandr)) - break; - } - - if (empty($xrandr)) - throw new \Exception("Cannot load display: ".end($this->_names)); - - # DVI-I-2-1 connected 1920x1080+1920+1440 (normal left inverted right x axis y axis) 521mm x 293mm - if (!preg_match('/^(?[^ ]+) connected (?[0-9]+)x(?[0-9]+)\\+(?[0-9]+)\\+(?[0-9]+) /', $xrandr, $matches)) - throw new \Exception("Cannot parse xrandr response for: ".$name); - - $this->_output = $matches['output']; - $this->_x = $matches['screen_x']; - $this->_y = $matches['screen_y']; - $this->_width = $matches['screen_w']; - $this->_height = $matches['screen_h']; - } - - public function getX(): int - { - return (int)$this->_x; - } - - public function getY(): int - { - return (int)$this->_y; - } - - public function getWidth(): int - { - return (int)$this->_width; - } - - public function getHeight(): int - { - return (int)$this->_height; - } - - public function setOffset(int $x, int $y): void - { - shell_exec('xrandr --output '.$this->_output.' --pos '.$x.'x'.$y); - } - - public function setDimensions(int $width, int $height): void - { - shell_exec('xrandr --output '.$this->_output.' --mode '.$width.'x'.$height); - } -} diff --git a/app/Engine.php b/app/Engine.php index 72958f8..f95d4f3 100644 --- a/app/Engine.php +++ b/app/Engine.php @@ -1,20 +1,46 @@ + */ class Engine { - protected $_config, $_driver; + /** + * The configuration laying out the screens and layouts we're trying to implement + * @var Configuration + */ + protected $_config; + /** + * The driver to allow us to manipulate display offsets/dimensions/etc + * @var ILayoutDriver + */ + protected $_driver; + /** + * Set up the engine + * @param Configuration $config + * @param ILayoutDriver $driver + */ public function __construct(\App\Configuration $config, \App\ILayoutDriver $driver) { $this->_config = $config; $this->_driver = $driver; } - public function layout() + /** + * Perform a layout + * + * @return void + */ + public function layout(): void { - foreach ($this->_config->getLayouts() as $layout_name=>$layout) + foreach ($this->_config->getLayouts() as $layout_name => $layout) { $screens = $layout->getScreenNames(); $all_screens = true; @@ -34,6 +60,5 @@ class Engine $layout->execute($this->_config, $this->_driver); break; } - } } diff --git a/app/ILayoutDriver.php b/app/ILayoutDriver.php index 275cdb4..df5e2ed 100644 --- a/app/ILayoutDriver.php +++ b/app/ILayoutDriver.php @@ -1,14 +1,67 @@ + */ interface ILayoutDriver { + + /** + * Set the offset of an output + * + * @param string $output + * @param int $x + * @param int $y + * @return void + */ public function setOffset(string $output, int $x, int $y): void; + + /** + * Get the offset of an output + * + * @param string $output + * @return int[] x, y + */ public function getOffset(string $output): array; + + /** + * Set the dimensions of the output + * + * @param string $output + * @param int $x + * @param int $y + * @return void + */ public function setDimensions(string $output, int $x, int $y): void; + + /** + * Get the dimensions of an output + * + * @param string $output + * @return int[] x, y + */ public function getDimensions(string $output): array; + + /** + * Check whether an output is connected + * + * @param string $output + * @return bool + */ public function isConnected(string $output): bool; + + /** + * Check whether the output is considered primary + * + * @param string $output + * @return bool + */ public function isPrimary(string $output): bool; -} +} diff --git a/app/Layout.php b/app/Layout.php index 5cfd3fa..8785be1 100644 --- a/app/Layout.php +++ b/app/Layout.php @@ -1,28 +1,30 @@ */ class Layout { /** - * List of screens this layout uses - * @var array[] + * List of screens this layout uses. + * @var array */ protected $_screens; /** - * Relations between the screens + * Relations between the screens. * @var array[] */ protected $_links; /** - * Initialize a new layout + * Initialize a new layout. * * @param array[] $screens * @param array[] $links @@ -34,7 +36,7 @@ class Layout } /** - * Fetch the names of the screens this layout depends on + * Fetch the names of the screens this layout depends on. * * @return string[] */ @@ -44,10 +46,10 @@ class Layout } /** - * Execute this layout + * Execute this layout. * - * @param Configuration $config - * @param ILayoutDriver $driver + * @param Configuration $config + * @param ILayoutDriver $driver * @return void */ public function execute(Configuration $config, ILayoutDriver $driver): void @@ -57,9 +59,9 @@ class Layout $layout_stack = [$primary_name]; $did_layout = false; - $layout = [$primary_name=>['x'=>0, 'y'=>0]]; + $layout = [$primary_name => ['x' => 0, 'y' => 0]]; - foreach ($this->_screens as $screen_name=>$screen_data) + foreach ($this->_screens as $screen_name => $screen_data) { if (isset($screen_data['width']) && isset($screen_data['height'])) { @@ -82,7 +84,10 @@ class Layout $calculate_layout = null; if (isset($link['above'])) { - $calculate_layout = function($s_x, $s_y, $s_w, $s_h, $d_x, $d_y, $d_w, $d_h) { + /** + * @return int[] + */ + $calculate_layout = static function(int $s_x, int $s_y, int $s_w, int $s_h, int $d_x, int $d_y, int $d_w, int $d_h): array { $center = $s_x + ($s_w / 2); $x = $center - ($d_w / 2); $y = $s_y - $d_h; @@ -90,9 +95,12 @@ class Layout return [$x, $y]; }; } - else if (isset($link['below'])) + elseif (isset($link['below'])) { - $calculate_layout = function($s_x, $s_y, $s_w, $s_h, $d_x, $d_y, $d_w, $d_h) { + /** + * @return int[] + */ + $calculate_layout = static function(int $s_x, int $s_y, int $s_w, int $s_h, int $d_x, int $d_y, int $d_w, int $d_h): array { $center = $s_x + ($s_w / 2); $x = $center - ($d_w / 2); $y = $s_y + $s_h; @@ -100,15 +108,21 @@ class Layout return [$x, $y]; }; } - else if (isset($link['left_of'])) + elseif (isset($link['left_of'])) { - $calculate_layout = function($s_x, $s_y, $s_w, $s_h, $d_x, $d_y, $d_w, $d_h) { + /** + * @return int[] + */ + $calculate_layout = static function(int $s_x, int $s_y, int $s_w, int $s_h, int $d_x, int $d_y, int $d_w, int $d_h): array { return [$s_x - $d_w, $s_y]; }; } - else if (isset($link['right_of'])) + elseif (isset($link['right_of'])) { - $calculate_layout = function($s_x, $s_y, $s_w, $s_h, $d_x, $d_y, $d_w, $d_h) { + /** + * @return int[] + */ + $calculate_layout = static function(int $s_x, int $s_y, int $s_w, int $s_h, int $d_x, int $d_y, int $d_w, int $d_h): array { return [$s_x + $s_w, $s_y]; }; } @@ -123,9 +137,9 @@ class Layout } else { - list($s_x, $s_y) = $source->getOffset(); + [$s_x, $s_y] = $source->getOffset(); } - list($s_w, $s_h) = $source->getDimensions(); + [$s_w, $s_h] = $source->getDimensions(); if (isset($layout[$target_name])) { @@ -134,13 +148,13 @@ class Layout } else { - list($d_x, $d_y) = $target->getOffset(); + [$d_x, $d_y] = $target->getOffset(); } - list($d_w, $d_h) = $target->getDimensions(); + [$d_w, $d_h] = $target->getDimensions(); - list($x, $y) = $calculate_layout($s_x, $s_y, $s_w, $s_h, $d_x, $d_y, $d_w, $d_h); + [$x, $y] = $calculate_layout($s_x, $s_y, $s_w, $s_h, $d_x, $d_y, $d_w, $d_h); - $layout[$target_name] = ['x'=>$x, 'y'=>$y]; + $layout[$target_name] = ['x' => $x, 'y' => $y]; $layout_stack[] = $target_name; } } @@ -149,22 +163,19 @@ class Layout $min_x = PHP_INT_MAX; $min_y = PHP_INT_MAX; - foreach ($layout as $screen_name=>$screen_offset) + foreach ($layout as $screen_name => $screen_offset) { $min_x = min($screen_offset['x'], $min_x); $min_y = min($screen_offset['y'], $min_y); } - foreach ($layout as $screen_name=>$screen_offset) + foreach ($layout as $screen_name => $screen_offset) { - list($current_x, $current_y) = $config->getScreen($screen_name)->getOffset(); - if ($current_x != $screen_offset['x']-$min_x || $current_y != $screen_offset['y']-$min_y) + [$current_x, $current_y] = $config->getScreen($screen_name)->getOffset(); + if ($current_x != $screen_offset['x'] - $min_x || $current_y != $screen_offset['y'] - $min_y) { - $config->getScreen($screen_name)->setOffset($screen_offset['x']-$min_x, $screen_offset['y']-$min_y); + $config->getScreen($screen_name)->setOffset($screen_offset['x'] - $min_x, $screen_offset['y'] - $min_y); } } - } - } - diff --git a/app/LayoutDriver/Xrandr.php b/app/LayoutDriver/Xrandr.php index e444a93..8443d72 100644 --- a/app/LayoutDriver/Xrandr.php +++ b/app/LayoutDriver/Xrandr.php @@ -1,17 +1,43 @@ + */ class Xrandr implements \App\ILayoutDriver { + /** + * The xrandr command + * @var \App\System\Command\Xrandr + */ protected $_xrandr; + + /** + * Cache of current display parameters + * @var array + */ protected $_displays; + /** + * Create a new xrandr driver + * + * @param \App\System\Command\Xrandr $xrandr_cmd + */ public function __construct(\App\System\Command\Xrandr $xrandr_cmd) { $this->_xrandr = $xrandr_cmd; } + /** + * Read display parameters from xrandr + * + * @return void + */ public function read() { $xrandr = $this->_xrandr->__invoke([]); @@ -73,4 +99,3 @@ class Xrandr implements \App\ILayoutDriver return isset($this->_displays[$output]); } } - diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php deleted file mode 100644 index 35471f6..0000000 --- a/app/Providers/AppServiceProvider.php +++ /dev/null @@ -1,28 +0,0 @@ - + */ class LayoutServiceProvider extends \Illuminate\Support\ServiceProvider { + /** + * Register the layout driver + * + * @return void + */ public function register() { $this->app->singleton(\App\ILayoutDriver::class, \App\LayoutDriver\Xrandr::class); diff --git a/app/Screen.php b/app/Screen.php index 36120d2..993de77 100644 --- a/app/Screen.php +++ b/app/Screen.php @@ -1,54 +1,125 @@ + */ class Screen { + /** + * A list of possible hardware outputs that could implement this screen + * @var string[] + */ protected $_outputs; + + /** + * The driver for manipulating the layout + * @var ILayoutDriver + */ protected $_driver; + /** + * Set up a new screen + * + * @param string[] $outputs + * @param ILayoutDriver $driver + */ public function __construct(array $outputs, ILayoutDriver $driver) { $this->_outputs = $outputs; $this->_driver = $driver; } - protected function getOutputName(): ?string + /** + * Enumerate all possible outputs and return the first that is found to be connected + * + * @return string + */ + protected function getOutputName(): string { foreach ($this->_outputs as $output) { if ($this->_driver->isConnected($output)) + { return $output; + } } - return null; + throw new \Exception("No connected output found!"); } + /** + * Determine whether this screen is connected + * + * @return bool + */ public function isConnected(): bool { - return !empty($this->getOutputName()); + try + { + $this->getOutputName(); + return true; + } + catch (\Exception $ex) + { + return false; + } } + /** + * Determine whether this screen is considered the "primary" screen + * + * @return bool + */ public function isPrimary(): bool { return $this->_driver->isPrimary($this->getOutputName()); } + /** + * Get the pixel dimensions of the screen + * + * @return int[] x, y + */ public function getDimensions(): array { return $this->_driver->getDimensions($this->getOutputName()); } + /** + * Get the pixel offset of the screen + * + * @return int[] x, y + */ public function getOffset(): array { return $this->_driver->getOffset($this->getOutputName()); } + /** + * Set the pixel offset of the screen + * + * @param int $x + * @param int $y + * @return void + */ public function setOffset(int $x, int $y): void { $this->_driver->setOffset($this->getOutputName(), $x, $y); } + /** + * Set the resolution of the screen + * + * @param int $w + * @param int $h + * @return void + */ public function setDimensions(int $w, int $h): void { $this->_driver->setDimensions($this->getOutputName(), $w, $h); diff --git a/bootstrap/app.php b/bootstrap/app.php index cb66136..f739c13 100755 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,5 +1,7 @@ singleton( - Illuminate\Contracts\Console\Kernel::class, - LaravelZero\Framework\Kernel::class + Illuminate\Contracts\Console\Kernel::class, + LaravelZero\Framework\Kernel::class ); $app->singleton( - Illuminate\Contracts\Debug\ExceptionHandler::class, - Illuminate\Foundation\Exceptions\Handler::class + Illuminate\Contracts\Debug\ExceptionHandler::class, + Illuminate\Foundation\Exceptions\Handler::class ); /* diff --git a/config/app.php b/config/app.php index 952e417..a3dd29c 100644 --- a/config/app.php +++ b/config/app.php @@ -1,61 +1,62 @@ 'Monitor_layout', - - /* - |-------------------------------------------------------------------------- - | Application Version - |-------------------------------------------------------------------------- - | - | This value determines the "version" your application is currently running - | in. You may want to follow the "Semantic Versioning" - Given a version - | number MAJOR.MINOR.PATCH when an update happens: https://semver.org. - | - */ - - 'version' => app('git.version'), - - /* - |-------------------------------------------------------------------------- - | Application Environment - |-------------------------------------------------------------------------- - | - | This value determines the "environment" your application is currently - | running in. This may determine how you prefer to configure various - | services the application utilizes. This can be overridden using - | the global command line "--env" option when calling commands. - | - */ - - 'env' => 'development', - - /* - |-------------------------------------------------------------------------- - | Autoloaded Service Providers - |-------------------------------------------------------------------------- - | - | The service providers listed here will be automatically loaded on the - | request to your application. Feel free to add your own services to - | this array to grant expanded functionality to your applications. - | - */ - - 'providers' => [ - App\Providers\AppServiceProvider::class, + /* + |-------------------------------------------------------------------------- + | Application Name + |-------------------------------------------------------------------------- + | + | This value is the name of your application. This value is used when the + | framework needs to place the application's name in a notification or + | any other location as required by the application or its packages. + | + */ + + 'name' => 'Monitor_layout', + + /* + |-------------------------------------------------------------------------- + | Application Version + |-------------------------------------------------------------------------- + | + | This value determines the "version" your application is currently running + | in. You may want to follow the "Semantic Versioning" - Given a version + | number MAJOR.MINOR.PATCH when an update happens: https://semver.org. + | + */ + + 'version' => app('git.version'), + + /* + |-------------------------------------------------------------------------- + | Application Environment + |-------------------------------------------------------------------------- + | + | This value determines the "environment" your application is currently + | running in. This may determine how you prefer to configure various + | services the application utilizes. This can be overridden using + | the global command line "--env" option when calling commands. + | + */ + + 'env' => 'development', + + /* + |-------------------------------------------------------------------------- + | Autoloaded Service Providers + |-------------------------------------------------------------------------- + | + | The service providers listed here will be automatically loaded on the + | request to your application. Feel free to add your own services to + | this array to grant expanded functionality to your applications. + | + */ + + 'providers' => [ App\Providers\LayoutServiceProvider::class - ], + ], ]; diff --git a/config/commands.php b/config/commands.php index 838b65f..f44cee0 100644 --- a/config/commands.php +++ b/config/commands.php @@ -1,80 +1,82 @@ NunoMaduro\LaravelConsoleSummary\SummaryCommand::class, + 'default' => NunoMaduro\LaravelConsoleSummary\SummaryCommand::class, - /* - |-------------------------------------------------------------------------- - | Commands Paths - |-------------------------------------------------------------------------- - | - | This value determines the "paths" that should be loaded by the console's - | kernel. Foreach "path" present on the array provided below the kernel - | will extract all "Illuminate\Console\Command" based class commands. - | - */ + /* + |-------------------------------------------------------------------------- + | Commands Paths + |-------------------------------------------------------------------------- + | + | This value determines the "paths" that should be loaded by the console's + | kernel. Foreach "path" present on the array provided below the kernel + | will extract all "Illuminate\Console\Command" based class commands. + | + */ - 'paths' => [app_path('Commands')], + 'paths' => [app_path('Commands')], - /* - |-------------------------------------------------------------------------- - | Added Commands - |-------------------------------------------------------------------------- - | - | You may want to include a single command class without having to load an - | entire folder. Here you can specify which commands should be added to - | your list of commands. The console's kernel will try to load them. - | - */ + /* + |-------------------------------------------------------------------------- + | Added Commands + |-------------------------------------------------------------------------- + | + | You may want to include a single command class without having to load an + | entire folder. Here you can specify which commands should be added to + | your list of commands. The console's kernel will try to load them. + | + */ - 'add' => [ - // .. - ], + 'add' => [ + // .. + ], - /* - |-------------------------------------------------------------------------- - | Hidden Commands - |-------------------------------------------------------------------------- - | - | Your application commands will always be visible on the application list - | of commands. But you can still make them "hidden" specifying an array - | of commands below. All "hidden" commands can still be run/executed. - | - */ + /* + |-------------------------------------------------------------------------- + | Hidden Commands + |-------------------------------------------------------------------------- + | + | Your application commands will always be visible on the application list + | of commands. But you can still make them "hidden" specifying an array + | of commands below. All "hidden" commands can still be run/executed. + | + */ - 'hidden' => [ - NunoMaduro\LaravelConsoleSummary\SummaryCommand::class, - Symfony\Component\Console\Command\HelpCommand::class, - Illuminate\Console\Scheduling\ScheduleRunCommand::class, - Illuminate\Console\Scheduling\ScheduleFinishCommand::class, - Illuminate\Foundation\Console\VendorPublishCommand::class, - ], + 'hidden' => [ + NunoMaduro\LaravelConsoleSummary\SummaryCommand::class, + Symfony\Component\Console\Command\HelpCommand::class, + Illuminate\Console\Scheduling\ScheduleRunCommand::class, + Illuminate\Console\Scheduling\ScheduleFinishCommand::class, + Illuminate\Foundation\Console\VendorPublishCommand::class, + ], - /* - |-------------------------------------------------------------------------- - | Removed Commands - |-------------------------------------------------------------------------- - | - | Do you have a service provider that loads a list of commands that - | you don't need? No problem. Laravel Zero allows you to specify - | below a list of commands that you don't to see in your app. - | - */ + /* + |-------------------------------------------------------------------------- + | Removed Commands + |-------------------------------------------------------------------------- + | + | Do you have a service provider that loads a list of commands that + | you don't need? No problem. Laravel Zero allows you to specify + | below a list of commands that you don't to see in your app. + | + */ - 'remove' => [ - // .. - ], + 'remove' => [ + // .. + ], ]; diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index 547152f..bc19a90 100755 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -1,22 +1,24 @@ make(Kernel::class)->bootstrap(); + $app->make(Kernel::class)->bootstrap(); - return $app; - } + return $app; + } } diff --git a/tests/Feature/InspiringCommandTest.php b/tests/Feature/InspiringCommandTest.php index 358e77b..5b1fdfb 100755 --- a/tests/Feature/InspiringCommandTest.php +++ b/tests/Feature/InspiringCommandTest.php @@ -1,20 +1,27 @@ artisan('inspiring') - ->expectsOutput('Simplicity is the ultimate sophistication.') - ->assertExitCode(0); - } + /** + * A basic test example. + * + * @return void + */ + public function testInspiringCommand() + { + $this->artisan('inspiring') + ->expectsOutput('Simplicity is the ultimate sophistication.') + ->assertExitCode(0) + ; + } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 50602b9..f4bf1d8 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,10 +1,12 @@ assertTrue(true); - } + /** + * A basic test example. + * + * @return void + */ + public function testBasicTest() + { + $this->assertTrue(true); + } }