Skip to content

Commit

Permalink
Added php_unit_test_case_static_method_calls to php-cs-fixer config
Browse files Browse the repository at this point in the history
  • Loading branch information
aivchen committed Jan 22, 2024
1 parent f07267b commit d49d322
Show file tree
Hide file tree
Showing 45 changed files with 843 additions and 844 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'declare_strict_types' => true,
'void_return' => true,
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced'],
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
];

$config = new PhpCsFixer\Config();
Expand Down
2 changes: 0 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ parameters:
paths:
- src
- tests
ignoreErrors:
- '#Dynamic call to static method PHPUnit\\Framework\\.*#'
6 changes: 3 additions & 3 deletions tests/Contracts/CancelTasksQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ public function testSetTypes(): void
{
$data = (new CancelTasksQuery())->setTypes(['abc', 'xyz']);

$this->assertEquals(['types' => 'abc,xyz'], $data->toArray());
self::assertEquals(['types' => 'abc,xyz'], $data->toArray());
}

public function testSetAnyDateFilter(): void
{
$date = new \DateTime();
$data = (new CancelTasksQuery())->setBeforeEnqueuedAt($date);

$this->assertEquals(['beforeEnqueuedAt' => $date->format(\DateTime::RFC3339)], $data->toArray());
self::assertEquals(['beforeEnqueuedAt' => $date->format(\DateTime::RFC3339)], $data->toArray());
}

