ergebnis / test-util

Compare 89c2be7 ... +249 ... 26863cf

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 12 of 64 files from the diff.
Other files ignored by Codecov
phpstan.neon has changed.
.php_cs has changed.
.php_cs.fixture has changed.
Makefile has changed.
CHANGELOG.md has changed.
LICENSE.md has changed.
README.md has changed.
.gitattributes has changed.
psalm.xml has changed.
composer.json has changed.
infection.json has changed.
composer.lock has changed.

@@ -0,0 +1,105 @@
Loading
1 +
<?php
2 +
3 +
declare(strict_types=1);
4 +
5 +
/**
6 +
 * Copyright (c) 2017-2021 Andreas Möller
7 +
 *
8 +
 * For the full copyright and license information, please view
9 +
 * the LICENSE.md file that was distributed with this source code.
10 +
 *
11 +
 * @see https://github.com/ergebnis/test-util
12 +
 */
13 +
14 +
namespace Ergebnis\Test\Util\DataProvider;
15 +
16 +
use Ergebnis\Test\Util;
17 +
18 +
final class IntProvider
19 +
{
20 +
    use Util\Helper;
21 +
22 +
    /**
23 +
     * @return \Generator<string, array{0: int}>
24 +
     */
25 +
    public static function arbitrary(): \Generator
26 +
    {
27 +
        yield from self::provideDataForValues(self::values());
28 +
    }
29 +
30 +
    /**
31 +
     * @return \Generator<string, array{0: int}>
32 +
     */
33 +
    public static function lessThanZero(): \Generator
34 +
    {
35 +
        yield from self::provideDataForValuesWhere(self::values(), static function (int $value): bool {
36 +
            return 0 > $value;
37 +
        });
38 +
    }
39 +
40 +
    /**
41 +
     * @return \Generator<string, array{0: int}>
42 +
     */
43 +
    public static function zero(): \Generator
44 +
    {
45 +
        yield from self::provideDataForValuesWhere(self::values(), static function (int $value): bool {
46 +
            return 0 === $value;
47 +
        });
48 +
    }
49 +
50 +
    /**
51 +
     * @return \Generator<string, array{0: int}>
52 +
     */
53 +
    public static function greaterThanZero(): \Generator
54 +
    {
55 +
        yield from self::provideDataForValuesWhere(self::values(), static function (int $value): bool {
56 +
            return 0 < $value;
57 +
        });
58 +
    }
59 +
60 +
    /**
61 +
     * @return \Generator<string, array{0: int}>
62 +
     */
63 +
    public static function lessThanOne(): \Generator
64 +
    {
65 +
        yield from self::provideDataForValuesWhere(self::values(), static function (int $value): bool {
66 +
            return 1 > $value;
67 +
        });
68 +
    }
69 +
70 +
    /**
71 +
     * @return \Generator<string, array{0: int}>
72 +
     */
73 +
    public static function one(): \Generator
74 +
    {
75 +
        yield from self::provideDataForValuesWhere(self::values(), static function (int $value): bool {
76 +
            return 1 === $value;
77 +
        });
78 +
    }
79 +
80 +
    /**
81 +
     * @return \Generator<string, array{0: int}>
82 +
     */
83 +
    public static function greaterThanOne(): \Generator
84 +
    {
85 +
        yield from self::provideDataForValuesWhere(self::values(), static function (int $value): bool {
86 +
            return 1 < $value;
87 +
        });
88 +
    }
89 +
90 +
    /**
91 +
     * @return array<string, int>
92 +
     */
93 +
    private static function values(): array
94 +
    {
95 +
        $faker = self::faker();
96 +
97 +
        return [
98 +
            'int-less-than-minus-one' => -1 * $faker->numberBetween(1),
99 +
            'int-minus-one' => -1,
100 +
            'int-zero' => 0,
101 +
            'int-plus-one' => 1,
102 +
            'int-greater-than-plus-one' => $faker->numberBetween(1),
103 +
        ];
104 +
    }
105 +
}

