Skip to content

Commit

Permalink
Add hook to allow mocking final classes
Browse files Browse the repository at this point in the history
  • Loading branch information
natewiebe13 committed Jan 18, 2022
1 parent f33ef7a commit 925e9af
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"require-dev": {
"ext-intl": "*",
"ext-mongodb": "*",
"dg/bypass-finals": "^1.2",
"symfony/framework-bundle": "^4.4|^5.2",
"symfony/expression-language": "^4.4|^5.2",
"symfony/phpunit-bridge": "^4.4|^5.2",
Expand Down
4 changes: 4 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
</testsuite>
</testsuites>

<extensions>
<extension class="APY\DataGridBundle\Tests\Hook\BypassFinalHook" />
</extensions>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>
Expand Down
14 changes: 14 additions & 0 deletions tests/Hook/BypassFinalHook.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace APY\DataGridBundle\Tests\Hook;

use DG\BypassFinals;
use PHPUnit\Runner\BeforeTestHook;

class BypassFinalHook implements BeforeTestHook
{
public function executeBeforeTest(string $test): void
{
BypassFinals::enable();
}
}

0 comments on commit 925e9af

Please sign in to comment.