Completed
Push — master ( af09d7...7599bb )
by Dorian
02:06
created

setUpBeforeSimpleMethodsTests()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Tests\Unit;
6
7
use PHPUnit\Framework\TestCase;
8
use Webmozart\Assert\Assert;
9
10
abstract class PhpUnitSimpleTestCase extends TestCase
11
{
12
    /** @var object */
13
    protected $instance;
14
15
    /**
16
     * @param mixed $expected
17
     *
18
     * @dataProvider getSimpleMethodsData
19
     */
20
    public function testSimpleMethods(string $method, array $arguments, $expected): void
21
    {
22
        Assert::object($this->instance);
23
24
        $this->setUpBeforeSimpleMethodsTests();
25
        $result = $this->instance->{$method}(...$arguments);
26
27
        $this->assertSame($expected, $result);
28
    }
29
30
    /**
31
     * Hook to be able to execute some code before the execution of the test
32
     */
33
    public function setUpBeforeSimpleMethodsTests(): void
34
    {
35
    }
36
37
    abstract public function getSimpleMethodsData(): array;
38
}
39