Skip to content

Commit

Permalink
release: 0.7.1
Browse files Browse the repository at this point in the history
* Removed/bump year
* Updated/fixed documentation
* Rebase on master
  • Loading branch information
rmp-up committed Jun 22, 2020
1 parent ade50eb commit eb5bb15
Show file tree
Hide file tree
Showing 24 changed files with 55 additions and 82 deletions.
25 changes: 25 additions & 0 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,28 @@ vendor/bin/wp --allow-root core update --minor
```bash
vendor/bin/phpunit
```

### Documetation

The documentation is done while testing using
`composer require --dev --update-with-all-dependencies pretzlaw/phpunit-docgen`.
Do NOT commit this package or the changed composer.json
because it would break testing under PHP 7.0 .

For phpunit.xml.dist add:

```xml
<listeners>
<listener class="Pretzlaw\PHPUnit\DocGen\TestCaseListener">
<arguments>
<string>var/documentation.html</string>
<string>rmp-up/wp-di</string>
<string>etc/documentation.css</string>
</arguments>
</listener>
</listeners>
```

And export the HTML to PDF using Chromium.
Firefox is not able to properly move images/text to the next page
without cutting them in half.
1 change: 0 additions & 1 deletion etc/phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
<rule ref="Squiz.Commenting.EmptyCatchComment"/>
<rule ref="Squiz.Scope.MethodScope"/>
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing"/>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Generic.Commenting.Todo"/>
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
Expand Down
6 changes: 3 additions & 3 deletions lib/Provider/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ public function register(Container $pimple)
}

/**
* @param Container $pimple
* @param string $serviceName
* @param array|object $definition
* @param Container $pimple
* @param string $serviceName
* @param array|object|null $definition
*/
protected function compile(Container $pimple, string $serviceName, $definition)
{
Expand Down
1 change: 1 addition & 0 deletions lib/ServiceDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private function resolveParameter(Container $pimple, string $parameter)
// Not found in Pimple so we fallback to options
return $this->resolveReference($parameter);
}

