Test Setup Failed
Branch master (ba7819)
by David
01:48
created

PlaceCollectorTest::testAddAndGetByWeight()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 4
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 10
rs 10
1
<?php
2
3
use GGGGino\WarehousePath\Entity\Corridor;
4
use GGGGino\WarehousePath\Entity\CorridorNoForklift;
5
use GGGGino\WarehousePath\Entity\Location;
6
use GGGGino\WarehousePath\Entity\Place;
7
use GGGGino\WarehousePath\Entity\Wall;
8
use GGGGino\WarehousePath\PlacesCollector;
9
use GGGGino\WarehousePath\Warehouse;
10
use GGGGino\WarehousePath\WarehouseTree;
0 ignored issues
show
Bug introduced by
The type GGGGino\WarehousePath\WarehouseTree was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use PHPUnit\Framework\TestCase;
12
13
final class PlaceCollectorTest extends TestCase
14
{
15
    public function testGetTotalPlaces(): void
16
    {
17
        /** @var PlacesCollector $placeCollector */
18
        $placeCollector = new PlacesCollector();
19
20
        $placeCollector->addBasePlaceTypes();
21
22
        $this->assertEquals(3, count($placeCollector->getPlacesType()));
23
    }
24
25
    public function testGetByWeight(): void
26
    {
27
        /** @var PlacesCollector $placeCollector */
28
        $placeCollector = new PlacesCollector();
29
30
        $placeCollector->addBasePlaceTypes();
31
32
        $this->assertInstanceOf(Corridor::class, $placeCollector->getPlaceTypeByWeight(2));
33
    }
34
35
    public function testAddAndGetByWeight(): void
36
    {
37
        /** @var PlacesCollector $placeCollector */
38
        $placeCollector = new PlacesCollector();
39
40
        $placeCollector->addBasePlaceTypes();
41
42
        $placeCollector->addPlaceType(new CorridorNoForklift());
43
44
        $this->assertInstanceOf(CorridorNoForklift::class, $placeCollector->getPlaceTypeByWeight(5));
45
    }
46
}