Skip to content

Commit

Permalink
Merge pull request #134 from snicco/feat/better-wp-cli
Browse files Browse the repository at this point in the history
feat(better-wp-cli): initial release
  • Loading branch information
calvinalkan committed May 2, 2022
2 parents b99b387 + 472be67 commit 83a0096
Show file tree
Hide file tree
Showing 127 changed files with 8,601 additions and 30 deletions.
1 change: 1 addition & 0 deletions .github/workflows/code_coverage.yaml
Expand Up @@ -97,6 +97,7 @@ jobs:

- name: 'Collect codeception coverage'
run: |
vendor/bin/codecept build
composer codeception:all -- --coverage-xml codeception-coverage.xml
- name: 'Archive code coverage results'
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/split_tests.yaml
Expand Up @@ -160,7 +160,9 @@ jobs:
echo ${{github.env}}
- name: 'Run codeception tests of package ${{ matrix.packages.full_name }}'
run: vendor/bin/codecept run wordpress
run: |
vendor/bin/codecept build
vendor/bin/codecept run wordpress
working-directory: ${{ matrix.packages.absolute_path }}

check_matrix:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/static_analysis.yaml
Expand Up @@ -56,10 +56,6 @@ jobs:
should_run: ${{ needs.diff.outputs.php == 'true' || needs.diff.outputs.composer == 'true' }}
run: composer validate

- name: 'Rector'
should_run: ${{ needs.diff.outputs.php == 'true' }}
run: vendor/bin/rector process --dry-run

- name: 'Easy coding standards'
should_run: ${{ needs.diff.outputs.php == 'true' }}
run: vendor/bin/ecs check
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/tests.yaml
Expand Up @@ -119,7 +119,9 @@ jobs:
working-directory: /tmp

