-
Notifications
You must be signed in to change notification settings - Fork 44
/
LanPlayTest.php
87 lines (65 loc) · 1.71 KB
/
LanPlayTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
namespace Chess\Tests\Unit\Play;
use Chess\Play\LanPlay;
use Chess\Tests\AbstractUnitTestCase;
class LanPlayTest extends AbstractUnitTestCase
{
/**
* @test
*/
public function foo()
{
$this->expectException(\Chess\Exception\PlayException::class);
$movetext = 'foo';
$board = (new LanPlay($movetext))->validate()->getBoard();
}
/**
* @test
*/
public function e2e4_e2e4()
{
$this->expectException(\Chess\Exception\PlayException::class);
$movetext = 'e2e4 e2e4';
$board = (new LanPlay($movetext))->validate()->getBoard();
}
/**
* @test
*/
public function e2e4_e7e5()
{
$movetext = 'e2e4 e7e5';
$board = (new LanPlay($movetext))->validate()->getBoard();
$expected = '1.e4 e5';
$this->assertSame($expected, $board->getMovetext());
}
/**
* @test
*/
public function e2e4__e7e5()
{
$movetext = 'e2e4 e7e5';
$board = (new LanPlay($movetext))->validate()->getBoard();
$expected = '1.e4 e5';
$this->assertSame($expected, $board->getMovetext());
}
/**
* @test
*/
public function e2e4_e7e5_g1f3()
{
$movetext = 'e2e4 e7e5 g1f3';
$board = (new LanPlay($movetext))->validate()->getBoard();
$expected = '1.e4 e5 2.Nf3';
$this->assertSame($expected, $board->getMovetext());
}
/**
* @test
*/
public function e2e4_e7e5___g1f3()
{
$movetext = 'e2e4 e7e5 g1f3';
$board = (new LanPlay($movetext))->validate()->getBoard();
$expected = '1.e4 e5 2.Nf3';
$this->assertSame($expected, $board->getMovetext());
}
}