@@ -0,0 +1,31 @@
Loading
1 +
<?php
2 +
3 +
declare(strict_types=1);
4 +
5 +
/**
6 +
 * Copyright (c) 2017-2021 Andreas Möller
7 +
 *
8 +
 * For the full copyright and license information, please view
9 +
 * the LICENSE.md file that was distributed with this source code.
10 +
 *
11 +
 * @see https://github.com/ergebnis/test-util
12 +
 */
13 +
14 +
namespace Ergebnis\Test\Util\DataProvider;
15 +
16 +
use Ergebnis\Test\Util;
17 +
18 +
final class ObjectProvider
19 +
{
20 +
    use Util\Helper;
21 +
22 +
    /**
23 +
     * @return \Generator<string, array{0: bool}>
24 +
     */
25 +
    public static function object(): \Generator
26 +
    {
27 +
        yield from self::provideDataForValues([
28 +
            'object' => new \stdClass(),
29 +
        ]);
30 +
    }
31 +
}

@@ -3,7 +3,7 @@
Loading
3 3
declare(strict_types=1);
4 4
5 5
/**
6 -
 * Copyright (c) 2017-2020 Andreas Möller
6 +
 * Copyright (c) 2017-2021 Andreas Möller
7 7
 *
8 8
 * For the full copyright and license information, please view
9 9
 * the LICENSE.md file that was distributed with this source code.

@@ -0,0 +1,31 @@
Loading
1 +
<?php
2 +
3 +
declare(strict_types=1);
4 +
5 +
/**
6 +
 * Copyright (c) 2017-2021 Andreas Möller
7 +
 *
8 +
 * For the full copyright and license information, please view
9 +
 * the LICENSE.md file that was distributed with this source code.
10 +
 *
11 +
 * @see https://github.com/ergebnis/test-util
12 +
 */
13 +
14 +
namespace Ergebnis\Test\Util\DataProvider;
15 +
16 +
use Ergebnis\Test\Util;
17 +
18 +
final class ResourceProvider
19 +
{
20 +
    use Util\Helper;
21 +
22 +
    /**
23 +
     * @return \Generator<string, array{0: resource}>
24 +
     */
25 +
    public static function resource(): \Generator
26 +
    {
27 +
        yield from self::provideDataForValues([
28 +
            'resource' => \fopen(__FILE__, 'rb'),
29 +
        ]);
30 +
    }
31 +
}

@@ -3,7 +3,7 @@
Loading
3 3
declare(strict_types=1);
4 4
5 5
/**
6 -
 * Copyright (c) 2017-2020 Andreas Möller
6 +
 * Copyright (c) 2017-2021 Andreas Möller
7 7
 *
8 8
 * For the full copyright and license information, please view
9 9
 * the LICENSE.md file that was distributed with this source code.
@@ -20,8 +20,6 @@
Loading
20 20
{
21 21
    /**
22 22
     * @param mixed $className
23 -
     *
24 -
     * @return self
25 23
     */
26 24
    public static function fromClassName($className): self
27 25
    {

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Learn more Showing 12 files with coverage changes found.

Changes in src/Exception/InvalidExcludeClassName.php
-1
Loading file...
Changes in src/Exception/NonExistentExcludeClass.php
-1
Loading file...
Changes in src/Exception/NonExistentDirectory.php
-1
Loading file...
Changes in src/Helper.php
-12
Loading file...
New file src/DataProvider/ResourceProvider.php
New
Loading file...
New file src/DataProvider/NullProvider.php
New
Loading file...
New file src/DataProvider/BoolProvider.php
New
Loading file...
New file src/DataProvider/FloatProvider.php
New
Loading file...
New file src/DataProvider/StringProvider.php
New
Loading file...
New file src/DataProvider/IntProvider.php
New
Loading file...
New file src/DataProvider/ObjectProvider.php
New
Loading file...
New file src/Exception/EmptyValues.php
New
Loading file...

251 Commits

Hiding 1 contexual commits
Hiding 1 contexual commits
Hiding 2 contexual commits Hiding 1 contexual commits Hiding 2 contexual commits Hiding 1 contexual commits Hiding 1 contexual commits Hiding 1 contexual commits Hiding 1 contexual commits Hiding 2 contexual commits Hiding 2 contexual commits Hiding 1 contexual commits Hiding 1 contexual commits Hiding 1 contexual commits Hiding 1 contexual commits