- name: 'Run codeception tests'
run: composer codeception:all
run: |
vendor/bin/codecept build
composer codeception:all
check_matrix:
name: 'Tests'
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -44,6 +44,7 @@ This directory contains completely decoupled PHP components that you can use in
in distributed **WordPress** packages.
- [BetterWPCache](https://github.com/snicco/better-wp-cache): A PSR6/PSR16 implementation using
the [`WP_Object_Cache`](https://developer.wordpress.org/reference/classes/wp_object_cache/). Supports cache tagging.
- [BetterWPCLI](https://github.com/snicco/better-wp-cli): The missing parts to the already awesome [WP-CLI](https://wp-cli.org/).
- [BetterWPHooks](https://github.com/snicco/better-wp-hooks): The **WordPress** hook system redesign in 2022. (PSR-14
compliant)
- [BetterWPMail](https://github.com/snicco/better-wp-mail): The long overdue upgrade to
Expand Down
1 change: 1 addition & 0 deletions commit-scopes.json
Expand Up @@ -3,6 +3,7 @@
"*",
"better-wp-api",
"better-wp-cache",
"better-wp-cli",
"better-wp-hooks",
"better-wp-mail",
"better-wpdb",
Expand Down
8 changes: 3 additions & 5 deletions composer-require-checker.json
Expand Up @@ -44,10 +44,7 @@
"PHPMailer\\PHPMailer\\Exception",
"WP_UnitTest_Factory",
"WP_UnitTest_Factory_For_User",
"_________TESTING_CLASSES_TEMPORARY__________",
"Snicco\\Component\\EventDispatcher\\Testing\\TestableEventDispatcher",
"Snicco\\Component\\BetterWPMail\\Testing\\FakeTransport",
"Snicco\\Component\\HttpRouting\\Testing\\AssertableResponse",
"WP_CLI",
"_________ONLY_AS_STRINGS__________",
"GuzzleHttp\\Psr7\\HttpFactory",
"Nyholm\\Psr7\\Factory\\Psr17Factory",
Expand All @@ -68,6 +65,7 @@
"void",
"object",
"mixed",
"never"
"never",
"sapi_windows_vt100_support"
]
}
16 changes: 11 additions & 5 deletions composer.json
Expand Up @@ -56,20 +56,22 @@
"webmozart/assert": "^1.10"
},
"require-dev": {
"ext-curl": "*",
"cache/array-adapter": "^1.0.0",
"cache/integration-tests": "0.17.0",
"codeception/module-cli": "^1.1.1",
"fakerphp/faker": "^1.0.0-stable",
"guzzlehttp/guzzle": "^7.0.1",
"guzzlehttp/psr7": "^2.1",
"knplabs/github-api": "^3.0",
"laminas/laminas-diactoros": "^2.8",
"php-stubs/wordpress-stubs": "^5.9.0",
"rector/rector": "0.12.18",
"symfony/finder": "^5.0",
"symplify/easy-coding-standard": "10.1.2",
"symplify/monorepo-builder": "9.4.70",
"vimeo/psalm": "^4.10",
"vlucas/phpdotenv": "5.4.1"
"vimeo/psalm": "4.22.0",
"vlucas/phpdotenv": "5.4.1",
"wp-cli/wp-cli": "^2.6"
},
"autoload": {
"psr-4": {
Expand All @@ -92,6 +94,7 @@
"Snicco\\Bundle\\Templating\\": "src/Snicco/Bundle/templating/src",
"Snicco\\Bundle\\Testing\\": "src/Snicco/Bundle/testing/src",
"Snicco\\Component\\BetterWPAPI\\": "src/Snicco/Component/better-wp-api/src",
"Snicco\\Component\\BetterWPCLI\\": "src/Snicco/Component/better-wp-cli/src",
"Snicco\\Component\\BetterWPCache\\": "src/Snicco/Component/better-wp-cache/src",
"Snicco\\Component\\BetterWPDB\\": "src/Snicco/Component/better-wpdb/src",
"Snicco\\Component\\BetterWPHooks\\": "src/Snicco/Component/better-wp-hooks/src",
Expand Down Expand Up @@ -150,6 +153,10 @@
"Snicco\\Bundle\\Templating\\Tests\\": "src/Snicco/Bundle/templating/tests",
"Snicco\\Bundle\\Testing\\Tests\\": "src/Snicco/Bundle/testing/tests",
"Snicco\\Component\\BetterWPAPI\\Tests\\": "src/Snicco/Component/better-wp-api/tests",
"Snicco\\Component\\BetterWPCLI\\Tests\\": [
"src/Snicco/Component/better-wp-cli/tests",
"src/Snicco/Component/better-wp-cli/tests/_support"
],
"Snicco\\Component\\BetterWPCache\\Tests\\": "src/Snicco/Component/better-wp-cache/tests",
"Snicco\\Component\\BetterWPDB\\Tests\\": "src/Snicco/Component/better-wpdb/tests",
"Snicco\\Component\\BetterWPHooks\\Tests\\": "src/Snicco/Component/better-wp-hooks/tests",
Expand Down Expand Up @@ -238,18 +245,17 @@
"@psalm --update-baseline"
],
"lint:fix": [
"vendor/bin/rector process",
"vendor/bin/ecs --fix"
],
"lint": [
"vendor/bin/rector process --dry-run",
"vendor/bin/ecs check"
]
},
"replace": {
"snicco/better-wp-api": "self.version",
"snicco/better-wp-cache": "self.version",
"snicco/better-wp-cache-bundle": "self.version",
"snicco/better-wp-cli": "self.version",
"snicco/better-wp-hooks": "self.version",
"snicco/better-wp-hooks-bundle": "self.version",
"snicco/better-wp-mail": "self.version",
Expand Down
1 change: 1 addition & 0 deletions ecs.php
Expand Up @@ -41,6 +41,7 @@
// Intentionally keep the execDebug statements on two lines.
__DIR__ . '/bin/php/split-package.php',
],
__DIR__ . '/src/Snicco/Component/better-wp-cli/tests/_support',
]);

$parameters->set(Option::PARALLEL, true);
Expand Down
3 changes: 1 addition & 2 deletions monorepo-builder.php
Expand Up @@ -34,8 +34,7 @@
'symplify/monorepo-builder' => '9.4.70',
'vlucas/phpdotenv' => '5.4.1',
'lucatume/wp-browser' => '^3.1.4',
'vimeo/psalm' => '^4.10',
'rector/rector' => '0.12.18',
'vimeo/psalm' => '4.22.0',
'symplify/easy-coding-standard' => '10.1.2',
'webmozart/assert' => '^1.10',
'php-stubs/wordpress-stubs' => '^5.9.0',
Expand Down
10 changes: 10 additions & 0 deletions psalm.xml
Expand Up @@ -28,6 +28,9 @@
<file name="src/Snicco/Component/better-wp-cache/tests/wordpress/WPObjectCachePsr6IntegrationTest.php"/>
<file name="src/Snicco/Component/better-wp-cache/tests/wordpress/WPObjectCachePsr16IntegrationTest.php"/>
<file name="src/Snicco/Component/better-wp-cache/tests/wordpress/TaggingIntegrationTest.php"/>
<!-- This file is part of symfony/console -->
<file name="src/Snicco/Component/better-wp-cli/src/Style/Terminal.php"/>
<directory name="src/Snicco/Component/better-wp-cli/tests/_support"/>
</ignoreFiles>
</projectFiles>

