4
4
5
5
use Dissect \Lexer \CommonToken ;
6
6
use OutOfBoundsException ;
7
+ use PHPUnit \Framework \Attributes \Test ;
7
8
use PHPUnit \Framework \TestCase ;
8
9
9
10
class ArrayTokenStreamTest extends TestCase
@@ -21,17 +22,13 @@ protected function setUp(): void
21
22
]);
22
23
}
23
24
24
- /**
25
- * @test
26
- */
25
+ #[Test]
27
26
public function theCursorShouldBeOnFirstTokenByDefault ()
28
27
{
29
28
$ this ->assertEquals ('6 ' , $ this ->stream ->getCurrentToken ()->getValue ());
30
29
}
31
30
32
- /**
33
- * @test
34
- */
31
+ #[Test]
35
32
public function getPositionShouldReturnCurrentPosition ()
36
33
{
37
34
$ this ->stream ->seek (2 );
@@ -40,79 +37,61 @@ public function getPositionShouldReturnCurrentPosition()
40
37
$ this ->assertEquals (3 , $ this ->stream ->getPosition ());
41
38
}
42
39
43
- /**
44
- * @test
45
- */
40
+ #[Test]
46
41
public function lookAheadShouldReturnTheCorrectToken ()
47
42
{
48
43
$ this ->assertEquals ('5 ' , $ this ->stream ->lookAhead (2 )->getValue ());
49
44
}
50
45
51
- /**
52
- * @test
53
- */
46
+ #[Test]
54
47
public function lookAheadShouldThrowAnExceptionWhenInvalid ()
55
48
{
56
49
$ this ->expectException (OutOfBoundsException::class);
57
50
$ this ->stream ->lookAhead (15 );
58
51
}
59
52
60
- /**
61
- * @test
62
- */
53
+ #[Test]
63
54
public function getShouldReturnATokenByAbsolutePosition ()
64
55
{
65
56
$ this ->assertEquals ('3 ' , $ this ->stream ->get (4 )->getValue ());
66
57
}
67
58
68
- /**
69
- * @test
70
- */
59
+ #[Test]
71
60
public function getShouldThrowAnExceptionWhenInvalid ()
72
61
{
73
62
$ this ->expectException (OutOfBoundsException::class);
74
63
$ this ->stream ->get (15 );
75
64
}
76
65
77
- /**
78
- * @test
79
- */
66
+ #[Test]
80
67
public function moveShouldMoveTheCursorByToAnAbsolutePosition ()
81
68
{
82
69
$ this ->stream ->move (2 );
83
70
$ this ->assertEquals ('5 ' , $ this ->stream ->getCurrentToken ()->getValue ());
84
71
}
85
72
86
- /**
87
- * @test
88
- */
73
+ #[Test]
89
74
public function moveShouldThrowAnExceptionWhenInvalid ()
90
75
{
91
76
$ this ->expectException (OutOfBoundsException::class);
92
77
$ this ->stream ->move (15 );
93
78
}
94
79
95
- /**
96
- * @test
97
- */
80
+ #[Test]
98
81
public function seekShouldMoveTheCursorByRelativeOffset ()
99
82
{
100
83
$ this ->stream ->seek (4 );
101
84
$ this ->assertEquals ('3 ' , $ this ->stream ->getCurrentToken ()->getValue ());
102
85
}
103
86
104
- /**
105
- * @test
106
- */
87
+ #[Test]
107
88
public function seekShouldThrowAnExceptionWhenInvalid ()
108
89
{
109
90
$ this ->expectException (OutOfBoundsException::class);
110
91
$ this ->stream ->seek (15 );
111
92
}
112
93
113
- /**
114
- * @test
115
- */
94
+ #[Test]
116
95
public function nextShouldMoveTheCursorOneTokenAhead ()
117
96
{
118
97
$ this ->stream ->next ();
@@ -122,9 +101,7 @@ public function nextShouldMoveTheCursorOneTokenAhead()
122
101
$ this ->assertEquals ('5 ' , $ this ->stream ->getCurrentToken ()->getValue ());
123
102
}
124
103
125
- /**
126
- * @test
127
- */
104
+ #[Test]
128
105
public function nextShouldThrowAnExceptionWhenAtTheEndOfTheStream ()
129
106
{
130
107
$ this ->expectException (OutOfBoundsException::class);
0 commit comments