public function testToArrayWithDifferentSets(): void
{
$data = (new CancelTasksQuery())->setUids([1, 2, 3])->setStatuses(['enqueued']);

$this->assertEquals([
self::assertEquals([
'uids' => '1,2,3', 'statuses' => 'enqueued',
],
$data->toArray()
Expand Down
6 changes: 3 additions & 3 deletions tests/Contracts/DeleteTasksQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ public function testSetTypes(): void
{
$data = (new DeleteTasksQuery())->setTypes(['abc', 'xyz']);

$this->assertEquals(['types' => 'abc,xyz'], $data->toArray());
self::assertEquals(['types' => 'abc,xyz'], $data->toArray());
}

public function testSetAnyDateFilter(): void
{
$date = new \DateTime();
$data = (new DeleteTasksQuery())->setCanceledBy([null])->setBeforeEnqueuedAt($date);

$this->assertEquals(['beforeEnqueuedAt' => $date->format(\DateTime::RFC3339)], $data->toArray());
self::assertEquals(['beforeEnqueuedAt' => $date->format(\DateTime::RFC3339)], $data->toArray());
}

public function testToArrayWithDifferentSets(): void
{
$data = (new DeleteTasksQuery())->setCanceledBy([1, 2])->setStatuses(['enqueued']);

$this->assertEquals([
self::assertEquals([
'canceledBy' => '1,2', 'statuses' => 'enqueued',
], $data->toArray()
);
Expand Down
8 changes: 4 additions & 4 deletions tests/Contracts/DocumentsQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@ public function testSetFields(): void
{
$data = (new DocumentsQuery())->setLimit(10)->setFields(['abc', 'xyz']);

$this->assertEquals(['limit' => 10, 'fields' => 'abc,xyz'], $data->toArray());
self::assertEquals(['limit' => 10, 'fields' => 'abc,xyz'], $data->toArray());
}

public function testToArrayWithoutSetFields(): void
{
$data = (new DocumentsQuery())->setLimit(10);

$this->assertEquals(['limit' => 10], $data->toArray());
self::assertEquals(['limit' => 10], $data->toArray());
}

public function testToArrayWithoutSetOffset(): void
{
$data = (new DocumentsQuery())->setOffset(10);

$this->assertEquals(['offset' => 10], $data->toArray());
self::assertEquals(['offset' => 10], $data->toArray());
}

public function testToArrayWithZeros(): void
{
$data = (new DocumentsQuery())->setLimit(0)->setOffset(0);

$this->assertEquals(['limit' => 0, 'offset' => 0], $data->toArray());
self::assertEquals(['limit' => 0, 'offset' => 0], $data->toArray());
}
}
8 changes: 4 additions & 4 deletions tests/Contracts/IndexesQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@ public function testToArrayWithSetOffsetAndSetLimit(): void
{
$data = (new IndexesQuery())->setLimit(10)->setOffset(18);

$this->assertEquals(['limit' => 10, 'offset' => 18], $data->toArray());
self::assertEquals(['limit' => 10, 'offset' => 18], $data->toArray());
}

public function testToArrayWithSetOffset(): void
{
$data = (new IndexesQuery())->setOffset(5);

$this->assertEquals(['offset' => 5], $data->toArray());
self::assertEquals(['offset' => 5], $data->toArray());
}

public function testToArrayWithoutSet(): void
{
$data = new IndexesQuery();

$this->assertEmpty($data->toArray());
self::assertEmpty($data->toArray());
}

public function testToArrayWithZeros(): void
{
$data = (new IndexesQuery())->setLimit(0)->setOffset(0);

$this->assertEquals(['limit' => 0, 'offset' => 0], $data->toArray());
self::assertEquals(['limit' => 0, 'offset' => 0], $data->toArray());
}
}
8 changes: 4 additions & 4 deletions tests/Contracts/KeysQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@ public function testToArrayWithSetOffsetAndSetLimit(): void
{
$data = (new KeysQuery())->setLimit(10)->setOffset(18);

$this->assertEquals(['limit' => 10, 'offset' => 18], $data->toArray());
self::assertEquals(['limit' => 10, 'offset' => 18], $data->toArray());
}

public function testToArrayWithSetOffset(): void
{
$data = (new KeysQuery())->setOffset(5);

$this->assertEquals(['offset' => 5], $data->toArray());
self::assertEquals(['offset' => 5], $data->toArray());
}

public function testToArrayWithoutSet(): void
{
$data = new KeysQuery();

$this->assertEmpty($data->toArray());
self::assertEmpty($data->toArray());
}

public function testToArrayWithZeros(): void
{
$data = (new KeysQuery())->setLimit(0)->setOffset(0);

$this->assertEquals(['limit' => 0, 'offset' => 0], $data->toArray());
self::assertEquals(['limit' => 0, 'offset' => 0], $data->toArray());
}
}
10 changes: 5 additions & 5 deletions tests/Contracts/TasksQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,36 @@ public function testSetTypes(): void
{
$data = (new TasksQuery())->setTypes(['abc', 'xyz']);

$this->assertEquals(['types' => 'abc,xyz'], $data->toArray());
self::assertEquals(['types' => 'abc,xyz'], $data->toArray());
}

public function testSetAnyDateFilter(): void
{
$date = new \DateTime();
$data = (new TasksQuery())->setBeforeEnqueuedAt($date);

$this->assertEquals($data->toArray(), ['beforeEnqueuedAt' => $date->format(\DateTime::RFC3339)]);
self::assertEquals($data->toArray(), ['beforeEnqueuedAt' => $date->format(\DateTime::RFC3339)]);
}

public function testToArrayWithSetLimit(): void
{
$data = (new TasksQuery())->setLimit(10);

$this->assertEquals(['limit' => 10], $data->toArray());
self::assertEquals(['limit' => 10], $data->toArray());
}

public function testToArrayWithSetLimitWithZero(): void
{
$data = (new TasksQuery())->setLimit(0);

$this->assertEquals(['limit' => 0], $data->toArray());
self::assertEquals(['limit' => 0], $data->toArray());
}

public function testToArrayWithDifferentSets(): void
{
$data = (new TasksQuery())->setFrom(10)->setLimit(9)->setCanceledBy([1, 4])->setStatuses(['enqueued']);

$this->assertEquals([
self::assertEquals([
'limit' => 9, 'from' => 10, 'statuses' => 'enqueued', 'canceledBy' => '1,4',
], $data->toArray());
}
Expand Down
Loading

0 comments on commit d49d322

Please sign in to comment.