Expand Down Expand Up @@ -61,6 +64,13 @@
</errorLevel>
</MixedAssignment>

<UndefinedMagicMethod>
<errorLevel type="suppress">
<!-- This issue occurs in CI if we don't build codeception modules before running psalm -->
<file name="src/Snicco/Component/better-wp-cli/tests/wordpress/WPCLICest.php"/>
</errorLevel>
</UndefinedMagicMethod>

</issueHandlers>

<globals>
Expand Down
8 changes: 8 additions & 0 deletions src/Snicco/Component/better-wp-cli/.gitattributes
@@ -0,0 +1,8 @@
.gitattributes export-ignore
.gitignore export-ignore
phpunit.xml.dist export-ignore
codeception.dist.yml export-ignore
*.md export-ignore
/tests export-ignore
/.github export-ignore
/examples export-ignore
@@ -0,0 +1,19 @@
name: Automatically close PR's

on:
pull_request_target:
types: [ opened ]

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: superbrothers/close-pull-request@v3
with:
# Optional. Post a issue comment just before closing a pull request.
comment: |
Hi, thank you for your contribution.
Unfortunately, this repository is read-only. It's a split from our main development repository.
We'd like to kindly ask you to move the contribution there - https://github.com/snicco/snicco.
We'll check it, review it and give you feed back right way.
Thank you.
5 changes: 5 additions & 0 deletions src/Snicco/Component/better-wp-cli/.gitignore
@@ -0,0 +1,5 @@
/.phpunit.cache/
/vendor
composer.lock
codception.yml
/tests/_support/_generated/
120 changes: 120 additions & 0 deletions src/Snicco/Component/better-wp-cli/LICENSE.md
@@ -0,0 +1,120 @@
#### Copyright (c) Calvin Alkan

This software package is licensed under the terms of the GNU LGPLv3. See below for the license text.

### GNU LESSER GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc.
<https://fsf.org/>

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU
General Public License, supplemented by the additional permissions listed below.

#### 0. Additional Definitions.

As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to
version 3 of the GNU General Public License.

"The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined
below.

An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on
the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by
the Library.

A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of
the Library with which the Combined Work was made is also called the "Linked Version".

The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding
any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not
on the Linked Version.

The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application,
including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the
System Libraries of the Combined Work.

#### 1. Exception to Section 3 of the GNU GPL.

You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.

#### 2. Conveying Modified Versions.

If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied
by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may
convey a copy of the modified version:

- a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not
supply the function or data, the facility still operates, and performs whatever part of its purpose remains
meaningful, or
- b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.

#### 3. Object Code Incorporating Material from Library Header Files.

The object code form of an Application may incorporate material from a header file that is part of the Library. You may
convey such object code under terms of your choice, provided that, if the incorporated material is not limited to
numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:

- a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its
use are covered by this License.
- b) Accompany the object code with a copy of the GNU GPL and this license document.

#### 4. Combined Works.

You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification
of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications,
if you also do each of the following:

- a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and
its use are covered by this License.
- b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
- c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library
among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
- d) Do one of the following:
-
0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application
Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application
with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by
section 6 of the GNU GPL for conveying Corresponding Source.
-
1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a)
uses at run time a copy of the Library already present on the user's computer system, and (b) will operate
properly with a modified version of the Library that is interface-compatible with the Linked Version.
- e) Provide Installation Information, but only if you would otherwise be required to provide such information under
section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified
version of the Combined Work produced by recombining or relinking the Application with a modified version of the
Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source
and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner
specified by section 6 of the GNU GPL for conveying Corresponding Source.)

#### 5. Combined Libraries.

You may place library facilities that are a work based on the Library side by side in a single library together with
other library facilities that are not Applications and are not covered by this License, and convey such a combined
library under terms of your choice, if you do both of the following:

- a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library
facilities, conveyed under the terms of this License.
- b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.

#### 6. Revised Versions of the GNU Lesser General Public License.

The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time
to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new
problems or concerns.

Each version is given a distinguishing version number. If the Library as you received it specifies that a certain
numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of
following the terms and conditions either of that published version or of any later version published by the Free
Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General
Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software
Foundation.

If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General
Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for
you to choose that version for the Library.

0 comments on commit 83a0096

Please sign in to comment.