Skip to content

Commit 0320fcf

Browse files
author
Fureev Eugene
committed
fix: tests
1 parent 8af744c commit 0320fcf

File tree

7 files changed

+31
-32
lines changed

7 files changed

+31
-32
lines changed

.github/workflows/php.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,4 @@ jobs:
8787
# Docs: https://getcomposer.org/doc/articles/scripts.md
8888

8989
- name: Run test suite
90-
run: composer test
90+
run: XDEBUG_MODE=coverage composer test

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"ext-mbstring": "*"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "^10.0.11",
24-
"phpstan/phpstan": "^1.10.2",
23+
"phpunit/phpunit": "^10.1.1",
24+
"phpstan/phpstan": "^1.10.14",
2525
"squizlabs/php_codesniffer": "^3.7.2"
2626
},
2727
"autoload": {

phpunit.xml

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php"
33
colors="true" processIsolation="false" executionOrder="random" resolveDependencies="true" stopOnFailure="false"
4-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" cacheDirectory=".phpunit.cache"
55
backupStaticProperties="false">
66
<coverage>
7-
<include>
8-
<directory suffix=".php">./src</directory>
9-
</include>
107
<report>
118
<clover outputFile="./clover.xml"/>
129
<html outputDirectory="./storage/coverage/html"/>
@@ -22,4 +19,9 @@
2219
<logging>
2320
<junit outputFile="./storage/coverage/junit.xml"/>
2421
</logging>
22+
<source>
23+
<include>
24+
<directory suffix=".php">./src</directory>
25+
</include>
26+
</source>
2527
</phpunit>

src/Structures/Collections/ReadableCollection.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ public function filter(Closure $func = null): ReadableCollection;
173173
/**
174174
* Create a collection of all elements that do not pass a given truth test.
175175
*
176-
* @param Closure $func The predicate used for filtering.
177-
* @psalm-param Closure(T, TKey):bool $func
176+
* @param Closure $callback The predicate used for filtering.
177+
* @psalm-param Closure(T, TKey):bool $callback
178178
*
179179
* @return ReadableCollection<mixed> A collection with the results of the filter operation.
180180
* @psalm-return ReadableCollection<TKey, T>
@@ -255,6 +255,7 @@ public function transform(Closure $func): static;
255255
* @param \iterable|Arrayable $items
256256
* @return static
257257
*/
258+
// @phpstan-ignore-next-line
258259
public function merge(mixed $items): static;
259260

260261
/**

tests/Helpers/ArrTest.php

+9-13
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function testMerge(): void
106106
}
107107

108108

109-
public function providerDataToArray(): array
109+
public static function providerDataToArray(): array
110110
{
111111
$arrayableClass = new class () implements \Php\Support\Interfaces\Arrayable {
112112
private $data = [
@@ -257,8 +257,6 @@ public function jsonSerialize(): mixed
257257
*
258258
* @param mixed $items
259259
* @param $exp
260-
*
261-
* @throws \Php\Support\Exceptions\JsonException
262260
*/
263261
public function testDataToArray($items, $exp): void
264262
{
@@ -270,7 +268,7 @@ public function testDataToArray($items, $exp): void
270268
/**
271269
* @return array
272270
*/
273-
public function providerToArray(): array
271+
public static function providerToArray(): array
274272
{
275273
$arrayableClass = new class () implements \Php\Support\Interfaces\Arrayable {
276274
private $data = [
@@ -383,8 +381,6 @@ public function jsonSerialize(): mixed
383381
*
384382
* @param $items
385383
* @param $exp
386-
*
387-
* @throws \Php\Support\Exceptions\JsonException
388384
*/
389385
public function testToArray($items, $exp): void
390386
{
@@ -595,7 +591,7 @@ public function testFromPostgresPoint(): void
595591
/**
596592
* @return array
597593
*/
598-
public function providerRemoveByValue(): array
594+
public static function providerRemoveByValue(): array
599595
{
600596
return [
601597
[
@@ -756,7 +752,7 @@ public function testRemoveByValue($expArray, $expIdx, $array, $val): void
756752
/**
757753
* @return array
758754
*/
759-
public function providerRemoveByValueAndReindex(): array
755+
public static function providerRemoveByValueAndReindex(): array
760756
{
761757
return [
762758
[
@@ -919,7 +915,7 @@ public function testRemoveByValueAndReindex($expArray, $expIdx, $array, $val): v
919915
/**
920916
* @return array
921917
*/
922-
public function providerGet(): array
918+
public static function providerGet(): array
923919
{
924920
$array = [
925921
'key' => [
@@ -1030,7 +1026,7 @@ public function testGet($expVal, $array, $key): void
10301026
/**
10311027
* @return array
10321028
*/
1033-
public function providerHas(): array
1029+
public static function providerHas(): array
10341030
{
10351031
$array = [
10361032
'key' => [
@@ -1104,7 +1100,7 @@ public function testHas($expVal, $array, $key): void
11041100
/**
11051101
* @return array
11061102
*/
1107-
public function providerSet(): array
1103+
public static function providerSet(): array
11081104
{
11091105
$array = [];
11101106

@@ -1188,7 +1184,7 @@ public function testSet2(): void
11881184
/**
11891185
* @return array
11901186
*/
1191-
public function providerRemove(): array
1187+
public static function providerRemove(): array
11921188
{
11931189
$array = [
11941190
'key' => [
@@ -1267,7 +1263,7 @@ public function testRemove2(): void
12671263
/**
12681264
* @return array
12691265
*/
1270-
public function dataReplaceByTemplate(): array
1266+
public static function dataReplaceByTemplate(): array
12711267
{
12721268
return [
12731269
[

tests/Helpers/NumberTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
final class NumberTest extends TestCase
1414
{
15-
public function providerSafeInt(): array
15+
public static function providerSafeInt(): array
1616
{
1717
return [
1818
[
@@ -82,7 +82,7 @@ public function testSafeInt(int|string $value, int|string $exp): void
8282
}
8383

8484

85-
public function providerIsInteger(): array
85+
public static function providerIsInteger(): array
8686
{
8787
return [
8888
[

tests/Helpers/StrTest.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ final class StrTest extends TestCase
1515
{
1616
use HasReflection;
1717

18-
public function providerDataSnake(): array
18+
public static function providerDataSnake(): array
1919
{
2020
return [
2121
[
@@ -118,7 +118,7 @@ public function testSnake($str, $exp): void
118118
static::assertEquals($exp, $result);
119119
}
120120

121-
public function providerToScreamingSnake(): array
121+
public static function providerToScreamingSnake(): array
122122
{
123123
return [
124124
[
@@ -221,7 +221,7 @@ public function testToScreamingSnake($str, $exp): void
221221
static::assertEquals($exp, $result);
222222
}
223223

224-
public function providerDataKebab(): array
224+
public static function providerDataKebab(): array
225225
{
226226
return [
227227
[
@@ -325,7 +325,7 @@ public function testToKebab($str, $exp): void
325325
}
326326

327327

328-
public function providerCamel(): array
328+
public static function providerCamel(): array
329329
{
330330
return [
331331
[
@@ -396,7 +396,7 @@ public function testToCamel($str, $exp): void
396396
static::assertEquals($exp, $result);
397397
}
398398

399-
public function providerLowerCamel(): array
399+
public static function providerLowerCamel(): array
400400
{
401401
return [
402402
[
@@ -487,7 +487,7 @@ public function testToCache(): void
487487
/**
488488
* @return array
489489
*/
490-
public function dataReplaceStrTo(): array
490+
public static function dataReplaceStrTo(): array
491491
{
492492
return [
493493
[
@@ -602,7 +602,7 @@ public function testReplaceStrTo(string $val, int $fromStart, int $fromEnd, stri
602602
/**
603603
* @return array
604604
*/
605-
public function dataReplaceByTemplate(): array
605+
public static function dataReplaceByTemplate(): array
606606
{
607607
return [
608608
[
@@ -647,7 +647,7 @@ public function testReplaceByTemplate(string $str, array $replaced, string $exp)
647647
static::assertEquals($exp, $result);
648648
}
649649

650-
public function dataRegExps(): array
650+
public static function dataRegExps(): array
651651
{
652652
return [
653653
[

0 commit comments

Comments
 (0)