default:
return $parameter;
}
Expand Down
1 change: 0 additions & 1 deletion lib/Test/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
* AbstractTestCase
*
* @copyright 2020 Pretzlaw (https://rmp-up.de)
* @since 2019-04-25
*/
abstract class AbstractTestCase extends TestCase
{
Expand Down
71 changes: 26 additions & 45 deletions lib/Test/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,57 +47,46 @@
* We solve all of this by a simple service definition like this:
*
*
* ```php
* <?php // my-plugin-services.php
*
* use \RmpUp\WpDi\Provider;
* use \RmpUp\WpDi\Provider\WordPress;
*
* return [
* Provider\Services::class => [
* AnRepository::class,
*
* SomeSeoStuff::class => [
* 'arguments' => [
* AnRepository::class,
* 'some_foo'
* ]
* ]
* ],
*
* WordPress\Options::class => [
* 'some_foo' => 'The default value of this as long as not given',
* ]
*
* WordPress\Actions::class => [
* 'template_redirect' => [
* RejectUnauthorizedThings::class,
* SomeSeoStuff::class,
* ]
* ]
* ];
* ```yaml
* options:
* some_foo: The default value of this as long as does not exist
*
* services:
* AnRepository: ~
*
* SomeSeoStuff:
* arguments:
* - AnRepository
* - '%some_foo%'
* add_action: template_redirect
*
* RejectUnauthorizedThings:
* add_action:
* template_redirect:
* 69: __invoke
* ```
*
* Step after step this does:
*
* 1. Register the "AnRepository"-service
* 2. Register the "SomeSeoStuff"-service
* 1. "Register" a "some_foo"-option with a default value.
* 2. Register the "AnRepository"-service
* 3. Register the "SomeSeoStuff"-service
* * Use the "AnRepository"-service as first `__constructor` argument.
* * Use the "some_foo"-option as second argument.
* 3. "Register" a "some_foo"-option with a default value.
* 4. Add services to the `template_redirect` action:
* * A new "RejectUnauthorizedThings"-service
* * The existing "SomeSeoStuff"-service
* * Binds `SomeSeoStuff::__invoke` to the action "template_redirect"
* 4. Register the "RejectUnauthorizedThings"-service
* * Binds `RejectUnauthorizedThings::__invoke`
* to the action "template_redirect"
* with priority 69.
*
* So in case the `template_redirect` action is fired the services
* "RejectUnauthorizedThings" and "SomeSeoStuff" will be lazy loaded
* and invoked (e.g. using `__invoke`).
* and invoked.
*
* This is the very short syntax.
* Read on to know more about the complete syntax
* and other possibilities like ...
*
*
* * `WordPress\Filter` to register filter,
* * `WordPress\PostTypes` to register post-types,
* * `WordPress\CliCommands` to add services as command in wp-cli
Expand Down Expand Up @@ -143,14 +132,6 @@ protected function setUp()
$this->pimple->register(new Provider($this->definition));
}

public function testActionsRegistered()
{
self::assertFilterHasCallback('template_redirect', new IsInstanceOf(LazyService::class));
self::assertFilterHasCallback('template_redirect', new IsEqual(
new LazyService($this->container, Mirror::class)
));
}

public function testServicesRegistered()
{
static::assertInstanceOf(ArrayObject::class, $this->container->get(ArrayObject::class));
Expand Down
2 changes: 0 additions & 2 deletions lib/Test/WordPress/Actions/AbstractActionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-04-26
*/

declare(strict_types=1);
Expand All @@ -32,7 +31,6 @@
* AbstractActionsTest
*
* @copyright 2020 Pretzlaw (https://rmp-up.de)
* @since 2019-04-26
*/
abstract class AbstractActionsTest extends SanitizerTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-04-27
*/

declare(strict_types=1);
Expand Down
1 change: 0 additions & 1 deletion lib/Test/WordPress/Actions/RegistersActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-05-28
*/

declare(strict_types=1);
Expand Down
2 changes: 0 additions & 2 deletions lib/Test/WordPress/Options/Definition/OptionSpecTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-06-08
*/

declare(strict_types=1);
Expand All @@ -33,7 +32,6 @@
* @internal
*
* @copyright 2020 Pretzlaw (https://rmp-up.de)
* @since 2019-06-08
*/
class OptionSpecTest extends SanitizerTestCase
{
Expand Down
2 changes: 0 additions & 2 deletions lib/Test/WordPress/Options/OptionsTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-06-09
*/

declare(strict_types=1);
Expand All @@ -33,7 +32,6 @@
* OptionsTestCase
*
* @copyright 2020 Pretzlaw (https://rmp-up.de)
* @since 2019-06-09
*/
abstract class OptionsTestCase extends ProviderTestCase
{
Expand Down
2 changes: 0 additions & 2 deletions lib/Test/WordPress/Options/Provider/DefaultOptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-06-08
*/

declare(strict_types=1);
Expand All @@ -43,7 +42,6 @@
* integer 423379498.
*
* @copyright 2020 Pretzlaw (https://rmp-up.de)
* @since 2019-06-08
*/
class DefaultOptionTest extends OptionsTestCase
{
Expand Down
2 changes: 0 additions & 2 deletions lib/Test/WordPress/Options/Provider/IncludesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-06-09
*/

declare(strict_types=1);
Expand Down Expand Up @@ -48,7 +47,6 @@
* and "admin_email" from the options table (via `get_options`).
*
* @copyright 2020 Pretzlaw (https://rmp-up.de)
* @since 2019-06-09
*/
class IncludesTest extends ProviderTestCase
{
Expand Down
2 changes: 0 additions & 2 deletions lib/Test/WordPress/Options/Provider/UseInServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-06-09
*/

declare(strict_types=1);
Expand Down Expand Up @@ -53,7 +52,6 @@
* Now it can make use of `$this->pingSites` which is easier to test and maintain.
*
* @copyright 2020 Pretzlaw (https://rmp-up.de)
* @since 2019-06-09
*/
class UseInServiceTest extends OptionsTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-06-09
*/

declare(strict_types=1);
Expand All @@ -31,7 +30,6 @@
*
* @internal
* @copyright 2020 Pretzlaw (https://rmp-up.de)
* @since 2019-06-09
*/
class DefaultOptionExistsTest extends OptionsTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-06-09
*/

declare(strict_types=1);
Expand All @@ -31,7 +30,6 @@
*
* @internal
* @copyright 2020 Pretzlaw (https://rmp-up.de)
* @since 2019-06-09
*/
class OverwriteWithDefaultTest extends OptionsTestCase
{
Expand Down
2 changes: 0 additions & 2 deletions lib/Test/WordPress/Options/Validity/UnknownParameterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-06-09
*/

declare(strict_types=1);
Expand All @@ -31,7 +30,6 @@
*
* @internal
* @copyright 2020 Pretzlaw (https://rmp-up.de)
* @since 2019-06-09
*/
class UnknownParameterTest extends OptionsTestCase
{
Expand Down
2 changes: 0 additions & 2 deletions lib/Test/WordPress/Options/ValidityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-06-09
*/

declare(strict_types=1);
Expand All @@ -31,7 +30,6 @@
*
* @internal
* @copyright 2020 Pretzlaw (https://rmp-up.de)
* @since 2019-06-09
*/
class ValidityTest extends OptionsTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-05-29
*/

declare(strict_types=1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-05-29
*/

declare(strict_types=1);
Expand Down
2 changes: 0 additions & 2 deletions lib/Test/WordPress/Templates/FileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-06-15
*/

declare(strict_types=1);
Expand Down Expand Up @@ -83,7 +82,6 @@
*
*
* @copyright 2020 Pretzlaw (https://rmp-up.de)
* @since 2019-06-15
*/
class FileTest extends TemplatesTestCase
{
Expand Down
2 changes: 0 additions & 2 deletions lib/Test/WordPress/Templates/MultipleFilesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @copyright 2020 Pretzlaw
* @license https://rmp-up.de/license-generic.txt
* @link https://project.rmp-up.de/wp-di
* @since 2019-06-15
*/

declare(strict_types=1);
Expand Down Expand Up @@ -83,7 +82,6 @@
*
*
* @copyright 2020 Pretzlaw (https://rmp-up.de)
* @since 2019-06-15
*/
class MultipleFilesTest extends TemplatesTestCase
{
Expand Down
Loading

0 comments on commit eb5bb15

Please sign in to comment.