Completed
Branch master (597d40)
by Douglas
02:41 queued 01:20
created

TableTest::testCreatingATable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * (c) 2018 Douglas Reith.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Reith\ToyRobot\Domain\Space;
11
12
use PHPUnit\Framework\TestCase;
13
use Reith\ToyRobot\Domain\Robot\Place;
14
15
class TableTest extends TestCase
16
{
17
    public static function testCreatingATable()
18
    {
19
        // For a 10 x 10 table, for example
20
        $table = Table::create(10);
21
22
        self::assertInstanceOf(Table::class, $table);
23
    }
24
25
    /**
26
     * When moving in a space, the dimensions of the move must
27
     * be the same dimensionality as the space (in this model).
28
     *
29
     * @dataProvider getPlacesNotFitForATable
30
     * @expectedException \Reith\ToyRobot\Domain\Space\Exception\PlaceDimensionsDoNotMatchSpaceException
31
     */
32
    public static function testThatMovementsMustBeOfTheSameDimensionality(Place $badPlace)
33
    {
34
        $table = Table::create(5);
35
        self::assertInstanceOf(Table::class, $table);
36
37
        // If we just pass one Place to move() $from
38
        // is assumed to be origin
39
        $table->move($badPlace);
40
    }
41
42
    public static function getPlacesNotFitForATable(): array
43
    {
44
        return [
45
            [Place::create([1])],
46
            [Place::create([1, 1, 1])],
47
            [Place::create([1, 1, 1, 1])],
48
        ];
49
    }
50
}
51