Completed
Push — main ( bb2763...a8dc43 )
by Peter
26s queued 13s
created

CollectionTest::testAllInstanceOf()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 5
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Framework\Html\Helper;
6
7
use AbterPhp\Framework\Html\INode;
8
use AbterPhp\Framework\Html\Node;
9
use AbterPhp\Framework\Html\Tag;
10
use PHPUnit\Framework\TestCase;
11
12
class CollectionTest extends TestCase
13
{
14
    /**
15
     * @return array
16
     */
17
    public function allInstanceOfProvider(): array
18
    {
19
        return [
20
            'empty'               => [[], Node::class, true],
21
            'one-node-node'       => [[new Node()], Node::class, true],
22
            'one-node-inode'      => [[new Node()], INode::class, true],
23
            'first-node-not-tag'  => [[new Node()], INode::class, true],
24
            'second-node-not-tag' => [[new Tag(), new Node()], Tag::class, false],
25
        ];
26
    }
27
28
    /**
29
     * @dataProvider allInstanceOfProvider
30
     *
31
     * @param array  $items
32
     * @param string $className
33
     * @param bool   $expectedResult
34
     */
35
    public function testAllInstanceOf(array $items, string $className, bool $expectedResult): void
36
    {
37
        $actualResult = Collection::allInstanceOf($items, $className);
38
39
        $this->assertEquals($expectedResult, $actualResult);
40
    }
41
}
42