├── version.txt ├── .github ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── 06_other.md │ ├── 05_support.md │ ├── 04_questions.md │ ├── 03_enhancement.md │ ├── 02_feature_request.md │ └── 01_bugs.md ├── FUNDING.yml ├── doc │ └── magerun-logo.png ├── CONTRIBUTING.md ├── dependabot.yml ├── workflows │ ├── scripts │ │ ├── linux-setup.sh │ │ └── update-dist-repo.sh │ ├── composer.yml │ ├── php-cs-fixer.yml │ ├── php_compatibility.yml │ └── phar_build_and_update.yml └── PULL_REQUEST_TEMPLATE.md ├── bin ├── compile-bash-autocompletion ├── n98-magerun └── list-refs.sh ├── tests ├── N98 │ ├── Magento │ │ ├── Command │ │ │ ├── Script │ │ │ │ └── Repository │ │ │ │ │ ├── _scripts │ │ │ │ │ ├── bar.magerun │ │ │ │ │ ├── foo.magerun │ │ │ │ │ └── hello-world.magerun │ │ │ │ │ ├── ListCommandTest.php │ │ │ │ │ └── RunCommandTest.php │ │ │ ├── MagentoConnect │ │ │ │ ├── _files │ │ │ │ │ └── cache.cfg │ │ │ │ ├── ListExtensionsCommandTest.php │ │ │ │ └── ValidateExtensionCommandTest.php │ │ │ ├── Developer │ │ │ │ ├── Module │ │ │ │ │ ├── Rewrite │ │ │ │ │ │ └── fixture │ │ │ │ │ │ │ ├── Le_Foo_Le_Bar_Fine.php │ │ │ │ │ │ │ ├── Le_Foo_Le_Bar.php │ │ │ │ │ │ │ ├── Le_Foo_Le_Bar_R2.php │ │ │ │ │ │ │ └── Le_Foo_Le_Bar_R1.php │ │ │ │ │ ├── ListCommandTest.php │ │ │ │ │ └── Observer │ │ │ │ │ │ └── ListCommandTest.php │ │ │ │ ├── Theme │ │ │ │ │ ├── ListCommandTest.php │ │ │ │ │ └── InfoCommandTest.php │ │ │ │ ├── Translate │ │ │ │ │ ├── SetCommandTest.php │ │ │ │ │ ├── InlineAdminCommandTest.php │ │ │ │ │ └── InlineShopCommandTest.php │ │ │ │ ├── Setup │ │ │ │ │ └── Script │ │ │ │ │ │ └── AttributeCommandTest.php │ │ │ │ ├── Log │ │ │ │ │ └── LogCommand.php │ │ │ │ ├── SymlinksCommandTest.php │ │ │ │ ├── ProfilerCommandTest.php │ │ │ │ ├── MergeJsCommandTest.php │ │ │ │ ├── MergeCssCommandTest.php │ │ │ │ ├── TemplateHintsCommandTest.php │ │ │ │ ├── TemplateHintsBlocksCommandTest.php │ │ │ │ └── Ide │ │ │ │ │ └── PhpStorm │ │ │ │ │ └── MetaCommandTest.php │ │ │ ├── HelpCommandTest.php │ │ │ ├── ListCommandTest.php │ │ │ ├── Customer │ │ │ │ └── ListCommandTest.php │ │ │ ├── System │ │ │ │ ├── Cron │ │ │ │ │ ├── ListCommandTest.php │ │ │ │ │ ├── HistoryCommandTest.php │ │ │ │ │ ├── RunCommandTest.php │ │ │ │ │ └── ServerEnvironmentTest.php │ │ │ │ ├── Setup │ │ │ │ │ ├── RunCommandTest.php │ │ │ │ │ ├── IncrementalCommandStub.php │ │ │ │ │ ├── IncrementalCommandTest.php │ │ │ │ │ └── CompareVersionsCommandTest.php │ │ │ │ ├── Store │ │ │ │ │ ├── ListCommandTest.php │ │ │ │ │ └── Config │ │ │ │ │ │ └── BaseUrlListCommandTest.php │ │ │ │ ├── Website │ │ │ │ │ └── ListCommandTest.php │ │ │ │ ├── CheckCommandTest.php │ │ │ │ ├── InfoCommandTest.php │ │ │ │ ├── Url │ │ │ │ │ └── ListCommandTest.php │ │ │ │ └── MaintenanceCommandTest.php │ │ │ ├── Cache │ │ │ │ ├── FlushCommandTest.php │ │ │ │ ├── ListCommandTest.php │ │ │ │ ├── ReportCommandTest.php │ │ │ │ ├── Dir │ │ │ │ │ └── FlushCommandTest.php │ │ │ │ ├── DisableCommandTest.php │ │ │ │ ├── EnableCommandTest.php │ │ │ │ └── ViewCommandTest.php │ │ │ ├── _files │ │ │ │ └── test.mr │ │ │ ├── Config │ │ │ │ ├── DumpCommandTest.php │ │ │ │ └── SearchCommandTest.php │ │ │ ├── Media │ │ │ │ └── DumpCommand.php │ │ │ ├── Indexer │ │ │ │ ├── ListCommandTest.php │ │ │ │ └── ReindexCommandTest.php │ │ │ ├── Database │ │ │ │ ├── QueryCommandTest.php │ │ │ │ ├── InfoCommandTest.php │ │ │ │ └── Maintain │ │ │ │ │ └── CheckTablesCommandTest.php │ │ │ ├── Admin │ │ │ │ └── User │ │ │ │ │ └── ListCommandTest.php │ │ │ ├── Eav │ │ │ │ └── Attribute │ │ │ │ │ ├── ListCommandTest.php │ │ │ │ │ └── ViewCommandTest.php │ │ │ ├── Design │ │ │ │ └── DemoNoticeCommandTest.php │ │ │ ├── Installer │ │ │ │ └── InstallCommandTester.php │ │ │ └── Cms │ │ │ │ └── Block │ │ │ │ └── ToggleCommandTest.php │ │ ├── _ApplicationTestComposer │ │ │ ├── n98-magerun.yaml │ │ │ └── FooCommand.php │ │ ├── _ApplicationTestModules │ │ │ └── test_dummy_module │ │ │ │ ├── n98-magerun.yaml │ │ │ │ └── src │ │ │ │ └── TestModule │ │ │ │ └── FooCommand.php │ │ ├── _ApplicationTestSrc │ │ │ └── N98MagerunTest │ │ │ │ ├── AlternativeConfigModel.php │ │ │ │ └── TestDummyCommand.php │ │ ├── Application │ │ │ └── ConfigurationLoaderTest.php │ │ ├── TestApplicationTest.php │ │ └── local.xml │ └── Util │ │ ├── Unicode │ │ └── CharsetTest.php │ │ ├── StringTypedTest.php │ │ ├── ExecTest.php │ │ ├── Console │ │ └── Helper │ │ │ ├── IoHelperTest.php │ │ │ └── Table │ │ │ └── Renderer │ │ │ ├── RenderFactoryTest.php │ │ │ └── TestCase.php │ │ ├── BinaryStringTest.php │ │ ├── AutoloadRestorerTest.php │ │ └── WindowsSystemTest.php ├── bats │ └── test_helper │ │ ├── bats-assert │ │ ├── load.bash │ │ ├── script │ │ │ └── install-bats.sh │ │ ├── package.json │ │ ├── .travis.yml │ │ └── CHANGELOG.md │ │ └── bats-support │ │ ├── package.json │ │ ├── .travis.yml │ │ ├── load.bash │ │ ├── script │ │ └── install-bats.sh │ │ ├── src │ │ └── error.bash │ │ └── CHANGELOG.md ├── readme.rst ├── bootstrap.php └── check-coverage.php ├── .ddev ├── commands │ └── web │ │ ├── phpstan │ │ ├── rector │ │ └── php-cs-fixer └── docker-compose.magento-volumes.yaml ├── res ├── twig │ └── dev │ │ └── module │ │ └── create │ │ ├── modman.twig │ │ ├── app │ │ └── etc │ │ │ └── modules │ │ │ └── definition.twig │ │ └── composer.twig ├── autocompletion │ ├── fish │ │ └── n98-magerun.phar.fish │ └── zsh │ │ └── n98-magerun.plugin.zsh └── dev │ └── console_auto_prepend.php ├── src ├── N98 │ ├── Magento │ │ ├── Application │ │ │ └── Console │ │ │ │ └── Events.php │ │ └── Command │ │ │ ├── CommandConfigAware.php │ │ │ ├── System │ │ │ ├── Check │ │ │ │ ├── SimpleCheck.php │ │ │ │ ├── Settings │ │ │ │ │ ├── SecureBaseUrlCheck.php │ │ │ │ │ ├── UnsecureBaseUrlCheck.php │ │ │ │ │ ├── SecureCookieDomainCheck.php │ │ │ │ │ └── UnsecureCookieDomainCheck.php │ │ │ │ ├── StoreCheck.php │ │ │ │ ├── WebsiteCheck.php │ │ │ │ ├── ResultCollection.php │ │ │ │ ├── MySQL │ │ │ │ │ ├── VersionCheck.php │ │ │ │ │ ├── ResourceCheck.php │ │ │ │ │ └── EnginesCheck.php │ │ │ │ └── PHP │ │ │ │ │ └── ExtensionsCheck.php │ │ │ ├── Cron │ │ │ │ ├── ListCommand.php │ │ │ │ └── ServerEnvironment.php │ │ │ ├── Store │ │ │ │ └── ListCommand.php │ │ │ └── Website │ │ │ │ └── ListCommand.php │ │ │ ├── CommandAware.php │ │ │ ├── Developer │ │ │ ├── Module │ │ │ │ ├── Disableenable │ │ │ │ │ ├── EnableCommand.php │ │ │ │ │ └── DisableCommand.php │ │ │ │ └── Rewrite │ │ │ │ │ ├── CanNotAutoloadCollaboratorClassException.php │ │ │ │ │ ├── ClassExistsThrownException.php │ │ │ │ │ └── ClassUtil.php │ │ │ ├── Console │ │ │ │ └── Psy │ │ │ │ │ └── Shell.php │ │ │ ├── Setup │ │ │ │ └── Script │ │ │ │ │ └── Attribute │ │ │ │ │ └── EntityType │ │ │ │ │ ├── EntityType.php │ │ │ │ │ └── Factory.php │ │ │ ├── MergeJsCommand.php │ │ │ ├── MergeCssCommand.php │ │ │ ├── ProfilerCommand.php │ │ │ ├── Log │ │ │ │ └── LogCommand.php │ │ │ ├── SymlinksCommand.php │ │ │ ├── Translate │ │ │ │ ├── InlineShopCommand.php │ │ │ │ └── InlineAdminCommand.php │ │ │ ├── TemplateHintsCommand.php │ │ │ ├── TemplateHintsBlocksCommand.php │ │ │ └── Report │ │ │ │ └── CountCommand.php │ │ │ ├── Design │ │ │ └── DemoNoticeCommand.php │ │ │ ├── Installer │ │ │ └── SubCommand │ │ │ │ ├── RemoveEmptyFolders.php │ │ │ │ ├── InstallComposerPackages.php │ │ │ │ ├── PostInstallation.php │ │ │ │ └── SetDirectoryPermissions.php │ │ │ ├── SubCommand │ │ │ └── SubCommandInterface.php │ │ │ ├── Script │ │ │ └── Repository │ │ │ │ └── AbstractRepositoryCommand.php │ │ │ ├── Admin │ │ │ ├── DisableNotificationsCommand.php │ │ │ └── User │ │ │ │ ├── AbstractAdminUserCommand.php │ │ │ │ └── ListCommand.php │ │ │ ├── Database │ │ │ ├── Compressor │ │ │ │ ├── Compressor.php │ │ │ │ ├── Uncompressed.php │ │ │ │ └── AbstractCompressor.php │ │ │ └── CreateCommand.php │ │ │ ├── Media │ │ │ └── Cache │ │ │ │ ├── Image │ │ │ │ └── ClearCommand.php │ │ │ │ └── JsCss │ │ │ │ └── ClearCommand.php │ │ │ ├── Indexer │ │ │ ├── ReindexAllCommand.php │ │ │ └── ListCommand.php │ │ │ └── Cache │ │ │ ├── ListCommand.php │ │ │ ├── ViewCommand.php │ │ │ └── EnableCommand.php │ ├── View │ │ ├── View.php │ │ └── PhpView.php │ ├── Util │ │ ├── Console │ │ │ ├── Helper │ │ │ │ └── Table │ │ │ │ │ └── Renderer │ │ │ │ │ ├── RendererInterface.php │ │ │ │ │ ├── JsonRenderer.php │ │ │ │ │ ├── CsvRenderer.php │ │ │ │ │ └── TextRenderer.php │ │ │ └── Enabler.php │ │ ├── Faker │ │ │ └── Provider │ │ │ │ └── Internet.php │ │ ├── StringTyped.php │ │ ├── Markdown │ │ │ └── VersionFilePrinter.php │ │ ├── Unicode │ │ │ └── Charset.php │ │ ├── BinaryString.php │ │ └── AutoloadRestorer.php │ └── MagerunBootstrap.php └── bootstrap.php ├── Makefile ├── .gitignore ├── .phpstan.dist.neon ├── .pre-commit-config.yaml ├── box.json.dist ├── .phpdoc.dist.xml ├── MIT-LICENSE.txt ├── .travis.yml ├── .phpunit.dist.xml ├── n98-magerun.phar ├── .php-cs-fixer.dist.php └── .rector.php /version.txt: -------------------------------------------------------------------------------- 1 | 3.0.1 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false -------------------------------------------------------------------------------- /bin/compile-bash-autocompletion: -------------------------------------------------------------------------------- 1 | ../build/bin/compile-bash-autocompletion.sh -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [sreichel] 2 | custom: ["https://www.paypal.me/sv3n1"] 3 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Script/Repository/_scripts/bar.magerun: -------------------------------------------------------------------------------- 1 | # Bar command 2 | sys:info 3 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Script/Repository/_scripts/foo.magerun: -------------------------------------------------------------------------------- 1 | # Foo command 2 | sys:info 3 | -------------------------------------------------------------------------------- /tests/bats/test_helper/bats-assert/load.bash: -------------------------------------------------------------------------------- 1 | source "$(dirname "${BASH_SOURCE[0]}")/src/assert.bash" 2 | -------------------------------------------------------------------------------- /.github/doc/magerun-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netz98/n98-magerun/HEAD/.github/doc/magerun-logo.png -------------------------------------------------------------------------------- /tests/bats/test_helper/bats-support/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bats-support", 3 | "version": "0.3.0", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Script/Repository/_scripts/hello-world.magerun: -------------------------------------------------------------------------------- 1 | # Cache Flush Command Test (Hello World) 2 | sys:info 3 | ! echo "${script.file}" 4 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/MagentoConnect/_files/cache.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netz98/n98-magerun/HEAD/tests/N98/Magento/Command/MagentoConnect/_files/cache.cfg -------------------------------------------------------------------------------- /tests/N98/Magento/_ApplicationTestComposer/n98-magerun.yaml: -------------------------------------------------------------------------------- 1 | autoloaders: 2 | Acme: %module%/src 3 | 4 | commands: 5 | customCommands: 6 | - Acme\FooCommand 7 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Please file pull requests against the develop branch. 2 | 3 | More in the Wiki: [Contribution-Process](https://github.com/netz98/n98-magerun/wiki/Contribution-Process). 4 | -------------------------------------------------------------------------------- /tests/N98/Magento/_ApplicationTestModules/test_dummy_module/n98-magerun.yaml: -------------------------------------------------------------------------------- 1 | autoloaders: 2 | TestModule: %module%/src 3 | 4 | commands: 5 | customCommands: 6 | - TestModule\FooCommand 7 | -------------------------------------------------------------------------------- /.ddev/commands/web/phpstan: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## Description: run PHPStan 4 | ## Usage: phpstan 5 | ## Example: ddev phpstan 6 | 7 | XDEBUG_MODE=off php vendor/bin/phpstan analyze "$@" 8 | -------------------------------------------------------------------------------- /.ddev/commands/web/rector: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## Description: run rector 4 | ## Usage: rector 5 | ## Example: ddev rector 6 | 7 | php vendor/bin/rector process --config .rector.php "$@" 8 | -------------------------------------------------------------------------------- /.ddev/commands/web/php-cs-fixer: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## Description: run PHP-CS-Fixer 4 | ## Usage: php-cs-fixer 5 | ## Example: ddev php-cs-fixer 6 | 7 | php vendor/bin/php-cs-fixer fix "$@" 8 | -------------------------------------------------------------------------------- /tests/bats/test_helper/bats-support/.travis.yml: -------------------------------------------------------------------------------- 1 | language: bash 2 | before_install: 3 | - ./script/install-bats.sh 4 | before_script: 5 | - export PATH="${HOME}/.local/bin:${PATH}" 6 | script: 7 | - bats test 8 | -------------------------------------------------------------------------------- /bin/n98-magerun: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | run(); 7 | 8 | __halt_compiler(); 9 | -------------------------------------------------------------------------------- /tests/bats/test_helper/bats-support/load.bash: -------------------------------------------------------------------------------- 1 | source "$(dirname "${BASH_SOURCE[0]}")/src/output.bash" 2 | source "$(dirname "${BASH_SOURCE[0]}")/src/error.bash" 3 | source "$(dirname "${BASH_SOURCE[0]}")/src/lang.bash" 4 | -------------------------------------------------------------------------------- /res/twig/dev/module/create/modman.twig: -------------------------------------------------------------------------------- 1 | src/app/code/{{ codePool }}/{{ vendorNamespace }}/{{ moduleName }} app/code/{{ codePool }}/{{ vendorNamespace }}/{{ moduleName }} 2 | src/app/etc/modules/* app/etc/modules/ 3 | -------------------------------------------------------------------------------- /tests/bats/test_helper/bats-assert/script/install-bats.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -o errexit 3 | set -o xtrace 4 | 5 | git clone --depth 1 https://github.com/sstephenson/bats 6 | cd bats && ./install.sh "${HOME}/.local" && cd .. && rm -rf bats 7 | -------------------------------------------------------------------------------- /tests/bats/test_helper/bats-support/script/install-bats.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -o errexit 3 | set -o xtrace 4 | 5 | git clone --depth 1 https://github.com/sstephenson/bats 6 | cd bats && ./install.sh "${HOME}/.local" && cd .. && rm -rf bats 7 | -------------------------------------------------------------------------------- /tests/bats/test_helper/bats-assert/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bats-assert", 3 | "version": "0.3.0", 4 | "private": true, 5 | "peerDependencies": { 6 | "bats-support": "git+https://github.com/ztombol/bats-support.git#v0.2.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.ddev/docker-compose.magento-volumes.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | web: 3 | volumes: 4 | - 'magento-test-environments:/opt/magento-test-environments' 5 | volumes: 6 | magento-test-environments: 7 | name: '${DDEV_SITENAME}-magento-test-environments' 8 | -------------------------------------------------------------------------------- /tests/N98/Magento/_ApplicationTestSrc/N98MagerunTest/AlternativeConfigModel.php: -------------------------------------------------------------------------------- 1 | 9 | * 10 | * Class definition that just works when it is included from the same directory 11 | */ 12 | class Le_Foo_Le_Bar_Fine {} 13 | -------------------------------------------------------------------------------- /.github/workflows/scripts/linux-setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | 5 | # Basic tools 6 | 7 | set -x 8 | 9 | # bats (for testing) 10 | git clone --branch v1.2.1 https://github.com/bats-core/bats-core.git /tmp/bats-core && pushd /tmp/bats-core >/dev/null && sudo ./install.sh /usr/local 11 | 12 | # Show info to simplify debugging 13 | lsb_release -a 14 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Magerun pull-request check-list: 2 | 3 | - [ ] Pull request against develop branch (if not, just close and create a new one against it) 4 | - [ ] README.md reflects changes (if any) 5 | 6 | Subject: (50 characters or less) 7 | 8 | Fixes # . 9 | 10 | Changes proposed in this pull request: 11 | 12 | - ... 13 | 14 | - ... 15 | 16 | - ... 17 | -------------------------------------------------------------------------------- /res/twig/dev/module/create/app/etc/modules/definition.twig: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <{{ vendorNamespace }}_{{ moduleName }}> 5 | true 6 | {{ codePool }} 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /res/autocompletion/fish/n98-magerun.phar.fish: -------------------------------------------------------------------------------- 1 | # Installation: 2 | # This assumes that "n98-magerun.phar" is in your path! 3 | # Copy to ~/.config/fish/completions/n98-magerun.phar.fish 4 | # open new or restart existing shell session 5 | 6 | for cmd in (n98-magerun.phar --raw --no-ansi list | sed "s/[[:space:]].*//g"); 7 | complete -f -c n98-magerun.phar -a $cmd; 8 | end 9 | 10 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/System/Check/Settings/SecureBaseUrlCheck.php: -------------------------------------------------------------------------------- 1 | 9 | * 10 | * Class definition that will cause a warning when the non-existing parent-class is included from the same directory 11 | */ 12 | class Le_Foo_Le_Bar extends Le_Foo_Le_Bar_Nexiste_Pas {} 13 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/System/Check/Settings/UnsecureCookieDomainCheck.php: -------------------------------------------------------------------------------- 1 | 9 | * 10 | * Class definition that will cause a warning when the non-existing parent-class is included from the same directory 11 | */ 12 | class Le_Foo_Le_Bar_R2 extends Le_Foo_Le_Bar_Nexiste_Pas {} 13 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/System/Check/StoreCheck.php: -------------------------------------------------------------------------------- 1 | assertSame('✖', Charset::convertInteger(Charset::UNICODE_CROSS_CHAR)); 14 | $this->assertSame('✔', Charset::convertInteger(Charset::UNICODE_CHECKMARK_CHAR)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/06_other.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F4AC Anything else?" 3 | about: Everything else which does not fit into any other category. 4 | 5 | --- 6 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/Module/Rewrite/fixture/Le_Foo_Le_Bar_R1.php: -------------------------------------------------------------------------------- 1 | 9 | * 10 | * Faux conditional class definition as this is common with module checks 11 | */ 12 | if (true) { 13 | class Le_Foo_Le_Bar_R1 extends Le_Foo_Le_Bar_R2 {} 14 | } else { 15 | class Le_Foo_Le_Bar_R1 extends Le_Foo_Le_Bar_Nexiste_Pas {} 16 | } 17 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Developer/Module/Rewrite/CanNotAutoloadCollaboratorClassException.php: -------------------------------------------------------------------------------- 1 | init(); 5 | $application->detectMagento(); 6 | if ($application->initMagento()) { 7 | echo <<addCommands($this->getDefaultCommands()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/N98/Magento/_ApplicationTestComposer/FooCommand.php: -------------------------------------------------------------------------------- 1 | setName('acme:foo'); 16 | } 17 | 18 | protected function execute(InputInterface $input, OutputInterface $output): int 19 | { 20 | return 0; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: git://github.com/pre-commit/pre-commit-hooks 3 | sha: v0.9.5 4 | hooks: 5 | - id: check-json 6 | - id: check-xml 7 | - id: check-merge-conflict 8 | - id: check-byte-order-marker 9 | - repo: git://github.com/netz98/pre-commit-php.git 10 | sha: 1.3.0 11 | hooks: 12 | - id: php-cs-fixer 13 | args: 14 | - -q 15 | - --config-file=.php_cs 16 | - id: php-lint-all 17 | - id: php-unit 18 | args: 19 | - "-c" 20 | - "tests/unit" 21 | - "--debug" 22 | 23 | 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/05_support.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "🦮 Support" 3 | about: If you need support 4 | labels: support 5 | 6 | --- 7 | 12 | 13 | ## Your Question 14 | 15 | -------------------------------------------------------------------------------- /src/N98/Util/Faker/Provider/Internet.php: -------------------------------------------------------------------------------- 1 | getApplication()->find('help'); 14 | 15 | $commandTester = new CommandTester($command); 16 | $commandTester->execute( 17 | ['command' => 'help'], 18 | ); 19 | 20 | $this->assertStringContainsString('The help command displays help for a given command', $commandTester->getDisplay()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/N98/Magento/Application/ConfigurationLoaderTest.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace N98\Magento\Application; 12 | 13 | use N98\Magento\Command\TestCase; 14 | use Symfony\Component\Console\Output\NullOutput; 15 | 16 | final class ConfigurationLoaderTest extends TestCase 17 | { 18 | public function testCreation() 19 | { 20 | $configurationLoader = new ConfigurationLoader([], false, new NullOutput()); 21 | $this->assertInstanceOf(__NAMESPACE__ . '\\ConfigurationLoader', $configurationLoader); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/ListCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication()->find('list'); 14 | 15 | $commandTester = new CommandTester($command); 16 | $commandTester->execute( 17 | ['command' => 'list'], 18 | ); 19 | 20 | $this->assertStringContainsString(sprintf('n98-magerun %s by valantic CEC', $this->getApplication()->getVersion()), $commandTester->getDisplay()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/bootstrap.php: -------------------------------------------------------------------------------- 1 | getMessage()); 18 | if (array_intersect(['-vvv', '-vv', '-v', '--verbose'], $argv) !== []) { 19 | printf("%s\n", $exception->getTraceAsString()); 20 | } 21 | 22 | exit(1); 23 | } 24 | -------------------------------------------------------------------------------- /src/N98/Util/Console/Helper/Table/Renderer/JsonRenderer.php: -------------------------------------------------------------------------------- 1 | writeln($out); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.phpdoc.dist.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | docs/api 11 | docs/cache 12 | 13 | 14 | 15 | 16 | src 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tests/N98/Util/StringTypedTest.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace N98\Util; 12 | 13 | use PHPUnit\Framework\TestCase; 14 | 15 | /** 16 | * Class StringTypedTest 17 | * 18 | * @package N98\Util 19 | * @covers N98\Util\StringTyped 20 | */ 21 | final class StringTypedTest extends TestCase 22 | { 23 | public function testScope() 24 | { 25 | $this->assertTrue(StringTyped::parseBoolOption('true')); 26 | 27 | $this->assertSame('inactive', StringTyped::formatActive(null)); 28 | $this->assertSame('active', StringTyped::formatActive('1')); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Developer/Setup/Script/Attribute/EntityType/EntityType.php: -------------------------------------------------------------------------------- 1 | 12 | 13 | ## Your Question 14 | 15 | * Source File: 16 | * Line(s): 17 | * Question: -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Customer/ListCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('customer:list'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute(['command' => $command->getName()]); 21 | 22 | $this->assertMatchesRegularExpression('/email/', $commandTester->getDisplay()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/System/Cron/ListCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('sys:cron:list'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute(['command' => $command->getName()]); 21 | 22 | $this->assertMatchesRegularExpression('/Cronjob List/', $commandTester->getDisplay()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/N98/Util/StringTyped.php: -------------------------------------------------------------------------------- 1 | getApplication(); 16 | $application->add(new FlushCommand()); 17 | 18 | $command = $this->getApplication()->find('cache:flush'); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute(['command' => $command->getName()]); 22 | 23 | $this->assertMatchesRegularExpression('/Cache cleared/', $commandTester->getDisplay()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/_files/test.mr: -------------------------------------------------------------------------------- 1 | # Comment 2 | cache:list 3 | 4 | ${foo}=foo.sql 5 | ${bar}=${foo}.gz 6 | ! echo "BAR: ${bar}" 7 | 8 | # Another comment 9 | 10 | # Shell exec with magerun script var 11 | ! echo "magento.root: ${magento.root}" 12 | ! echo "magento.edition: ${magento.edition}" 13 | ! echo "magento.version: ${magento.version}" 14 | ! echo "php.version: ${php.version}" 15 | ! echo "magerun.version: ${magerun.version}" 16 | 17 | # Ignore this line and trim whitespaces for next command 18 | sys:website:list 19 | 20 | # magerun command with script var 21 | db:dump --dry-run --print-only-filename ${foo} 22 | 23 | # Set a config var and change it to previous value in one "session" 24 | config:get web/secure/base_url 25 | config:get web/seo/use_rewrites 26 | config:set "web/seo/use_rewrites" 1 27 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Developer/MergeJsCommand.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new DumpCommand()); 16 | 17 | $command = $this->getApplication()->find('config:dump'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName(), 'xpath' => 'global/install'], 22 | ); 23 | $this->assertStringContainsString('date', $commandTester->getDisplay()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/Theme/ListCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('dev:theme:list'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName()], 22 | ); 23 | 24 | $this->assertStringContainsString('base/default', $commandTester->getDisplay()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/System/Setup/RunCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new CompareVersionsCommand()); 16 | 17 | $command = $this->getApplication()->find('sys:setup:run'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName()], 22 | ); 23 | 24 | $this->assertMatchesRegularExpression('/done/', $commandTester->getDisplay()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Developer/MergeCssCommand.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('dev:module:list'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName()], 22 | ); 23 | 24 | $this->assertMatchesRegularExpression('/Mage_Core/', $commandTester->getDisplay()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Media/DumpCommand.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new DumpCommand()); 16 | 17 | $command = $this->getApplication()->find('media:dump'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName(), 'filename' => tempnam('media_'), '--strip' => true], 22 | ); 23 | 24 | self::assertContains('Compress directory', $commandTester->getDisplay()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/System/Cron/HistoryCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('sys:cron:history'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName()], 22 | ); 23 | 24 | $this->assertMatchesRegularExpression('/Last executed jobs/', $commandTester->getDisplay()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.github/workflows/composer.yml: -------------------------------------------------------------------------------- 1 | name: Composer 2 | 3 | on: 4 | workflow_call: 5 | workflow_dispatch: 6 | 7 | jobs: 8 | composer: 9 | name: Validation 10 | runs-on: [ubuntu-latest] 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v5 15 | 16 | - name: Get composer cache directory 17 | id: composer-cache 18 | run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT 19 | 20 | - name: Cache dependencies 21 | uses: actions/cache@v5 22 | with: 23 | path: ${{ steps.composer-cache.outputs.dir }} 24 | key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} 25 | restore-keys: ${{ runner.os }}-composer- 26 | 27 | - name: Validate composer 28 | run: composer validate --strict --no-check-all 29 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Developer/Log/LogCommand.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('index:list'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute(['command' => $command->getName()]); 21 | 22 | // check if i.e. at least one index is listed 23 | $this->assertMatchesRegularExpression('/catalog_product_flat/', $commandTester->getDisplay()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/readme.rst: -------------------------------------------------------------------------------- 1 | ************** 2 | Test Framework 3 | ************** 4 | 5 | We deliver a test framework for n98-magerun commands. 6 | 7 | ============= 8 | Configuration 9 | ============= 10 | 11 | Set the environment variable `N98_MAGERUN_TEST_MAGENTO_ROOT` with a path to a magento installation 12 | which can be used to run tests. 13 | 14 | i.e. 15 | 16 | export N98_MAGERUN_TEST_MAGENTO_ROOT=/home/myinstallation 17 | 18 | ========= 19 | Run Tests 20 | ========= 21 | 22 | You need PHPUnit to run the tests. 23 | If you don't have PHPUnit installed on your system you can use the following command to install all test tools 24 | at once. 25 | 26 | ..code-block:: sh 27 | 28 | composer.phar --dev install 29 | 30 | Run PHPUnit in n98-magerun root folder. 31 | If you have installed with composer you can run:: 32 | 33 | vendor/bin/phpunit 34 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Design/DemoNoticeCommand.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('cache:list'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute(['command' => $command->getName()]); 21 | 22 | $this->assertMatchesRegularExpression('/config/', $commandTester->getDisplay()); 23 | $this->assertMatchesRegularExpression('/collections/', $commandTester->getDisplay()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /res/autocompletion/zsh/n98-magerun.plugin.zsh: -------------------------------------------------------------------------------- 1 | #compdef n98-magerun.phar 2 | 3 | # Installation: 4 | # This assumes that "n98-magerun.phar" is in your path 5 | # 6 | # Place this file in a directory listed in the $fpath variable. 7 | # You can add a directory to $fpath by adding a line like this to your 8 | # ~/.zshrc file: 9 | # 10 | # fpath=(~/.zsh_completion.d $fpath) 11 | # 12 | # Oh My Zsh Installation: 13 | # Copy to ~/.oh-my-zsh/custom/plugins/n98-magerun/n98-magerun.plugin.zsh 14 | # Edit plugins in your .zshrc e.g. "plugins=(git n98-magerun)" 15 | # 16 | # It will load the next time a shell session is started 17 | 18 | _n98_magerun_get_command_list () { 19 | n98-magerun.phar --raw --no-ansi list | sed "s/[[:space:]].*//g" 20 | } 21 | 22 | _n98_magerun () { 23 | compadd `_n98_magerun_get_command_list` 24 | } 25 | 26 | compdef _n98_magerun n98-magerun.phar 27 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/System/Store/ListCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('sys:store:list'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute(['command' => $command->getName()]); 21 | 22 | $this->assertMatchesRegularExpression('/id/', $commandTester->getDisplay()); 23 | $this->assertMatchesRegularExpression('/code/', $commandTester->getDisplay()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Indexer/ReindexCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ReindexCommand()); 16 | 17 | $command = $this->getApplication()->find('index:reindex'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName(), 'index_code' => 'tag_summary,tag_summary'], 22 | ); 23 | 24 | $this->assertStringContainsString('Successfully re-indexed tag_summary', $commandTester->getDisplay()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/N98/Magento/_ApplicationTestSrc/N98MagerunTest/TestDummyCommand.php: -------------------------------------------------------------------------------- 1 | setName('n98mageruntest:test:dummy') 17 | ->setDescription('Dummy command'); 18 | } 19 | 20 | protected function execute(InputInterface $input, OutputInterface $output): int 21 | { 22 | $this->detectMagento($output); 23 | if (!$this->initMagento()) { 24 | return 0; 25 | } 26 | 27 | $output->writeln('dummy'); 28 | return 0; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/Module/Observer/ListCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('dev:module:observer:list'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName(), 'type' => 'global'], 22 | ); 23 | 24 | $this->assertStringContainsString('controller_front_init_routers', $commandTester->getDisplay()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/N98/Util/ExecTest.php: -------------------------------------------------------------------------------- 1 | assertSame(0, $actual); 22 | } 23 | 24 | public function testFullParameters() 25 | { 26 | Exec::run('echo test', $commandOutput, $returnCode); 27 | 28 | $this->assertSame(Exec::CODE_CLEAN_EXIT, $returnCode); 29 | $this->assertStringStartsWith('test', $commandOutput); 30 | } 31 | 32 | public function testException() 33 | { 34 | $this->expectException(RuntimeException::class); 35 | Exec::run('foobar'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/N98/Util/Console/Helper/Table/Renderer/CsvRenderer.php: -------------------------------------------------------------------------------- 1 | getStream() : \STDOUT; 25 | 26 | fputcsv($stream, array_keys(reset($rows))); 27 | foreach ($rows as $row) { 28 | fputcsv($stream, $row); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/N98/Magento/_ApplicationTestModules/test_dummy_module/src/TestModule/FooCommand.php: -------------------------------------------------------------------------------- 1 | setName('testmodule:foo') 17 | ->setDescription('Test command registered in a module'); 18 | } 19 | 20 | /** 21 | * @return int|void 22 | */ 23 | protected function execute(InputInterface $input, OutputInterface $output): int 24 | { 25 | $this->detectMagento($output); 26 | if (!$this->initMagento()) { 27 | return 0; 28 | } 29 | 30 | return 0; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Installer/SubCommand/RemoveEmptyFolders.php: -------------------------------------------------------------------------------- 1 | files()->depth(3)->in(getcwd() . '/vendor'); 23 | if ($finder->count() == 0) { 24 | $filesystem = new Filesystem(); 25 | $filesystem->recursiveRemoveDirectory(getcwd() . '/vendor'); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/Theme/InfoCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('dev:theme:info'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName()], 22 | ); 23 | 24 | $this->assertStringContainsString('base/default', $commandTester->getDisplay()); 25 | $this->assertStringContainsString('Design Package Name', $commandTester->getDisplay()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/N98/Util/Console/Helper/Table/Renderer/TextRenderer.php: -------------------------------------------------------------------------------- 1 | $rows 22 | */ 23 | public function render(OutputInterface $output, array $rows): void 24 | { 25 | $table = new Table($output); 26 | $table->setStyle(new TableStyle()); 27 | $table->setHeaders(array_keys($rows[0])); 28 | $table->setRows($rows); 29 | $table->render(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/N98/Util/Markdown/VersionFilePrinter.php: -------------------------------------------------------------------------------- 1 | content = $content; 19 | } 20 | 21 | public function printFromVersion(string $startVersion): string 22 | { 23 | $contentToReturn = ''; 24 | 25 | $lines = preg_split("/((\r?\n)|(\r\n?))/", $this->content); 26 | if ($lines) { 27 | foreach ($lines as $line) { 28 | if ($line === $startVersion) { 29 | break; 30 | } 31 | 32 | $contentToReturn .= $line . "\n"; 33 | } 34 | } 35 | 36 | return trim($contentToReturn) . "\n"; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/Translate/SetCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new InlineAdminCommand()); 16 | $application->setAutoExit(false); 17 | 18 | $command = $this->getApplication()->find('dev:translate:set'); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute( 22 | ['command' => $command->getName(), 'string' => 'foo', 'translate' => 'bar', 'store' => 'admin'], 23 | ); 24 | $this->assertStringContainsString('foo => bar', $commandTester->getDisplay()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/System/Setup/IncrementalCommandStub.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace N98\Magento\Command\System\Setup; 12 | 13 | /** 14 | * Class IncrementalCommandStub 15 | */ 16 | class IncrementalCommandStub extends IncrementalCommand 17 | { 18 | /** @noinspection MagicMethodsValidityInspection */ 19 | public function __construct() 20 | { 21 | // missing parent constructor call by intention 22 | } 23 | 24 | /** 25 | * @param string $method 26 | * @param object|string $object 27 | * @param array $args 28 | * @return mixed 29 | */ 30 | public function callProtectedMethodFromObject($method, $object, $args = []) 31 | { 32 | return $this->_callProtectedMethodFromObject($method, $object, $args); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/SubCommand/SubCommandInterface.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace N98\Util\Console\Helper; 12 | 13 | use N98\Magento\Command\TestCase; 14 | use Symfony\Component\Console\Helper\HelperInterface; 15 | use Symfony\Component\Console\Output\OutputInterface; 16 | 17 | /** 18 | * Class IoHelperTest 19 | * 20 | * @package N98\Util\Console\Helper 21 | */ 22 | final class IoHelperTest extends TestCase 23 | { 24 | public function testCreation() 25 | { 26 | $ioHelper = new IoHelper(); 27 | $this->assertInstanceOf(IoHelper::class, $ioHelper); 28 | $this->assertInstanceOf(HelperInterface::class, $ioHelper); 29 | $this->assertNotInstanceOf(OutputInterface::class, $ioHelper->getOutput()); 30 | 31 | $this->assertSame('io', $ioHelper->getName()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Script/Repository/AbstractRepositoryCommand.php: -------------------------------------------------------------------------------- 1 | getApplication()->getConfig('script', 'folders'); 27 | $magentoRootFolder = $this->getApplication()->getMagentoRootFolder(); 28 | $scriptLoader = new ScriptLoader($folders, $magentoRootFolder); 29 | 30 | return $scriptLoader->getFiles(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/System/Store/Config/BaseUrlListCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new BaseUrlListCommand()); 16 | 17 | $command = $this->getApplication()->find('sys:store:config:base-url:list'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName()], 22 | ); 23 | 24 | $this->assertMatchesRegularExpression('/secure_baseurl/', $commandTester->getDisplay()); 25 | $this->assertMatchesRegularExpression('/unsecure_baseurl/', $commandTester->getDisplay()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/System/Website/ListCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('sys:website:list'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute(['command' => $command->getName()]); 21 | 22 | $this->assertMatchesRegularExpression('/Magento Websites/', $commandTester->getDisplay()); 23 | $this->assertMatchesRegularExpression('/id/', $commandTester->getDisplay()); 24 | $this->assertMatchesRegularExpression('/code/', $commandTester->getDisplay()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/N98/Util/Unicode/Charset.php: -------------------------------------------------------------------------------- 1 | assertEqualsCanonicalizing($expected, BinaryString::trimExplodeEmpty($delimiter, $string)); 25 | } 26 | 27 | /** 28 | * @return \Iterator<(int | string), mixed> 29 | */ 30 | public function trimExplodeEmptyProvider(): \Iterator 31 | { 32 | yield [',', 'Foo,Bar', ['Foo', 'Bar']]; 33 | yield ['#', ' Foo# Bar', ['Foo', 'Bar']]; 34 | yield [',', ',,Foo, Bar,,', ['Foo', 'Bar']]; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Database/QueryCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new QueryCommand()); 16 | 17 | $command = $this->getApplication()->find('db:query'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName(), 'query' => 'SHOW TABLES;'], 22 | ); 23 | 24 | $this->assertStringContainsString('admin_user', $commandTester->getDisplay()); 25 | $this->assertStringContainsString('catalog_product_entity', $commandTester->getDisplay()); 26 | $this->assertStringContainsString('wishlist', $commandTester->getDisplay()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Admin/User/ListCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('admin:user:list'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute(['command' => $command->getName()]); 21 | 22 | $this->assertStringContainsString('id', $commandTester->getDisplay()); 23 | $this->assertStringContainsString('user', $commandTester->getDisplay()); 24 | $this->assertStringContainsString('email', $commandTester->getDisplay()); 25 | $this->assertStringContainsString('status', $commandTester->getDisplay()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | setUseIncludePath(true); 24 | 25 | $paths = [ 26 | $base . '/app/code/local', 27 | $base . '/app/code/community', 28 | $base . '/app/code/core', 29 | $base . '/lib', 30 | ]; 31 | set_include_path(implode(PATH_SEPARATOR, $paths) . PATH_SEPARATOR . get_include_path()); 32 | unset($paths, $base); 33 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/System/Setup/IncrementalCommandTest.php: -------------------------------------------------------------------------------- 1 | callProtectedMethodFromObject('protectedMethod', $this, ['fooBar']); 25 | $this->assertSame('barBaz', $actual); 26 | } 27 | 28 | protected function protectedMethod($arg): string 29 | { 30 | $this->assertSame('fooBar', $arg); 31 | $this->addToAssertionCount(1); 32 | 33 | return 'barBaz'; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/N98/Util/Console/Helper/Table/Renderer/RenderFactoryTest.php: -------------------------------------------------------------------------------- 1 | create('csv'); 19 | $this->assertInstanceOf(CsvRenderer::class, $csv); 20 | 21 | $json = $rendererFactory->create('json'); 22 | $this->assertInstanceOf(JsonRenderer::class, $json); 23 | 24 | $xml = $rendererFactory->create('xml'); 25 | $this->assertInstanceOf(XmlRenderer::class, $xml); 26 | 27 | $invalidFormat = $rendererFactory->create('invalid_format'); 28 | $this->assertNotInstanceOf(\N98\Util\Console\Helper\Table\Renderer\RendererInterface::class, $invalidFormat); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/N98/View/PhpView.php: -------------------------------------------------------------------------------- 1 | template = $template; 21 | return $this; 22 | } 23 | 24 | /** 25 | * @param mixed $value 26 | */ 27 | public function assign(string $key, $value): PhpView 28 | { 29 | $this->vars[$key] = $value; 30 | return $this; 31 | } 32 | 33 | public function render(): string 34 | { 35 | extract($this->vars); 36 | ob_start(); 37 | include $this->template; 38 | $content = (string) ob_get_contents(); 39 | ob_end_clean(); 40 | 41 | return $content; 42 | } 43 | 44 | protected function xmlProlog(): string 45 | { 46 | return '' . "\n"; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/03_enhancement.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\u23F1\uFE0F Enhancement Request" 3 | about: Do you have an idea for an enhancement? 4 | labels: enhancement 5 | 6 | --- 7 | 12 | 13 | 14 | ## Current Implementation 15 | 16 | 17 | ## Suggested Enhancement 18 | 19 | 20 | ## Expected Benefits 21 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Database/Compressor/Compressor.php: -------------------------------------------------------------------------------- 1 | 12 | 13 | ## Feature description 14 | 15 | 20 | 21 | ## Problem and motivation 22 | 25 | 26 | ## Is this something you're interested in working on 27 | 28 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Installer/SubCommand/InstallComposerPackages.php: -------------------------------------------------------------------------------- 1 | output->writeln('Install composer packages'); 26 | $process = new Process(array_merge($this->config['composer_bin'], ['install'])); 27 | $process->setTimeout(86400); 28 | 29 | $process->start(); 30 | $process->wait(function ($type, $buffer): void { 31 | $this->output->write('composer > ' . $buffer, false); 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Eav/Attribute/ListCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('eav:attribute:list'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName(), '--filter-type' => 'catalog_product', '--add-source' => true], 22 | ); 23 | 24 | $this->assertStringContainsString('eav/entity_attribute_source_boolean', $commandTester->getDisplay()); 25 | $this->assertStringContainsString('sku', $commandTester->getDisplay()); 26 | $this->assertStringContainsString('catalog_product', $commandTester->getDisplay()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Cache/ReportCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('cache:report'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName(), '--tags' => true, '--mtime' => true], 22 | ); 23 | 24 | $this->assertMatchesRegularExpression('/ID/', $commandTester->getDisplay()); 25 | $this->assertMatchesRegularExpression('/EXPIRE/', $commandTester->getDisplay()); 26 | $this->assertMatchesRegularExpression('/MTIME/', $commandTester->getDisplay()); 27 | $this->assertMatchesRegularExpression('/TAGS/', $commandTester->getDisplay()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.github/workflows/php-cs-fixer.yml: -------------------------------------------------------------------------------- 1 | name: PHP-CS-Fixer 2 | 3 | on: 4 | workflow_call: 5 | workflow_dispatch: 6 | 7 | jobs: 8 | php-cs-fixer: 9 | name: Validation 10 | runs-on: [ubuntu-latest] 11 | 12 | steps: 13 | - name: Setup PHP 14 | uses: shivammathur/setup-php@v2 15 | with: 16 | php-version: 7.4 17 | 18 | - name: Checkout code 19 | uses: actions/checkout@v5 20 | 21 | - name: Get composer cache directory 22 | id: composer-cache 23 | run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT 24 | 25 | - name: Cache dependencies 26 | uses: actions/cache@v5 27 | with: 28 | path: ${{ steps.composer-cache.outputs.dir }} 29 | key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} 30 | restore-keys: ${{ runner.os }}-composer- 31 | 32 | - name: Install dependencies 33 | run: composer install --prefer-dist --no-progress --ignore-platform-req=ext-* 34 | 35 | - name: PHP-CS-Fixer 36 | run: php vendor/bin/php-cs-fixer fix --diff --dry-run 37 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/Setup/Script/AttributeCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new AttributeCommand()); 16 | $application->setAutoExit(false); 17 | 18 | $command = $this->getApplication()->find('dev:setup:script:attribute'); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute( 22 | ['command' => $command->getName(), 'entityType' => 'catalog_product', 'attributeCode' => 'sku'], 23 | ); 24 | $this->assertStringContainsString("'type' => 'static',", $commandTester->getDisplay()); 25 | $this->assertStringContainsString("Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', 'sku');", $commandTester->getDisplay()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/System/CheckCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new InfoCommand()); 16 | 17 | $command = $this->getApplication()->find('sys:check'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute(['command' => $command->getName()]); 21 | 22 | $this->assertMatchesRegularExpression('/SETTINGS/', $commandTester->getDisplay()); 23 | $this->assertMatchesRegularExpression('/FILESYSTEM/', $commandTester->getDisplay()); 24 | $this->assertMatchesRegularExpression('/PHP/', $commandTester->getDisplay()); 25 | $this->assertMatchesRegularExpression('/SECURITY/', $commandTester->getDisplay()); 26 | $this->assertMatchesRegularExpression('/MYSQL/', $commandTester->getDisplay()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/bats/test_helper/bats-assert/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | This project adheres to [Semantic Versioning](http://semver.org/). 5 | 6 | 7 | ## [0.3.0] - 2016-03-22 8 | 9 | ### Removed 10 | 11 | - Move `fail()` to `bats-support` 12 | 13 | 14 | ## [0.2.0] - 2016-03-11 15 | 16 | ### Added 17 | 18 | - `refute()` to complement `assert()` 19 | - `npm` support 20 | 21 | ### Fixed 22 | 23 | - Not consuming the `--` when stopping option parsing in 24 | `assert_output`, `refute_output`, `assert_line` and `refute_line` 25 | 26 | 27 | ## 0.1.0 - 2016-02-16 28 | 29 | ### Added 30 | 31 | - Reporting arbitrary failures with `fail()` 32 | - Generic assertions with `assert()` and `assert_equal()` 33 | - Testing exit status with `assert_success()` and `assert_failure()` 34 | - Testing output with `assert_output()` and `refute_output()` 35 | - Testing individual lines with `assert_line()` and `refute_line()` 36 | 37 | 38 | [0.3.0]: https://github.com/ztombol/bats-assert/compare/v0.2.0...v0.3.0 39 | [0.2.0]: https://github.com/ztombol/bats-assert/compare/v0.1.0...v0.2.0 40 | -------------------------------------------------------------------------------- /.github/workflows/scripts/update-dist-repo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail; 4 | set -x 5 | 6 | REF_TYPE=$(cut -d'/' -f2 <<< "$GITHUB_REF"); 7 | TAG=$(cut -d'/' -f3 <<< "$GITHUB_REF"); 8 | 9 | echo "Deploy tag: $TAG"; 10 | 11 | # prepare git commit 12 | git config --global user.email "$GIT_USER_EMAIL"; 13 | git config --global user.name "$GIT_USER_NAME"; 14 | 15 | git clone git@github.com:netz98/n98-magerun1-dist.git; 16 | 17 | cd n98-magerun1-dist || exit 1; 18 | 19 | ls -l ./n98-magerun; 20 | cp -v ../n98-magerun.phar ./n98-magerun; 21 | ls -l ./n98-magerun; 22 | 23 | git add ./n98-magerun; 24 | git commit -m "Version: $TAG" ./n98-magerun; 25 | git tag "$TAG"; 26 | 27 | if [ "$REF_TYPE" = 'tags' ]; then 28 | echo "----------------------------------------------------" 29 | echo "Pushing to dist repo." 30 | echo "----------------------------------------------------" 31 | git push; 32 | git push --tags; 33 | else 34 | echo "----------------------------------------------------" 35 | echo " Dry run. Not pushing to dist repo." 36 | echo "----------------------------------------------------" 37 | git push --dry-run; 38 | fi 39 | -------------------------------------------------------------------------------- /MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) netz98 GmbH 2 | 3 | https://www.netz98.de 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE 23 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Database/Compressor/Uncompressed.php: -------------------------------------------------------------------------------- 1 | hasPipeViewer()) { 22 | return 'pv ' . $fileName . ' | ' . $command; 23 | } 24 | 25 | return $command . ' < ' . $fileName; 26 | } 27 | 28 | public function getFileName(string $fileName, bool $pipe = true): string 29 | { 30 | if ($fileName === '') { 31 | return $fileName; 32 | } 33 | 34 | if (substr($fileName, -4, 4) !== '.sql' && substr($fileName, -4, 4) !== '.xml') { 35 | $fileName .= '.sql'; 36 | } 37 | 38 | return $fileName; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Eav/Attribute/ViewCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('eav:attribute:view'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName(), 'entityType' => 'catalog_product', 'attributeCode' => 'sku'], 22 | ); 23 | 24 | $this->assertStringContainsString('sku', $commandTester->getDisplay()); 25 | $this->assertStringContainsString('catalog_product_entity', $commandTester->getDisplay()); 26 | $this->assertStringContainsString('Backend-Type', $commandTester->getDisplay()); 27 | $this->assertStringContainsString('static', $commandTester->getDisplay()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/N98/Magento/TestApplicationTest.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace N98\Magento; 12 | 13 | use PHPUnit\Framework\TestCase; 14 | 15 | final class TestApplicationTest extends TestCase 16 | { 17 | public function testCreation() 18 | { 19 | $testApplication = new TestApplication($this); 20 | $this->assertInstanceOf(__NAMESPACE__ . '\TestApplication', $testApplication); 21 | } 22 | 23 | public function testMagentoTestRoot() 24 | { 25 | $testApplication = new TestApplication($this); 26 | $actual = $testApplication->getTestMagentoRoot(); 27 | $this->assertIsString($actual); 28 | $this->assertGreaterThan(10, strlen($actual)); 29 | $this->assertDirectoryExists($actual); 30 | } 31 | 32 | public function testGetApplication() 33 | { 34 | $testApplication = new TestApplication($this); 35 | $actual = $testApplication->getApplication(); 36 | $this->assertInstanceOf(__NAMESPACE__ . '\Application', $actual); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Config/SearchCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new DumpCommand()); 16 | 17 | $command = $this->getApplication()->find('config:search'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName(), 'text' => 'This message will be shown'], 22 | ); 23 | $this->assertStringContainsString('Found a field with a match', $commandTester->getDisplay()); 24 | 25 | $commandTester = new CommandTester($command); 26 | $commandTester->execute( 27 | ['command' => $command->getName(), 'text' => 'xyz1234567890'], 28 | ); 29 | $this->assertStringContainsString('No matches for xyz1234567890', $commandTester->getDisplay()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/Log/LogCommand.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new LogCommand()); 16 | $application->setAutoExit(false); 17 | 18 | $command = $this->getApplication()->find('dev:log'); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute( 22 | ['command' => $command->getName(), '--global' => true, '--on' => true], 23 | ); 24 | self::assertMatchesRegularExpression('/Development Log/', $commandTester->getDisplay()); 25 | 26 | $commandTester = new CommandTester($command); 27 | $commandTester->execute( 28 | ['command' => $command->getName(), '--global' => true, '--off' => true], 29 | ); 30 | 31 | self::assertMatchesRegularExpression('/Development Log/', $commandTester->getDisplay()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Database/CreateCommand.php: -------------------------------------------------------------------------------- 1 | setName('db:create') 22 | ->setDescription('Create currently configured database') 23 | ; 24 | } 25 | 26 | public function getHelp(): string 27 | { 28 | return <<getDatabaseHelper()->createDatabase($output); 38 | return Command::SUCCESS; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Developer/Translate/InlineShopCommand.php: -------------------------------------------------------------------------------- 1 | detectAskAndSetDeveloperIp($mageCoreModelStore, $disabled); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Script/Repository/ListCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $config = $application->getConfig(); 16 | $config['script']['folders'][] = __DIR__ . '/_scripts'; 17 | $application->setConfig($config); 18 | 19 | $application->add(new RunCommand()); 20 | 21 | $command = $this->getApplication()->find('script:repo:list'); 22 | 23 | $commandTester = new CommandTester($command); 24 | $commandTester->execute( 25 | ['command' => $command->getName()], 26 | ); 27 | 28 | $this->assertStringContainsString('Cache Flush Command Test (Hello World)', $commandTester->getDisplay()); 29 | $this->assertStringContainsString('Foo command', $commandTester->getDisplay()); 30 | $this->assertStringContainsString('Bar command', $commandTester->getDisplay()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/N98/Util/Console/Helper/Table/Renderer/TestCase.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace N98\Util\Console\Helper\Table\Renderer; 12 | 13 | use Symfony\Component\Console\Output\StreamOutput; 14 | 15 | /** 16 | * Class RendererTestCase 17 | * 18 | * @package N98\Util\Console\Helper\Table\Renderer 19 | */ 20 | abstract class TestCase extends \PHPUnit\Framework\TestCase 21 | { 22 | /** 23 | * helper method to get output as string out of a StreamOutput 24 | * 25 | * @param $output 26 | * 27 | * @return string all output 28 | */ 29 | protected function getOutputBuffer(StreamOutput $streamOutput) 30 | { 31 | $stream = $streamOutput->getStream(); 32 | 33 | rewind($stream); 34 | $display = stream_get_contents($stream); 35 | 36 | // Symfony2's StreamOutput has a hidden dependency on PHP_EOL which needs to be removed by 37 | // normalizing it to the standard newline for text here. 38 | $display = strtr($display, [PHP_EOL => "\n"]); 39 | 40 | return $display; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Developer/Module/Rewrite/ClassUtil.php: -------------------------------------------------------------------------------- 1 | className = $className; 28 | } 29 | 30 | public function exists(): bool 31 | { 32 | if (is_null($this->exists)) { 33 | $this->exists = ClassExistsChecker::create($this->className)->existsExtendsSafe(); 34 | } 35 | 36 | return $this->exists; 37 | } 38 | 39 | /** 40 | * This class is a $class (is or inherits from it) 41 | */ 42 | public function isA(ClassUtil $classUtil): bool 43 | { 44 | return is_a($this->className, $classUtil->className, true); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/SymlinksCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new SymlinksCommand()); 16 | $application->setAutoExit(false); 17 | 18 | $command = $this->getApplication()->find('dev:symlinks'); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute( 22 | ['command' => $command->getName(), '--global' => true, '--on' => true], 23 | ); 24 | $this->assertMatchesRegularExpression('/Symlinks allowed/', $commandTester->getDisplay()); 25 | 26 | $commandTester = new CommandTester($command); 27 | $commandTester->execute( 28 | ['command' => $command->getName(), '--global' => true, '--off' => true], 29 | ); 30 | 31 | $this->assertMatchesRegularExpression('/Symlinks denied/', $commandTester->getDisplay()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/ProfilerCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ProfilerCommand()); 16 | $application->setAutoExit(false); 17 | 18 | $command = $this->getApplication()->find('dev:profiler'); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute( 22 | ['command' => $command->getName(), '--global' => true, '--on' => true], 23 | ); 24 | $this->assertMatchesRegularExpression('/Profiler enabled/', $commandTester->getDisplay()); 25 | 26 | $commandTester = new CommandTester($command); 27 | $commandTester->execute( 28 | ['command' => $command->getName(), '--global' => true, '--off' => true], 29 | ); 30 | 31 | $this->assertMatchesRegularExpression('/Profiler disabled/', $commandTester->getDisplay()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/MergeJsCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new MergeJsCommand()); 16 | $application->setAutoExit(false); 17 | 18 | $command = $this->getApplication()->find('dev:merge-js'); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute( 22 | ['command' => $command->getName(), '--on' => true, 'store' => 'admin'], 23 | ); 24 | $this->assertMatchesRegularExpression('/JS Merging enabled/', $commandTester->getDisplay()); 25 | 26 | $commandTester = new CommandTester($command); 27 | $commandTester->execute( 28 | ['command' => $command->getName(), '--off' => true, 'store' => 'admin'], 29 | ); 30 | 31 | $this->assertMatchesRegularExpression('/JS Merging disabled/', $commandTester->getDisplay()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/MergeCssCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new MergeCssCommand()); 16 | $application->setAutoExit(false); 17 | 18 | $command = $this->getApplication()->find('dev:merge-css'); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute( 22 | ['command' => $command->getName(), '--on' => true, 'store' => 'admin'], 23 | ); 24 | $this->assertMatchesRegularExpression('/CSS Merging enabled/', $commandTester->getDisplay()); 25 | 26 | $commandTester = new CommandTester($command); 27 | $commandTester->execute( 28 | ['command' => $command->getName(), '--off' => true, 'store' => 'admin'], 29 | ); 30 | 31 | $this->assertMatchesRegularExpression('/CSS Merging disabled/', $commandTester->getDisplay()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Design/DemoNoticeCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new DemoNoticeCommand()); 16 | $application->setAutoExit(false); 17 | 18 | $command = $this->getApplication()->find('design:demo-notice'); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute( 22 | ['command' => $command->getName(), 'store' => 'admin', '--on' => true], 23 | ); 24 | $this->assertMatchesRegularExpression('/Demo Notice enabled/', $commandTester->getDisplay()); 25 | 26 | $commandTester = new CommandTester($command); 27 | $commandTester->execute( 28 | ['command' => $command->getName(), 'store' => 'admin', '--off' => true], 29 | ); 30 | 31 | $this->assertMatchesRegularExpression('/Demo Notice disabled/', $commandTester->getDisplay()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/Translate/InlineAdminCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new InlineAdminCommand()); 16 | $application->setAutoExit(false); 17 | 18 | $command = $this->getApplication()->find('dev:translate:admin'); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute( 22 | ['command' => $command->getName(), '--on' => true], 23 | ); 24 | $this->assertStringContainsString('Inline Translation (Admin) enabled', $commandTester->getDisplay()); 25 | 26 | $commandTester = new CommandTester($command); 27 | $commandTester->execute( 28 | ['command' => $command->getName(), '--off' => true], 29 | ); 30 | 31 | $this->assertStringContainsString('Inline Translation (Admin) disabled', $commandTester->getDisplay()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/N98/Util/AutoloadRestorerTest.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace N98\Util; 12 | 13 | use PHPUnit\Framework\TestCase; 14 | 15 | /** 16 | * Class AutoloadRestorerTest 17 | * 18 | * @package N98\Util 19 | */ 20 | final class AutoloadRestorerTest extends TestCase 21 | { 22 | public function testCreation() 23 | { 24 | $autoloadRestorer = new AutoloadRestorer(); 25 | 26 | $this->assertInstanceOf(AutoloadRestorer::class, $autoloadRestorer); 27 | } 28 | 29 | public function testRestoration() 30 | { 31 | $callbackStub = function (): void {}; 32 | 33 | $this->assertTrue(spl_autoload_register($callbackStub)); 34 | 35 | $autoloadRestorer = new AutoloadRestorer(); 36 | 37 | $this->assertContains($callbackStub, spl_autoload_functions()); 38 | 39 | $this->assertTrue(spl_autoload_unregister($callbackStub)); 40 | 41 | $this->assertNotContains($callbackStub, spl_autoload_functions()); 42 | 43 | $autoloadRestorer->restore(); 44 | 45 | $this->assertContains($callbackStub, spl_autoload_functions()); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Developer/TemplateHintsCommand.php: -------------------------------------------------------------------------------- 1 | detectAskAndSetDeveloperIp($mageCoreModelStore, $disabled); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/System/Check/ResultCollection.php: -------------------------------------------------------------------------------- 1 | _results[] = $result; 28 | return $this; 29 | } 30 | 31 | public function createResult(string $status = Result::STATUS_OK, string $message = ''): Result 32 | { 33 | $result = new Result($status, $message); 34 | $result->setResultGroup($this->_resultGroup); 35 | $this->addResult($result); 36 | 37 | return $result; 38 | } 39 | 40 | public function setResultGroup(string $resultGroup): void 41 | { 42 | $this->_resultGroup = $resultGroup; 43 | } 44 | 45 | public function getIterator(): Traversable 46 | { 47 | return new ArrayObject($this->_results); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tests/bats/test_helper/bats-support/src/error.bash: -------------------------------------------------------------------------------- 1 | # 2 | # bats-support - Supporting library for Bats test helpers 3 | # 4 | # Written in 2016 by Zoltan Tombol 5 | # 6 | # To the extent possible under law, the author(s) have dedicated all 7 | # copyright and related and neighboring rights to this software to the 8 | # public domain worldwide. This software is distributed without any 9 | # warranty. 10 | # 11 | # You should have received a copy of the CC0 Public Domain Dedication 12 | # along with this software. If not, see 13 | # . 14 | # 15 | 16 | # 17 | # error.bash 18 | # ---------- 19 | # 20 | # Functions implementing error reporting. Used by public helper 21 | # functions or test suits directly. 22 | # 23 | 24 | # Fail and display a message. When no parameters are specified, the 25 | # message is read from the standard input. Other functions use this to 26 | # report failure. 27 | # 28 | # Globals: 29 | # none 30 | # Arguments: 31 | # $@ - [=STDIN] message 32 | # Returns: 33 | # 1 - always 34 | # Inputs: 35 | # STDIN - [=$@] message 36 | # Outputs: 37 | # STDERR - message 38 | fail() { 39 | (( $# == 0 )) && batslib_err || batslib_err "$@" 40 | return 1 41 | } 42 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/TemplateHintsCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new TemplateHintsCommand()); 16 | $application->setAutoExit(false); 17 | 18 | $command = $this->getApplication()->find('dev:template-hints'); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute( 22 | ['command' => $command->getName(), '--on' => true, 'store' => 'admin'], 23 | ); 24 | $this->assertMatchesRegularExpression('/Template Hints enabled/', $commandTester->getDisplay()); 25 | 26 | $commandTester = new CommandTester($command); 27 | $commandTester->execute( 28 | ['command' => $command->getName(), '--off' => true, 'store' => 'admin'], 29 | ); 30 | 31 | $this->assertMatchesRegularExpression('/Template Hints disabled/', $commandTester->getDisplay()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Installer/InstallCommandTester.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace N98\Magento\Command\Installer; 12 | 13 | /** 14 | * InstallCommandTester with public getter for InstallCommand command config's packages 15 | * 16 | * @package N98\Magento\Command\Installer 17 | */ 18 | class InstallCommandTester extends InstallCommand 19 | { 20 | public const COMMAND_CLASS = 'N98\Magento\Command\Installer\InstallCommand'; 21 | 22 | /** 23 | * @return array 24 | */ 25 | public function getMagentoPackages(InstallCommand $installCommand) 26 | { 27 | $commandClass = self::COMMAND_CLASS; 28 | $commandConfig = $installCommand->getCommandConfig($commandClass); 29 | return $commandConfig['magento-packages']; 30 | } 31 | 32 | /** 33 | * @return array 34 | */ 35 | public function getSampleDataPackages(InstallCommand $installCommand) 36 | { 37 | $commandClass = self::COMMAND_CLASS; 38 | $commandConfig = $installCommand->getCommandConfig($commandClass); 39 | return $commandConfig['demo-data-packages']; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/Translate/InlineShopCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new InlineAdminCommand()); 16 | $application->setAutoExit(false); 17 | 18 | $command = $this->getApplication()->find('dev:translate:shop'); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute( 22 | ['command' => $command->getName(), 'store' => 'admin', '--on' => true], 23 | ); 24 | $this->assertStringContainsString('Inline Translation enabled', $commandTester->getDisplay()); 25 | 26 | $commandTester = new CommandTester($command); 27 | $commandTester->execute( 28 | ['command' => $command->getName(), 'store' => 'admin', '--off' => true], 29 | ); 30 | 31 | $this->assertStringContainsString('Inline Translation disabled', $commandTester->getDisplay()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Developer/Translate/InlineAdminCommand.php: -------------------------------------------------------------------------------- 1 | detectAskAndSetDeveloperIp($mageCoreModelStore, $disabled); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/System/InfoCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new InfoCommand()); 16 | 17 | $command = $this->getApplication()->find('sys:info'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute(['command' => $command->getName()]); 21 | 22 | $this->assertMatchesRegularExpression('/Magento System Information/', $commandTester->getDisplay()); 23 | $this->assertMatchesRegularExpression('/Install Date/', $commandTester->getDisplay()); 24 | $this->assertMatchesRegularExpression('/Crypt Key/', $commandTester->getDisplay()); 25 | 26 | // Settings argument 27 | $commandTester->execute( 28 | ['command' => $command->getName(), 'key' => 'version'], 29 | ); 30 | 31 | $commandResult = $commandTester->getDisplay(); 32 | $this->assertMatchesRegularExpression('/\d+\.\d+\.\d+/', $commandResult); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/TemplateHintsBlocksCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new TemplateHintsBlocksCommand()); 16 | $application->setAutoExit(false); 17 | 18 | $command = $this->getApplication()->find('dev:template-hints-blocks'); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute( 22 | ['command' => $command->getName(), '--on' => true, 'store' => 'admin'], 23 | ); 24 | $this->assertMatchesRegularExpression('/Template Hints Blocks enabled/', $commandTester->getDisplay()); 25 | 26 | $commandTester = new CommandTester($command); 27 | $commandTester->execute( 28 | ['command' => $command->getName(), '--off' => true, 'store' => 'admin'], 29 | ); 30 | 31 | $this->assertMatchesRegularExpression('/Template Hints Blocks disabled/', $commandTester->getDisplay()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Developer/TemplateHintsBlocksCommand.php: -------------------------------------------------------------------------------- 1 | detectAskAndSetDeveloperIp($mageCoreModelStore, $disabled); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/01_bugs.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F6A8 Bug Report" 3 | about: Did you come across a bug or unexpected behaviour differing from the docs? 4 | labels: bug 5 | 6 | --- 7 | 14 | 15 | ## Describe the bug 16 | 17 | 18 | 19 | ## Expected behaviour 20 | 21 | 22 | 23 | ## Steps to reproduce the issue 24 | 25 | 26 | 27 | 33 | 34 | ## Technical details 35 | 36 | - Host Machine OS (Windows/Linux/Mac): 37 | 38 | ## Possible Fix 39 | 40 | 41 | 42 | ## Additional context 43 | 44 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Admin/User/AbstractAdminUserCommand.php: -------------------------------------------------------------------------------- 1 | _getModel('admin/user'); 23 | return $mageCoreModelAbstract; 24 | } 25 | 26 | protected function getRoleModel(): Mage_Admin_Model_Roles 27 | { 28 | /** @var Mage_Admin_Model_Roles $mageCoreModelAbstract */ 29 | $mageCoreModelAbstract = $this->_getModel('admin/roles'); 30 | return $mageCoreModelAbstract; 31 | } 32 | 33 | protected function getRulesModel(): Mage_Admin_Model_Rules 34 | { 35 | /** @var Mage_Admin_Model_Rules $mageCoreModelAbstract */ 36 | $mageCoreModelAbstract = $this->_getModel('admin/rules'); 37 | return $mageCoreModelAbstract; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/System/Url/ListCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('sys:url:list'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | [ 22 | 'command' => $command->getName(), 23 | 'stores' => 0, 24 | // admin store 25 | 'linetemplate' => 'prefix {url} suffix', 26 | '--add-categories' => true, 27 | '--add-products' => true, 28 | '--add-cmspages' => true, 29 | ], 30 | ); 31 | 32 | $this->assertMatchesRegularExpression('/prefix/', $commandTester->getDisplay()); 33 | $this->assertMatchesRegularExpression('/http/', $commandTester->getDisplay()); 34 | $this->assertMatchesRegularExpression('/suffix/', $commandTester->getDisplay()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/System/Check/MySQL/VersionCheck.php: -------------------------------------------------------------------------------- 1 | fetchOne('SELECT VERSION()'); 25 | $minimumVersionFound = version_compare($mysqlVersion, '4.1.20', '>='); 26 | 27 | if ($minimumVersionFound) { 28 | $result->setStatus(Result::STATUS_OK); 29 | $result->setMessage(sprintf('MySQL Version %s found.', $mysqlVersion)); 30 | } else { 31 | $result->setStatus(Result::STATUS_ERROR); 32 | $result->setMessage( 33 | sprintf('MySQL Version >%s found. Upgrade your MySQL Version.', $mysqlVersion), 34 | ); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/N98/Util/BinaryString.php: -------------------------------------------------------------------------------- 1 | $array */ 17 | $array = explode($delimiter, $string); 18 | foreach ($array as $key => &$data) { 19 | $data = trim($data); 20 | if ($data === '' || $data === '0') { 21 | unset($array[$key]); 22 | } 23 | } 24 | 25 | return $array; 26 | } 27 | 28 | /** 29 | * @deprecated 30 | * @see str_starts_with() 31 | */ 32 | public static function startsWith(string $haystack, string $needle): bool 33 | { 34 | trigger_error(__METHOD__ . ' is obsolete, use str_starts_with', E_USER_DEPRECATED); 35 | return str_starts_with($haystack, $needle); 36 | } 37 | 38 | /** 39 | * @deprecated 40 | * @see str_ends_with() 41 | */ 42 | public static function endsWith(string $haystack, string $needle): bool 43 | { 44 | trigger_error(__METHOD__ . ' is obsolete, use str_ends_with()', E_USER_DEPRECATED); 45 | return str_ends_with($haystack, $needle); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Media/Cache/Image/ClearCommand.php: -------------------------------------------------------------------------------- 1 | setName('media:cache:image:clear') 24 | ->setDescription('Clears image cache'); 25 | } 26 | 27 | protected function execute(InputInterface $input, OutputInterface $output): int 28 | { 29 | $this->detectMagento($output); 30 | 31 | if ($this->initMagento()) { 32 | /** @var Mage_Catalog_Model_Product_Image $model */ 33 | $model = Mage::getModel('catalog/product_image'); 34 | $model->clearCache(); 35 | Mage::dispatchEvent('clean_catalog_images_cache_after'); 36 | $output->writeln('Image cache cleared'); 37 | } 38 | 39 | return Command::SUCCESS; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/check-coverage.php: -------------------------------------------------------------------------------- 1 | xpath('//metrics'); 28 | $totalElements = 0; 29 | $checkedElements = 0; 30 | 31 | foreach ($metrics as $metric) { 32 | $totalElements += (int) $metric['elements']; 33 | $checkedElements += (int) $metric['coveredelements']; 34 | } 35 | 36 | $coverage = ($checkedElements / $totalElements) * 100; 37 | 38 | if ($coverage < $percentage) { 39 | echo 'Code coverage is ' . $coverage . '%, which is below the accepted ' . $percentage . '%' . PHP_EOL; 40 | exit(1); 41 | } 42 | 43 | echo 'Code coverage is ' . $coverage . '% - OK!' . PHP_EOL; 44 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Cache/Dir/FlushCommandTest.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace N98\Magento\Command\Cache\Dir; 12 | 13 | use N98\Magento\Command\TestCase; 14 | use Symfony\Component\Console\Command\Command; 15 | use Symfony\Component\Console\Tester\CommandTester; 16 | 17 | /** 18 | * Class FlushCommandTest 19 | * 20 | * @package N98\Magento\Command\Cache 21 | */ 22 | final class FlushCommandTest extends TestCase 23 | { 24 | public function testExecute() 25 | { 26 | $command = $this->prepareCommand(new FlushCommand()); 27 | $commandTester = new CommandTester($command); 28 | $commandTester->execute(['command' => $command->getName()]); 29 | 30 | $display = $commandTester->getDisplay(); 31 | $this->assertStringContainsString('Flushing cache directory ', $display); 32 | $this->assertStringContainsString('Cache directory flushed', $display); 33 | } 34 | 35 | /** 36 | * @param $object 37 | * 38 | * @return Command 39 | */ 40 | private function prepareCommand($object) 41 | { 42 | $application = $this->getApplication(); 43 | $application->add($object); 44 | 45 | return $application->find($object::NAME); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Installer/SubCommand/PostInstallation.php: -------------------------------------------------------------------------------- 1 | getCommand()->getApplication()->setAutoExit(false); 26 | 27 | chdir($this->config->getString('installationFolder')); 28 | $this->getCommand()->getApplication()->reinit(); 29 | 30 | $this->output->writeln('Reindex all after installation'); 31 | 32 | $arrayInput = new ArrayInput(['command' => 'index:reindex:all']); 33 | $arrayInput->setInteractive(false); 34 | $this->getCommand()->getApplication()->run( 35 | $arrayInput, 36 | $this->output, 37 | ); 38 | 39 | /** 40 | * @TODO enable this after implementation of sys:check command 41 | */ 42 | //$this->getCommand()->getApplication()->run(new StringInput('sys:check'), $this->output); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/System/Cron/ListCommand.php: -------------------------------------------------------------------------------- 1 | setName('sys:cron:list') 24 | ->setDescription('Lists all cronjobs') 25 | ->addFormatOption() 26 | ; 27 | } 28 | 29 | protected function execute(InputInterface $input, OutputInterface $output): int 30 | { 31 | $this->detectMagento($output, true); 32 | 33 | if ($input->getOption('format') === null) { 34 | $this->writeSection($output, 'Cronjob List'); 35 | } 36 | 37 | $this->initMagento(); 38 | 39 | $table = $this->getJobs(); 40 | 41 | $tableHelper = $this->getTableHelper(); 42 | $tableHelper 43 | ->setHeaders(array_keys(current($table))) 44 | ->renderByFormat($output, $table, $input->getOption('format')); 45 | 46 | return Command::SUCCESS; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Media/Cache/JsCss/ClearCommand.php: -------------------------------------------------------------------------------- 1 | setName('media:cache:jscss:clear') 25 | ->setDescription('Clears JS/CSS cache'); 26 | } 27 | 28 | protected function execute(InputInterface $input, OutputInterface $output): int 29 | { 30 | $this->detectMagento($output); 31 | 32 | if ($this->initMagento()) { 33 | /** @var Mage_Core_Model_Design_Package $model */ 34 | $model = Mage::getModel('core/design_package'); 35 | $model->cleanMergedJsCss(); 36 | Mage::dispatchEvent('clean_media_cache_after'); 37 | $output->writeln('Js/CSS cache cleared'); 38 | } 39 | 40 | return Command::SUCCESS; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /bin/list-refs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # prepare a list of refs for a git commit message based on file to be committed 4 | # sources information from files staged in the commit and the current GITGUI 5 | # commit / backup message 6 | # 7 | set -euo pipefail 8 | IFS=$'\n\t' 9 | 10 | PROJECT_DIR="$(git rev-parse --show-toplevel)" 11 | 12 | guess_gitfile() { 13 | GITFILE=GITGUI_MSG 14 | if [[ ! -e "${PROJECT_DIR}/.git//${GITFILE}" ]]; then 15 | GITFILE=GITGUI_BCK 16 | fi 17 | } 18 | 19 | list_refs() { 20 | local file="${PROJECT_DIR}"/.git/${GITFILE} 21 | if [ ! -e "${file}" ]; then 22 | return 0; 23 | fi 24 | local shorts="$(grep -o "\b[0-9a-f]\{7,7\}\b" ${file})" 25 | for short in $shorts; do 26 | echo "- $(git log --oneline $short -1)" 27 | done; 28 | } 29 | 30 | list_issues() { 31 | local file="${PROJECT_DIR}"/.git/${GITFILE} 32 | if [ ! -e "${file}" ]; then 33 | return 0; 34 | fi 35 | local issues="$(sed -n 's/^.*\(#[0-9]\+\).*$/\1/p' "${file}" | sort -rn | uniq)" 36 | for issue in $issues; do 37 | echo "- $issue" 38 | done; 39 | } 40 | 41 | list_commands() { 42 | for file in $(git diff --name-only --cached | grep Command.php$); do 43 | sed -n 's/^.* ->setName(["'\'']\([^"'\'']*\).*)$/- Command: \1/p' "$file" 44 | done; 45 | } 46 | 47 | guess_gitfile 48 | 49 | echo "Refs:" 50 | ( 51 | list_refs 52 | list_issues 53 | list_commands 54 | ) | sed 's/^/&\n/' 55 | 56 | echo "" 57 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Indexer/ReindexAllCommand.php: -------------------------------------------------------------------------------- 1 | setName('index:reindex:all') 22 | ->setDescription('Reindex all magento indexes') 23 | ; 24 | } 25 | 26 | public function getHelp(): string 27 | { 28 | return <<detectMagento($output); 36 | if (!$this->initMagento()) { 37 | return Command::INVALID; 38 | } 39 | 40 | $this->disableObservers(); 41 | 42 | $processes = $this->getIndexerModel()->getProcessesCollection(); 43 | if (!$processes || !$this->executeProcesses($output, iterator_to_array($processes, false))) { 44 | return Command::FAILURE; 45 | } 46 | 47 | return Command::SUCCESS; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /.github/workflows/php_compatibility.yml: -------------------------------------------------------------------------------- 1 | name: PHP Compatibility 2 | 3 | on: 4 | workflow_call: 5 | workflow_dispatch: 6 | 7 | env: 8 | MIN_PHP_VERSION: 7.4 9 | 10 | jobs: 11 | php-compatibility: 12 | name: PHP Compatibility 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout PR 16 | uses: actions/checkout@v5 17 | if: github.event_name == 'pull_request' 18 | with: 19 | ref: ${{ github.event.pull_request.head.sha }} 20 | - name: Checkout HEAD 21 | uses: actions/checkout@v5 22 | if: github.event_name == 'push' 23 | - name: Setup PHP 24 | uses: shivammathur/setup-php@v2 25 | with: 26 | tools: composer:${{ matrix.composer-version }}, cs2pr 27 | php-version: 8.2 28 | extensions: mcrypt, mbstring, intl 29 | coverage: none 30 | - name: Test src directory 31 | uses: pantheon-systems/phpcompatibility-action@v1 32 | with: 33 | skip-php-setup: true 34 | test-versions: ${{ env.MIN_PHP_VERSION }}- 35 | paths: ${{ github.workspace }}/src 36 | - name: Test tests directory 37 | uses: pantheon-systems/phpcompatibility-action@v1 38 | with: 39 | skip-php-setup: true 40 | test-versions: ${{ env.MIN_PHP_VERSION }}- 41 | paths: ${{ github.workspace }}/tests 42 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Database/InfoCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new InfoCommand()); 16 | 17 | $command = $this->getApplication()->find('db:info'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute(['command' => $command->getName()]); 21 | 22 | $this->assertMatchesRegularExpression('/PDO-Connection-String/', $commandTester->getDisplay()); 23 | } 24 | 25 | public function testExecuteWithSettingArgument() 26 | { 27 | $application = $this->getApplication(); 28 | $application->add(new InfoCommand()); 29 | 30 | $command = $this->getApplication()->find('db:info'); 31 | 32 | $commandTester = new CommandTester($command); 33 | $commandTester->execute( 34 | ['command' => $command->getName(), 'setting' => 'MySQL-Cli-String'], 35 | ); 36 | 37 | $this->assertDoesNotMatchRegularExpression('/MySQL-Cli-String/', $commandTester->getDisplay()); 38 | $this->assertStringContainsString('mysql -h', $commandTester->getDisplay()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/System/Cron/RunCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new ListCommand()); 16 | 17 | $command = $this->getApplication()->find('sys:cron:run'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName(), 'job' => 'log_clean'], 22 | ); 23 | 24 | $this->assertMatchesRegularExpression('/Run Mage_Log_Model_Cron::logClean done/', $commandTester->getDisplay()); 25 | } 26 | 27 | public function testUrlBuildingWhileCron() 28 | { 29 | $application = $this->getApplication(); 30 | $application->add(new RunCommand()); 31 | 32 | $command = $this->getApplication()->find('sys:cron:run'); 33 | 34 | $commandTester = new CommandTester($command); 35 | $commandTester->execute( 36 | ['command' => $command->getName(), 'job' => 'log_clean'], 37 | ); 38 | 39 | $this->assertMatchesRegularExpression('/Run Mage_Log_Model_Cron::logClean done/', $commandTester->getDisplay()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/System/MaintenanceCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new MaintenanceCommand()); 16 | 17 | $command = $application->find('sys:maintenance'); 18 | 19 | $magentoRootFolder = $application->getMagentoRootFolder(); 20 | if (!is_writable($magentoRootFolder)) { 21 | self::markTestSkipped('Magento root folder must be writable.'); 22 | } 23 | 24 | $commandTester = new CommandTester($command); 25 | $commandTester->execute( 26 | ['command' => $command->getName(), '--on' => ''], 27 | ); 28 | $this->assertMatchesRegularExpression('/Maintenance mode on/', $commandTester->getDisplay()); 29 | $this->assertFileExists($magentoRootFolder . '/maintenance.flag'); 30 | 31 | $commandTester->execute( 32 | ['command' => $command->getName(), '--off' => ''], 33 | ); 34 | $this->assertMatchesRegularExpression('/Maintenance mode off/', $commandTester->getDisplay()); 35 | $this->assertFileDoesNotExist($magentoRootFolder . '/maintenance.flag'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/bats/test_helper/bats-support/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | This project adheres to [Semantic Versioning](http://semver.org/). 5 | 6 | 7 | ## [0.3.0] - 2016-11-29 8 | 9 | ### Added 10 | 11 | - Restricting invocation to specific locations with 12 | `batslib_is_caller()` 13 | 14 | 15 | ## [0.2.0] - 2016-03-22 16 | 17 | ### Added 18 | 19 | - `npm` support 20 | - Reporting arbitrary failures with `fail()` (moved from `bats-assert`) 21 | 22 | ### Changed 23 | 24 | - Library renamed to `bats-support` 25 | 26 | 27 | ## 0.1.0 - 2016-02-16 28 | 29 | ### Added 30 | 31 | - Two-column key-value formatting with `batslib_print_kv_single()` 32 | - Multi-line key-value formatting with `batslib_print_kv_multi()` 33 | - Mixed formatting with `batslib_print_kv_single_or_multi()` 34 | - Header and footer decoration with `batslib_decorate()` 35 | - Prefixing lines with `batslib_prefix()` 36 | - Marking lines with `batslib_mark()` 37 | - Common output function `batslib_err()` 38 | - Line counting with `batslib_count_lines()` 39 | - Checking whether a text is one line long with 40 | `batslib_is_single_line()` 41 | - Determining key width for two-column and mixed formatting with 42 | `batslib_get_max_single_line_key_width()` 43 | 44 | 45 | [0.3.0]: https://github.com/ztombol/bats-support/compare/v0.2.0...v0.3.0 46 | [0.2.0]: https://github.com/ztombol/bats-support/compare/v0.1.0...v0.2.0 47 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Cache/ListCommand.php: -------------------------------------------------------------------------------- 1 | setName('cache:list') 22 | ->setDescription('Lists all magento caches') 23 | ->addFormatOption() 24 | ; 25 | } 26 | 27 | protected function execute(InputInterface $input, OutputInterface $output): int 28 | { 29 | $this->detectMagento($output); 30 | if (!$this->initMagento()) { 31 | return Command::INVALID; 32 | } 33 | 34 | $cacheTypes = $this->_getCacheModel()->getTypes(); 35 | $table = []; 36 | foreach ($cacheTypes as $cacheCode => $cacheInfo) { 37 | $table[] = [$cacheCode, $cacheInfo['status'] ? 'enabled' : 'disabled']; 38 | } 39 | 40 | $tableHelper = $this->getTableHelper(); 41 | $tableHelper 42 | ->setHeaders(['code', 'status']) 43 | ->renderByFormat($output, $table, $input->getOption('format')); 44 | 45 | return Command::SUCCESS; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/N98/Util/Console/Enabler.php: -------------------------------------------------------------------------------- 1 | command = $command; 29 | } 30 | 31 | public function functionExists(string $name): void 32 | { 33 | $this->assert(function_exists($name), sprintf('function "%s" is not available', $name)); 34 | } 35 | 36 | public function operatingSystemIsNotWindows(): void 37 | { 38 | $this->assert(!OperatingSystem::isWindows(), 'operating system is windows'); 39 | } 40 | 41 | /** 42 | * @param mixed $condition 43 | */ 44 | private function assert($condition, string $message): void 45 | { 46 | if ($condition) { 47 | return; 48 | } 49 | 50 | throw new RuntimeException( 51 | sprintf('Command %s is not available because %s.', $this->command->getName(), $message), 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/MagentoConnect/ListExtensionsCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication()->initMagento(); 21 | if (version_compare(Mage::getVersion(), '1.4.2.0', '<=')) { 22 | self::markTestSkipped('Skip Test - mage cli script does not exist.'); 23 | } 24 | 25 | $application = $this->getApplication(); 26 | $application->add(new ListExtensionsCommand()); 27 | 28 | $command = $this->getApplication()->find('extension:list'); 29 | 30 | $commandTester = new CommandTester($command); 31 | $commandTester->execute( 32 | ['command' => $command->getName(), 'search' => 'Mage_All_Latest'], 33 | ); 34 | 35 | $this->assertContains('Package', $commandTester->getDisplay()); 36 | $this->assertContains('Version', $commandTester->getDisplay()); 37 | $this->assertContains('Mage_All_Latest', $commandTester->getDisplay()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Cms/Block/ToggleCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 21 | $application->add(new ToggleCommand()); 22 | 23 | $command = $this->getApplication()->find('cms:block:toggle'); 24 | $commandTester = new CommandTester($command); 25 | $victim = Mage::getModel('cms/block')->getCollection()->getFirstItem(); 26 | $commandTester->execute( 27 | [ 28 | 'command' => $command->getName(), 29 | // id should work 30 | 'block_id' => $victim->getId(), 31 | ], 32 | ); 33 | $this->assertStringContainsString('disabled', $commandTester->getDisplay()); 34 | $commandTester->execute( 35 | [ 36 | 'command' => $command->getName(), 37 | // identifier should work 38 | 'block_id' => $victim->getIdentifier(), 39 | ], 40 | ); 41 | $this->assertStringContainsString('enabled', $commandTester->getDisplay()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | sudo: false 3 | 4 | services: 5 | - mysql 6 | 7 | branches: 8 | only: 9 | - master 10 | 11 | matrix: 12 | fast_finish: true 13 | include: 14 | - name: SH lint 15 | php: 7.2 16 | env: SCRIPT_JOB=LINTSH 17 | script: find {src,tests} -name "*.php" ! -path '*/String.php' -print0 | xargs 18 | -0 -n1 -P8 php -l | grep -v '^No syntax errors detected'; test $? -eq 1 19 | 20 | - name: buildsh 21 | php: 7.2 22 | env: SCRIPT_JOB="BUILDSH" 23 | 24 | - name: Bash Autocompletion 25 | php: 7.2 26 | env: SCRIPT_JOB="BASH-AUTOCOMPLETION" 27 | 28 | - name: Magento 1.9.4.5 PHP 7.2 29 | php: 7.2 30 | env: MAGENTO_VERSION="magento-mirror-1.9.4.5" DB=mysql INSTALL_SAMPLE_DATA=no 31 | 32 | - name: OpenMage LTS 20.0.14 PHP 7.3 33 | php: 7.3 34 | env: MAGENTO_VERSION="openmage-20.0.14" DB=mysql INSTALL_SAMPLE_DATA=no 35 | 36 | - name: OpenMage LTS 20.0.14 PHP 8.1 37 | php: 8.1 38 | env: MAGENTO_VERSION="openmage-20.0.14" DB=mysql INSTALL_SAMPLE_DATA=no 39 | 40 | before_install: 41 | - phpenv config-rm xdebug.ini 42 | - travis_retry composer self-update --1 43 | - travis_retry composer global require hirak/prestissimo 44 | 45 | install: 46 | - travis_retry composer install --prefer-dist --no-interaction --ignore-platform-reqs 47 | 48 | before_script: 49 | - source build/travis/before_script.sh 50 | 51 | script: 52 | - build/travis/script.sh 53 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Cache/DisableCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 16 | $application->add(new DisableCommand()); 17 | 18 | $command = $this->getApplication()->find('cache:disable'); 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute(['command' => $command->getName()]); 21 | 22 | $this->assertMatchesRegularExpression('/Caches disabled/', $commandTester->getDisplay()); 23 | } 24 | 25 | public function testExecuteMultipleCaches() 26 | { 27 | $application = $this->getApplication(); 28 | $application->add(new DisableCommand()); 29 | 30 | $command = $this->getApplication()->find('cache:disable'); 31 | $commandTester = new CommandTester($command); 32 | $commandTester->execute( 33 | ['command' => $command->getName(), 'code' => 'eav,config'], 34 | ); 35 | 36 | $this->assertMatchesRegularExpression('/Cache config disabled/', $commandTester->getDisplay()); 37 | $this->assertMatchesRegularExpression('/Cache eav disabled/', $commandTester->getDisplay()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Cache/EnableCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 16 | $application->add(new EnableCommand()); 17 | 18 | $command = $this->getApplication()->find('cache:enable'); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute(['command' => $command->getName()]); 22 | 23 | $this->assertMatchesRegularExpression('/Caches enabled/', $commandTester->getDisplay()); 24 | } 25 | 26 | public function testExecuteMultipleCaches() 27 | { 28 | $application = $this->getApplication(); 29 | $application->add(new DisableCommand()); 30 | 31 | $command = $this->getApplication()->find('cache:enable'); 32 | $commandTester = new CommandTester($command); 33 | $commandTester->execute( 34 | ['command' => $command->getName(), 'code' => 'eav,config'], 35 | ); 36 | 37 | $this->assertMatchesRegularExpression('/Cache config enabled/', $commandTester->getDisplay()); 38 | $this->assertMatchesRegularExpression('/Cache eav enabled/', $commandTester->getDisplay()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Script/Repository/RunCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $config = $application->getConfig(); 16 | 17 | $testDir = $this->normalizePathSeparators(__DIR__) . '/_scripts'; 18 | 19 | $config['script']['folders'][] = $testDir; 20 | $application->setConfig($config); 21 | 22 | $application->add(new RunCommand()); 23 | 24 | $command = $this->getApplication()->find('script:repo:run'); 25 | 26 | $commandTester = new CommandTester($command); 27 | $commandTester->execute( 28 | ['command' => $command->getName(), 'script' => 'hello-world'], 29 | ); 30 | 31 | // Runs sys:info -> Check for any output 32 | $this->assertStringContainsString('Vendors (core)', $commandTester->getDisplay()); 33 | 34 | $this->assertStringContainsString($testDir . '/hello-world.magerun', $this->normalizePathSeparators($commandTester->getDisplay())); 35 | } 36 | 37 | /** 38 | * @return string 39 | */ 40 | private function normalizePathSeparators($string) 41 | { 42 | return strtr($string, '\\', '/'); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/System/Store/ListCommand.php: -------------------------------------------------------------------------------- 1 | setName('sys:store:list') 26 | ->setDescription('Lists all installed store-views') 27 | ->addFormatOption() 28 | ; 29 | } 30 | 31 | protected function execute(InputInterface $input, OutputInterface $output): int 32 | { 33 | $table = []; 34 | $this->detectMagento($output); 35 | $this->initMagento(); 36 | 37 | foreach (Mage::app()->getStores() as $store) { 38 | $table[$store->getId()] = [$store->getId(), $store->getCode()]; 39 | } 40 | 41 | ksort($table); 42 | 43 | $tableHelper = $this->getTableHelper(); 44 | $tableHelper 45 | ->setHeaders(['id', 'code']) 46 | ->renderByFormat($output, $table, $input->getOption('format')); 47 | 48 | return Command::SUCCESS; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Developer/Report/CountCommand.php: -------------------------------------------------------------------------------- 1 | setName('dev:report:count') 25 | ->setDescription('Get count of report files'); 26 | } 27 | 28 | protected function execute(InputInterface $input, OutputInterface $output): int 29 | { 30 | $this->detectMagento($output); 31 | $this->initMagento(); 32 | 33 | $dir = Mage::getBaseDir('var') . DIRECTORY_SEPARATOR . 'report' . DIRECTORY_SEPARATOR; 34 | $count = $this->getFileCount($dir); 35 | 36 | $output->writeln((string) $count); 37 | return Command::SUCCESS; 38 | } 39 | 40 | /** 41 | * Returns the number of files in the directory. 42 | */ 43 | protected function getFileCount(string $path): int 44 | { 45 | $finder = Finder::create(); 46 | return $finder->files()->ignoreUnreadableDirs(true)->in($path)->count(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Database/Compressor/AbstractCompressor.php: -------------------------------------------------------------------------------- 1 | _commandConfig['php']['required-extensions']; 24 | 25 | foreach ($requiredExtensions as $requiredExtension) { 26 | $result = $resultCollection->createResult(); 27 | $result->setStatus(extension_loaded($requiredExtension) ? Result::STATUS_OK : Result::STATUS_ERROR); 28 | if ($result->isValid()) { 29 | $result->setMessage(sprintf('Required PHP Module %s found.', $requiredExtension)); 30 | } else { 31 | $result->setMessage(sprintf('Required PHP Module %s not found!', $requiredExtension)); 32 | } 33 | } 34 | } 35 | 36 | public function setCommandConfig(array $commandConfig): void 37 | { 38 | $this->_commandConfig = $commandConfig; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /.phpunit.dist.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 28 | ./src 29 | 30 | 31 | src/bootstrap.php 32 | 33 | 34 | 35 | 36 | ./tests 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /n98-magerun.phar: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | snapshot = spl_autoload_functions(); 26 | } 27 | 28 | /** 29 | * restore all autoload callbacks that have been unregistered 30 | */ 31 | public function restore(): void 32 | { 33 | $unregisteredLoaders = $this->getUnregisteredLoaders(); 34 | foreach ($unregisteredLoaders as $unregisteredLoader) { 35 | spl_autoload_register($unregisteredLoader); 36 | } 37 | } 38 | 39 | private function getUnregisteredLoaders(): array 40 | { 41 | $unregistered = []; 42 | $current = spl_autoload_functions(); 43 | 44 | if (!$this->snapshot || $current === [] || $current === false) { 45 | return $unregistered; 46 | } 47 | 48 | foreach ($this->snapshot as $callback) { 49 | if (in_array($callback, $current, true)) { 50 | continue; 51 | } 52 | 53 | $unregistered[] = $callback; 54 | } 55 | 56 | return $unregistered; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Indexer/ListCommand.php: -------------------------------------------------------------------------------- 1 | setName('index:list') 22 | ->setDescription('Lists all magento indexes') 23 | ->addFormatOption() 24 | ; 25 | } 26 | 27 | public function getHelp(): string 28 | { 29 | return <<detectMagento($output); 37 | if (!$this->initMagento()) { 38 | return Command::INVALID; 39 | } 40 | 41 | $table = []; 42 | foreach ($this->getIndexerList() as $index) { 43 | $table[] = [$index['code'], $index['status'], $index['last_runtime']]; 44 | } 45 | 46 | $tableHelper = $this->getTableHelper(); 47 | $tableHelper 48 | ->setHeaders(['code', 'status', 'time']) 49 | ->renderByFormat($output, $table, $input->getOption('format')); 50 | 51 | return Command::SUCCESS; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Cache/ViewCommand.php: -------------------------------------------------------------------------------- 1 | setName('cache:view') 25 | ->addArgument('id', InputArgument::REQUIRED, 'Cache-ID') 26 | ->addOption('unserialize', '', InputOption::VALUE_NONE, 'Unserialize output') 27 | ->setDescription('Prints a cache entry') 28 | ; 29 | } 30 | 31 | protected function execute(InputInterface $input, OutputInterface $output): int 32 | { 33 | $this->detectMagento($output); 34 | if (!$this->initMagento()) { 35 | return Command::INVALID; 36 | } 37 | 38 | $cacheInstance = Mage::app()->getCache(); 39 | $cacheData = $cacheInstance->load($input->getArgument('id')); 40 | if ($input->getOption('unserialize')) { 41 | $cacheData = unserialize($cacheData); 42 | $cacheData = print_r($cacheData, true); 43 | } 44 | 45 | $output->writeln($cacheData); 46 | return Command::SUCCESS; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Database/Maintain/CheckTablesCommandTest.php: -------------------------------------------------------------------------------- 1 | getCommand(); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute( 22 | ['command' => $command->getName(), '--format' => 'csv', '--type' => 'quick', '--table' => 'catalogsearch_*'], 23 | ); 24 | $this->assertStringContainsString('catalogsearch_fulltext,check,quick,OK', $commandTester->getDisplay()); 25 | $timeRegex = '"\s+[0-9]+\srows","[0-9\.]+\ssecs"'; 26 | $this->assertMatchesRegularExpression('~catalogsearch_query,"ENGINE InnoDB",' . $timeRegex . '~', $commandTester->getDisplay()); 27 | $this->assertMatchesRegularExpression('~catalogsearch_result,"ENGINE InnoDB",' . $timeRegex . '~', $commandTester->getDisplay()); 28 | } 29 | 30 | /** 31 | * @return Command 32 | */ 33 | private function getCommand() 34 | { 35 | $application = $this->getApplication(); 36 | $application->add(new CheckTablesCommand()); 37 | 38 | return $this->getApplication()->find('db:maintain:check-tables'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /.php-cs-fixer.dist.php: -------------------------------------------------------------------------------- 1 | setRiskyAllowed(true) 8 | ->setRules([ 9 | // see https://cs.symfony.com/doc/ruleSets/PER-CS2.0.html 10 | '@PER-CS2.0' => true, 11 | // RISKY: Use && and || logical operators instead of and or. 12 | 'logical_operators' => true, 13 | // RISKY: Replaces intval, floatval, doubleval, strval and boolval function calls with according type casting operator. 14 | 'modernize_types_casting' => true, 15 | // PHP84: Adds or removes ? before single type declarations or |null at the end of union types when parameters have a default null value. 16 | 'nullable_type_declaration_for_default_null_value' => true, 17 | // Convert double quotes to single quotes for simple strings. 18 | 'single_quote' => true, 19 | // Arguments lists, array destructuring lists, arrays that are multi-line, match-lines and parameters lists must have a trailing comma. 20 | // removed "match" and "parameters" for PHP7 21 | // see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8308 22 | 'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arguments', 'array_destructuring', 'arrays']], 23 | ]) 24 | ->setFinder( 25 | PhpCsFixer\Finder::create() 26 | ->in([ 27 | __DIR__ . '/src', 28 | __DIR__ . '/tests', 29 | ]) 30 | ->name('*.php') 31 | ->ignoreDotFiles(true) 32 | ->ignoreVCS(true) 33 | ); 34 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/System/Check/MySQL/ResourceCheck.php: -------------------------------------------------------------------------------- 1 | getConnection('core_write'); 30 | 31 | $result = $resultCollection->createResult(); 32 | 33 | if (!$dbAdapter instanceof Varien_Db_Adapter_Interface) { 34 | $result->setStatus(Result::STATUS_ERROR); 35 | $result->setMessage( 36 | "Mysql Version: Can not check. Unable to obtain resource connection 'core_write'.", 37 | ); 38 | } else { 39 | $this->checkImplementation($result, $dbAdapter); 40 | } 41 | } 42 | 43 | abstract protected function checkImplementation(Result $result, Varien_Db_Adapter_Interface $varienDbAdapter): void; 44 | } 45 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/System/Check/MySQL/EnginesCheck.php: -------------------------------------------------------------------------------- 1 | checkInnodbEngine($varienDbAdapter); 22 | 23 | if ($innodbFound) { 24 | $result->setStatus(Result::STATUS_OK); 25 | $result->setMessage('Required MySQL Storage Engine InnoDB found.'); 26 | } else { 27 | $result->setStatus(Result::STATUS_ERROR); 28 | $result->setMessage( 29 | 'Required MySQL Storage Engine InnoDB not found!', 30 | ); 31 | } 32 | } 33 | 34 | private function checkInnodbEngine(Varien_Db_Adapter_Interface $varienDbAdapter): bool 35 | { 36 | $innodbFound = false; 37 | 38 | $engines = $varienDbAdapter->fetchAll('SHOW ENGINES'); 39 | foreach ($engines as $engine) { 40 | if (strtolower($engine['Engine']) === 'innodb') { 41 | $innodbFound = true; 42 | break; 43 | } 44 | } 45 | 46 | return $innodbFound; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Cache/EnableCommand.php: -------------------------------------------------------------------------------- 1 | setName('cache:enable') 24 | ->addArgument('code', InputArgument::OPTIONAL, 'Code of cache (Multiple codes sperated by comma)') 25 | ->setDescription('Enables magento caches') 26 | ; 27 | } 28 | 29 | protected function execute(InputInterface $input, OutputInterface $output): int 30 | { 31 | $this->detectMagento($output); 32 | if (!$this->initMagento()) { 33 | return Command::INVALID; 34 | } 35 | 36 | $codeArgument = BinaryString::trimExplodeEmpty(',', (string) $input->getArgument('code')); 37 | $this->saveCacheStatus($codeArgument, true); 38 | 39 | if ($codeArgument !== []) { 40 | foreach ($codeArgument as $code) { 41 | $output->writeln('Cache ' . $code . ' enabled'); 42 | } 43 | } else { 44 | $output->writeln('Caches enabled'); 45 | } 46 | 47 | return Command::SUCCESS; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/System/Website/ListCommand.php: -------------------------------------------------------------------------------- 1 | setName('sys:website:list') 26 | ->setDescription('Lists all websites') 27 | ->addFormatOption() 28 | ; 29 | } 30 | 31 | protected function execute(InputInterface $input, OutputInterface $output): int 32 | { 33 | $table = []; 34 | $this->detectMagento($output); 35 | 36 | if ($input->getOption('format') === null) { 37 | $this->writeSection($output, 'Magento Websites'); 38 | } 39 | 40 | $this->initMagento(); 41 | 42 | foreach (Mage::app()->getWebsites() as $website) { 43 | $table[$website->getId()] = [$website->getId(), $website->getCode()]; 44 | } 45 | 46 | ksort($table); 47 | 48 | $tableHelper = $this->getTableHelper(); 49 | $tableHelper 50 | ->setHeaders(['id', 'code']) 51 | ->renderByFormat($output, $table, $input->getOption('format')); 52 | 53 | return Command::SUCCESS; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tests/N98/Util/WindowsSystemTest.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace N98\Util; 12 | 13 | use PHPUnit\Framework\TestCase; 14 | 15 | /** 16 | * Class WindowsSystemTest 17 | * 18 | * @package N98\Util 19 | * @requires OS win 20 | */ 21 | final class WindowsSystemTest extends TestCase 22 | { 23 | public function testIsProgramInstalled() 24 | { 25 | $this->assertTrue(WindowsSystem::isProgramInstalled('notepad')); 26 | 27 | $this->assertFalse(WindowsSystem::isProgramInstalled('notepad-that-never-made-it-into-windows-kernel')); 28 | 29 | $this->assertFalse(WindowsSystem::isProgramInstalled('invalid\\command*name|thisis')); 30 | } 31 | 32 | /** 33 | * @see isExecutableName 34 | * @return \Iterator<(int | string), mixed> 35 | */ 36 | public function provideExecutableNames(): \Iterator 37 | { 38 | yield ['notepad', false]; 39 | yield ['notepad.com', true]; 40 | yield ['notepad.exe', true]; 41 | yield ['notepad.exe.exe', true]; 42 | yield ['notepad.eXe', true]; 43 | yield ['notepad.EXE', true]; 44 | yield ['notepad.bat', true]; 45 | yield ['notepad.txt', false]; 46 | } 47 | 48 | /** 49 | * 50 | * @param string $name 51 | * @param bool $expected 52 | * @dataProvider provideExecutableNames 53 | */ 54 | public function testIsExecutableName($name, $expected) 55 | { 56 | $this->assertSame($expected, WindowsSystem::isExecutableName($name), $name); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Cache/ViewCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 16 | $application->add(new ListCommand()); 17 | 18 | $command = $this->getApplication()->find('cache:view'); 19 | 20 | Mage::app()->getCache()->save('TEST n98-magerun', 'n98-magerun-unittest'); 21 | 22 | $commandTester = new CommandTester($command); 23 | $commandTester->execute( 24 | ['command' => $command->getName(), 'id' => 'n98-magerun-unittest'], 25 | ); 26 | 27 | $this->assertMatchesRegularExpression('/TEST n98-magerun/', $commandTester->getDisplay()); 28 | } 29 | 30 | public function testExecuteUnserialize() 31 | { 32 | $application = $this->getApplication(); 33 | $application->add(new ListCommand()); 34 | 35 | $command = $this->getApplication()->find('cache:view'); 36 | 37 | $cacheData = [1, 2, 3, 'foo' => ['bar']]; 38 | Mage::app()->getCache()->save(serialize($cacheData), 'n98-magerun-unittest'); 39 | 40 | $commandTester = new CommandTester($command); 41 | $commandTester->execute( 42 | ['command' => $command->getName(), 'id' => 'n98-magerun-unittest', '--unserialize' => true], 43 | ); 44 | 45 | $this->assertSame(print_r($cacheData, true) . "\n", $commandTester->getDisplay(true)); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Admin/User/ListCommand.php: -------------------------------------------------------------------------------- 1 | setName('admin:user:list') 22 | ->setDescription('List admin users.') 23 | ->addFormatOption() 24 | ; 25 | } 26 | 27 | protected function execute(InputInterface $input, OutputInterface $output): int 28 | { 29 | $this->detectMagento($output, true); 30 | if (!$this->initMagento()) { 31 | return Command::INVALID; 32 | } 33 | 34 | $mageAdminModelUser = $this->getUserModel(); 35 | $userList = $mageAdminModelUser->getCollection(); 36 | $table = []; 37 | foreach ($userList as $user) { 38 | $table[] = [ 39 | $user->getId(), 40 | $user->getUsername(), 41 | $user->getEmail(), 42 | $user->getIsActive() ? 'active' : 'inactive', 43 | ]; 44 | } 45 | 46 | $tableHelper = $this->getTableHelper(); 47 | $tableHelper 48 | ->setHeaders(['id', 'username', 'email', 'status']) 49 | ->renderByFormat($output, $table, $input->getOption('format')); 50 | 51 | return Command::SUCCESS; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /.github/workflows/phar_build_and_update.yml: -------------------------------------------------------------------------------- 1 | name: Phar build and update test 2 | 3 | on: 4 | workflow_call: 5 | workflow_dispatch: 6 | 7 | jobs: 8 | build: 9 | 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Setup PHP 14 | uses: shivammathur/setup-php@v2 15 | with: 16 | tools: composer:2 17 | php-version: '7.4' 18 | 19 | - name: Checkout PR 20 | uses: actions/checkout@v5 21 | if: github.event_name == 'pull_request' 22 | with: 23 | ref: ${{ github.event.pull_request.head.sha }} 24 | 25 | - name: Checkout HEAD 26 | uses: actions/checkout@v5 27 | if: github.event_name == 'push' 28 | 29 | - name: Check Security 30 | uses: symfonycorp/security-checker-action@v5 31 | 32 | - name: Validate composer.json and composer.lock 33 | run: composer validate --strict 34 | 35 | - name: Get Composer Cache Directory 36 | id: composer-cache 37 | run: | 38 | echo "::set-output name=dir::$(composer config cache-files-dir)" 39 | 40 | - uses: actions/cache@v5 41 | with: 42 | path: ${{ steps.composer-cache.outputs.dir }} 43 | key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} 44 | restore-keys: | 45 | ${{ runner.os }}-composer- 46 | 47 | - name: Install dependencies 48 | if: steps.composer-cache.outputs.cache-hit != 'true' 49 | run: composer install --prefer-dist --no-progress --no-suggest 50 | 51 | - name: Create phar 52 | run: bash ./build.sh 53 | 54 | - name: Test self-update command 55 | run: php ./n98-magerun.phar self-update --unstable 56 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/Developer/Ide/PhpStorm/MetaCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 15 | $application->add(new MetaCommand()); 16 | 17 | $command = $this->getApplication()->find('dev:ide:phpstorm:meta'); 18 | 19 | $commandTester = new CommandTester($command); 20 | $commandTester->execute( 21 | ['command' => $command->getName(), '--stdout' => true], 22 | ); 23 | 24 | $fileContent = $commandTester->getDisplay(true); 25 | 26 | $this->assertStringContainsString('\'catalog\' => \Mage_Catalog_Helper_Data', $fileContent); 27 | $this->assertStringContainsString('\'core/config\' => \Mage_Core_Model_Config', $fileContent); 28 | 29 | if (class_exists('\Mage_Core_Model_Resource_Config')) { // since magento 1.7 30 | $this->assertStringContainsString('\'core/config\' => \Mage_Core_Model_Resource_Config', $fileContent); 31 | } 32 | 33 | $this->assertStringContainsString('\'wishlist\' => \Mage_Wishlist_Helper_Data', $fileContent); 34 | 35 | if (class_exists('\Mage_Core_Model_Resource_Helper_Mysql4')) { 36 | $this->assertStringContainsString('\'core\' => \Mage_Core_Model_Resource_Helper_Mysql4', $fileContent); 37 | } 38 | 39 | $this->assertStringNotContainsString('\'payment/paygate_request\' => \Mage_Payment_Model_Paygate_Request', $fileContent); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/System/Cron/ServerEnvironmentTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 20 | $this->assertInstanceOf(Application::class, $application); 21 | } 22 | 23 | public function testRegression() 24 | { 25 | $store = Mage::app()->getStore(null); 26 | $actual = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); 27 | $this->assertIsString($actual); 28 | $this->assertMatchesRegularExpression('~/(ide-phpunit.php|phpunit)/$~', $actual); 29 | } 30 | 31 | public function testEnvironmentFix() 32 | { 33 | $store = Mage::app()->getStore(null); 34 | $store->resetConfig(); 35 | 36 | $serverEnvironment = new ServerEnvironment(); 37 | $serverEnvironment->initalize(); 38 | 39 | $actual = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); 40 | $this->assertIsString($actual); 41 | $this->assertStringEndsWith('/index.php/', $actual); 42 | 43 | $store->resetConfig(); 44 | 45 | $serverEnvironment->reset(); 46 | 47 | $actual = Mage::app()->getStore(null)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); 48 | $this->assertIsString($actual); 49 | $this->assertMatchesRegularExpression('~/(ide-phpunit.php|phpunit)/$~', $actual); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/MagentoConnect/ValidateExtensionCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication()->initMagento(); 22 | if (version_compare(Mage::getVersion(), '1.4.2.0', '<=')) { 23 | self::markTestSkipped('Skip Test - mage cli script does not exist.'); 24 | } 25 | 26 | $application = $this->getApplication(); 27 | $commandMock = $this->getMockBuilder(ValidateExtensionCommand::class) 28 | ->setMockClassName('ValidateExtensionCommandMock') 29 | ->enableOriginalClone() 30 | ->setMethods(['_getDownloaderConfigPath']) 31 | ->getMock(); 32 | $application->add($commandMock); 33 | 34 | $commandMock 35 | ->method('_getDownloaderConfigPath') 36 | ->willReturn(__DIR__ . '/_files/cache.cfg'); 37 | 38 | $commandTester = new CommandTester($commandMock); 39 | $commandTester->execute( 40 | ['command' => $commandMock->getName(), 'package' => 'Mage_All_Latest', '--include-default' => true], 41 | ); 42 | 43 | $output = $commandTester->getDisplay(); 44 | $this->assertContains('Mage_All_Latest', $output); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /tests/N98/Magento/local.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Zend_Cache_Backend_BlackHole 6 | 7 | 8 | Sun, 28 Oct 2012 13:09:07 +0000 9 | 10 | 11 | 1aaa1a11a11aa11aaaa111111aaaa111 12 | 13 | false 14 | 15 | 16 | 17 | 18 | 19 | 20 | localhost 21 | user 22 | pass 23 | magento 24 | SET NAMES utf8 25 | mysql4 26 | pdo_mysql 27 | 28 | 1 29 | 30 | 31 | 32 | files 33 | 34 | 35 | 36 | 37 | 38 | admin 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | update_frontend.xml 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /.rector.php: -------------------------------------------------------------------------------- 1 | withPaths([ 14 | __DIR__ . '/src', 15 | __DIR__ . '/tests', 16 | ]) 17 | ->withSkip([ 18 | MakeInheritedMethodVisibilitySameAsParentRector::class => [ 19 | __DIR__ . '/src/N98/Magento/Application.php', 20 | ], 21 | RemoveAlwaysTrueIfConditionRector::class => [ 22 | __DIR__ . '/src/N98/Magento/Initializer.php', 23 | ], 24 | RemoveUnusedPrivateMethodRector::class => [ 25 | __DIR__ . '/tests/N98/Magento/Command/System/Setup/IncrementalCommandTest.php', 26 | ], 27 | AssertEqualsToSameRector::class => [ 28 | __DIR__ . 'tests/N98/Util/Console/Helper/DatabaseHelperTest.php', 29 | ], 30 | PrivatizeFinalClassMethodRector::class => [ 31 | __DIR__ . '/tests/N98/Magento/Command/System/Setup/IncrementalCommandTest.php', 32 | ], 33 | ]) 34 | ->withPreparedSets( 35 | true, 36 | true, 37 | true, 38 | false, 39 | true, 40 | true, 41 | true, 42 | true, 43 | true, 44 | false, 45 | true, 46 | true, 47 | false, 48 | true, 49 | true 50 | ) 51 | ->withTypeCoverageLevel(0); 52 | -------------------------------------------------------------------------------- /src/N98/Magento/Command/Installer/SubCommand/SetDirectoryPermissions.php: -------------------------------------------------------------------------------- 1 | config->getString('installationFolder'); 22 | 23 | $varFolder = $installationFolder . '/var'; 24 | if (!is_dir($varFolder)) { 25 | @mkdir($varFolder); 26 | } 27 | 28 | @chmod($varFolder, 0777); 29 | 30 | $varCacheFolder = $installationFolder . '/var/cache'; 31 | if (!is_dir($varCacheFolder)) { 32 | @mkdir($varCacheFolder); 33 | } 34 | 35 | @chmod($varCacheFolder, 0777); 36 | 37 | $mediaFolder = $installationFolder . '/media'; 38 | if (!is_dir($mediaFolder)) { 39 | @mkdir($mediaFolder); 40 | } 41 | 42 | @chmod($mediaFolder, 0777); 43 | 44 | $finder = Finder::create(); 45 | $finder->directories() 46 | ->ignoreUnreadableDirs(true) 47 | ->in([$varFolder, $mediaFolder]); 48 | foreach ($finder as $dir) { 49 | @chmod($dir->getRealpath(), 0777); 50 | } 51 | } catch (Exception $exception) { 52 | $this->output->writeln('' . $exception->getMessage() . ''); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/N98/MagerunBootstrap.php: -------------------------------------------------------------------------------- 1 | backup !== null) { 38 | throw new BadMethodCallException("Environment already backed up, can't initialize any longer"); 39 | } 40 | 41 | if (!is_array($GLOBALS['argv'])) { 42 | throw new UnexpectedValueException('Need argv to work'); 43 | } 44 | 45 | $basename = basename($GLOBALS['argv'][0]); 46 | 47 | foreach ($this->keys as $key) { 48 | $buffer = $_SERVER[$key]; 49 | $this->backup[$key] = $buffer; 50 | $_SERVER[$key] = str_replace($basename, 'index.php', $buffer); 51 | } 52 | } 53 | 54 | public function reset(): void 55 | { 56 | if ($this->backup === null) { 57 | throw new BadMethodCallException("Environment not yet backed up, initialize first, can't reset"); 58 | } 59 | 60 | foreach ($this->backup as $key => $value) { 61 | $_SERVER[$key] = $value; 62 | } 63 | 64 | $this->backup = null; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /tests/N98/Magento/Command/System/Setup/CompareVersionsCommandTest.php: -------------------------------------------------------------------------------- 1 | getApplication(); 16 | $application->add(new CompareVersionsCommand()); 17 | 18 | $command = $this->getApplication()->find('sys:setup:compare-versions'); 19 | 20 | $commandTester = new CommandTester($command); 21 | $commandTester->execute( 22 | ['command' => $command->getName()], 23 | ); 24 | 25 | $this->assertMatchesRegularExpression('/Setup/', $commandTester->getDisplay()); 26 | $this->assertMatchesRegularExpression('/Module/', $commandTester->getDisplay()); 27 | $this->assertMatchesRegularExpression('/DB/', $commandTester->getDisplay()); 28 | $this->assertMatchesRegularExpression('/Data/', $commandTester->getDisplay()); 29 | $this->assertMatchesRegularExpression('/Status/', $commandTester->getDisplay()); 30 | } 31 | 32 | public function testJunit() 33 | { 34 | vfsStream::setup(); 35 | $application = $this->getApplication(); 36 | $application->add(new CompareVersionsCommand()); 37 | 38 | $command = $this->getApplication()->find('sys:setup:compare-versions'); 39 | 40 | $commandTester = new CommandTester($command); 41 | $commandTester->execute( 42 | ['command' => $command->getName(), '--log-junit' => vfsStream::url('root/junit.xml')], 43 | ); 44 | 45 | $this->assertFileExists(vfsStream::url('root/junit.xml')); 46 | } 47 | } 48 | --------------------------------------------------------------------------------