Skip to content

Commit

Permalink
Fix PHPUnit, use new config for it
Browse files Browse the repository at this point in the history
  • Loading branch information
arogachev committed Dec 11, 2023
1 parent 57e665f commit 25aeacf
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 30 deletions.
36 changes: 16 additions & 20 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
colors="true"
verbose="true"
failOnRisky="true"
failOnWarning="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false"
executionOrder="random"
resolveDependencies="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
>
<php>
<ini name="error_reporting" value="-1"/>
</php>

<testsuites>
<testsuite name="Yii Role-Based Access Control tests">
<directory>./tests</directory>
</testsuite>
</testsuites>

<coverage>
<include>
<directory>./src</directory>
</include>
</coverage>
<php>
<ini name="error_reporting" value="-1"/>
</php>
<testsuites>
<testsuite name="Yii Role-Based Access Control tests">
<directory>./tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>./src</directory>
</include>
</source>
</phpunit>
4 changes: 2 additions & 2 deletions tests/Common/AssignmentsStorageTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trait AssignmentsStorageTestTrait

protected function setUp(): void
{
if ($this->getName() === 'testAdd') {
if ($this->name() === 'testAdd') {
ClockMock::freeze(new DateTime('2023-05-10 08:24:39'));
}

Expand All @@ -32,7 +32,7 @@ protected function setUp(): void

protected function tearDown(): void
{
if ($this->getName() === 'testAdd') {
if ($this->name() === 'testAdd') {
ClockMock::reset();
}

Expand Down
8 changes: 4 additions & 4 deletions tests/Common/ItemsStorageTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function testGetWithNonExistingName(): void
$this->assertNull($storage->get('Non-existing name'));
}

public function existsProvider(): array
public static function dataExists(): array
{
return [
['Parent 1', true],
Expand All @@ -95,7 +95,7 @@ public function existsProvider(): array
}

/**
* @dataProvider existsProvider
* @dataProvider dataExists
*/
public function testExists(string $name, bool $expectedExists): void
{
Expand Down Expand Up @@ -345,7 +345,7 @@ public function testRemove(): void
$this->assertFalse($storage->hasChildren('Parent 2'));
}

public function getParentsProvider(): array
public static function dataGetParents(): array
{
return [
['Child 1', ['Parent 1']],
Expand All @@ -362,7 +362,7 @@ public function getParentsProvider(): array
}

/**
* @dataProvider getParentsProvider
* @dataProvider dataGetParents
*/
public function testGetParents(string $childName, array $expectedParents): void
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Common/ManagerLogicTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ trait ManagerLogicTestTrait

protected function setUp(): void
{
if (in_array($this->getName(), self::$frozenTimeTests, strict: true)) {
if (in_array($this->name(), self::$frozenTimeTests, strict: true)) {
ClockMock::freeze(new DateTime('2023-05-10 08:24:39'));
}
}

protected function tearDown(): void
{
if (in_array($this->getName(), self::$frozenTimeTests, strict: true)) {
if (in_array($this->name(), self::$frozenTimeTests, strict: true)) {
ClockMock::reset();
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/CompositeRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

final class CompositeRuleTest extends TestCase
{
public function compositeRuleDataProvider(): array
public static function dataCompositeRule(): array
{
return [
'AND empty' => [CompositeRule::AND, [], true],
Expand All @@ -28,7 +28,7 @@ public function compositeRuleDataProvider(): array
}

/**
* @dataProvider compositeRuleDataProvider
* @dataProvider dataCompositeRule
*/
public function testCompositeRule(string $operator, array $rules, bool $expected): void
{
Expand Down

0 comments on commit 25aeacf

Please sign in to comment.