Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rearrange src/commands directory following the new conventions #165

Merged
merged 25 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .devtools/phpstan_baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ parameters:
-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Console\\\\Application\\:\\:getKernel\\(\\)\\.$#"
count: 1
path: ../src/Commands/CheckServiceContainer.php
path: ../src/Commands/Container/ContainerCheck.php

# That's fine, dump() can handle multiple values - This is not an error. https://github.com/symfony/var-dumper/blob/3.4/Resources/functions/dump.php
-
message: "#^Function dump invoked with 2 parameters, 1 required\\.$#"
count: 1
path: ../src/Commands/Configuration/Export.php
path: ../src/Commands/Configuration/ConfigurationExport.php
36 changes: 36 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: PHPUnit
on:
- push
- pull_request
jobs:
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.0.0

- name: Cache vendor folder
uses: actions/cache@v1
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}

- name: Cache composer folder
uses: actions/cache@v2
with:
path: ~/.composer/cache
key: php-composer-cache

- name: "Setup Php 7.2"
uses: shivammathur/setup-php@v2
with:
php-version: '7.2'

- name: "Install Composer"
run: composer install

- name: Run PHPUnit
run : |
cd ${{ github.workspace }}
./vendor/bin/phpunit -c tests/Unit/phpunit.xml
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ grumphp.yml

; ide
/.idea

; tests
.phpunit.result.cache
59 changes: 28 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,35 @@ php bin/console pr:mo install fop_console
## Current commands

* `fop:about:version` Display the Fop Console version (on disk, on database, latest available release)
* `fop:add-hook` Create a new hook in database
* `fop:category` Manage empty categories
* `fop:check-container` Health check of the Service Container
* `fop:clear-cache` Replace the cache directory with an empty one.
* `fop:cache:clear` Replace the cache directory with an empty one.
* `fop:category:clean` Manage empty categories
* `fop:configuration:export` Export configuration values (from ps_configuration table)
* `fop:configuration:import` Import configuration values
* `fop:container:check` Health check of the Service Container
* `fop:customer-groups` Customer groups
* `fop:debug-mode` Enable or Disable debug mode.
* `fop:dev:setup-env` Install your project for local developement
* `fop:employees:list` List registered employees
* `fop:export` Allows to export data in XML
* `fop:employee:list` List registered employees
* `fop:environment:debug-mode` Enable or Disable debug mode.
* `fop:environment:setup-dev` Install your project for local developement
* `fop:export:data` Allows to export data in XML
* `fop:generate:htaccess` Generate the .htaccess file
* `fop:generate:robots` Generate the robots.txt file
* `fop:modules:hook` Attach one module on specific hook
* `fop:modules:unhook` Detach module from hook
* `fop:modules:hooks` Get modules list
* `fop:modules:non-essential` Manage non essential modules
* `fop:modules:rename` Rename a module
* `fop:images:generate:categories` Regenerate categories thumbnails
* `fop:images:generate:manufacturers` Regenerate manufacturers thumbnails
* `fop:images:generate:products` Regenerate products thumbnails
* `fop:images:generate:stores` Regenerate stores thumbnails
* `fop:images:generate:suppliers` Regenerate suppliers thumbnails
* `fop:latest-products` Displays the latest products
* `fop:maintenance` Configure maintenance mode
* `fop:group:transfer-customers` Transfers or add customers from a group to an other
* `fop:hook:add` Create hook in database
* `fop:image:generate:categories` Regenerate categories thumbnails
* `fop:image:generate:manufacturers` Regenerate manufacturers thumbnails
* `fop:image:generate:products` Regenerate products thumbnails
* `fop:image:generate:stores` Regenerate stores thumbnails
* `fop:image:generate:suppliers` Regenerate suppliers thumbnails
* `fop:module:hook` Attach one module on specific hook
* `fop:module:hooks` Get modules list
* `fop:module:non-essential` Manage non essential modules
* `fop:module:rename` Rename a module
* `fop:module:unhook` Detach module from hook
* `fop:override:make` Generate a file to make an override
* `fop:shop-status` Display shops statuses
* `fop:theme-reset` Reset current (or selected) theme

* `fop:product:latest` Displays the latest products
* `fop:shop:maintenance` Configure maintenance mode
* `fop:shop:status` Display shops statuses
* `fop:theme:reset-layout` Reset current (or selected) theme

## Create your owns Commands

Expand All @@ -76,27 +76,24 @@ to extends our class.

// psr-4 autoloader

// if the command is located at src/Commands
namespace FOP\Console\Commands;
// or if command is located in a subfolder
namespace FOP\Console\Commands\Domain; // e.g. namespace FOP\Console\Commands\Configuration

use FOP\Console\Command;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

final class MyCommand extends Command
final class DomainAction extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('fop:mycommand') // e.g 'fop:shop-status'
->setName('fop:domain') // e.g 'fop:export'
// or
->setName('fop:domain:mycommand') // e.g 'fop:configuration:export'
->setName('fop:domain:action') // e.g 'fop:configuration:export'
->setDescription('Describe the command on a user perspective.');
}

Expand Down Expand Up @@ -128,12 +125,12 @@ To list only fop commands :

To toggle the debug-mode (_PS_DEV_MODE_) run :
```shell
./bin/console fop:debug-mode toggle
./bin/console fop:environment:debug toggle
```

To get help about a command :
```shell
./bin/console help fop:debug-mode
./bin/console help fop:environment:debug
```

You are ready to go !
Expand Down
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
"FOP\\Console\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"FOP\\Console\\Tests\\": "tests/"
}
},
"require": {
"php": "^7.1",
"laminas/laminas-code": "3.4.1",
Expand All @@ -26,7 +31,8 @@
"require-dev": {
"prestashop/php-dev-tools": "4.*",
"phpro/grumphp": "0.19.1",
"phpstan/phpstan": "^0.12.58"
"phpstan/phpstan": "^0.12.58",
"phpunit/phpunit": "^7.0"
},
"scripts": {
"fop_check": [
Expand Down
Loading