44
55use Dissect \Lexer \CommonToken ;
66use OutOfBoundsException ;
7+ use PHPUnit \Framework \Attributes \Test ;
78use PHPUnit \Framework \TestCase ;
89
910class ArrayTokenStreamTest extends TestCase
@@ -21,17 +22,13 @@ protected function setUp(): void
2122 ]);
2223 }
2324
24- /**
25- * @test
26- */
25+ #[Test]
2726 public function theCursorShouldBeOnFirstTokenByDefault ()
2827 {
2928 $ this ->assertEquals ('6 ' , $ this ->stream ->getCurrentToken ()->getValue ());
3029 }
3130
32- /**
33- * @test
34- */
31+ #[Test]
3532 public function getPositionShouldReturnCurrentPosition ()
3633 {
3734 $ this ->stream ->seek (2 );
@@ -40,79 +37,61 @@ public function getPositionShouldReturnCurrentPosition()
4037 $ this ->assertEquals (3 , $ this ->stream ->getPosition ());
4138 }
4239
43- /**
44- * @test
45- */
40+ #[Test]
4641 public function lookAheadShouldReturnTheCorrectToken ()
4742 {
4843 $ this ->assertEquals ('5 ' , $ this ->stream ->lookAhead (2 )->getValue ());
4944 }
5045
51- /**
52- * @test
53- */
46+ #[Test]
5447 public function lookAheadShouldThrowAnExceptionWhenInvalid ()
5548 {
5649 $ this ->expectException (OutOfBoundsException::class);
5750 $ this ->stream ->lookAhead (15 );
5851 }
5952
60- /**
61- * @test
62- */
53+ #[Test]
6354 public function getShouldReturnATokenByAbsolutePosition ()
6455 {
6556 $ this ->assertEquals ('3 ' , $ this ->stream ->get (4 )->getValue ());
6657 }
6758
68- /**
69- * @test
70- */
59+ #[Test]
7160 public function getShouldThrowAnExceptionWhenInvalid ()
7261 {
7362 $ this ->expectException (OutOfBoundsException::class);
7463 $ this ->stream ->get (15 );
7564 }
7665
77- /**
78- * @test
79- */
66+ #[Test]
8067 public function moveShouldMoveTheCursorByToAnAbsolutePosition ()
8168 {
8269 $ this ->stream ->move (2 );
8370 $ this ->assertEquals ('5 ' , $ this ->stream ->getCurrentToken ()->getValue ());
8471 }
8572
86- /**
87- * @test
88- */
73+ #[Test]
8974 public function moveShouldThrowAnExceptionWhenInvalid ()
9075 {
9176 $ this ->expectException (OutOfBoundsException::class);
9277 $ this ->stream ->move (15 );
9378 }
9479
95- /**
96- * @test
97- */
80+ #[Test]
9881 public function seekShouldMoveTheCursorByRelativeOffset ()
9982 {
10083 $ this ->stream ->seek (4 );
10184 $ this ->assertEquals ('3 ' , $ this ->stream ->getCurrentToken ()->getValue ());
10285 }
10386
104- /**
105- * @test
106- */
87+ #[Test]
10788 public function seekShouldThrowAnExceptionWhenInvalid ()
10889 {
10990 $ this ->expectException (OutOfBoundsException::class);
11091 $ this ->stream ->seek (15 );
11192 }
11293
113- /**
114- * @test
115- */
94+ #[Test]
11695 public function nextShouldMoveTheCursorOneTokenAhead ()
11796 {
11897 $ this ->stream ->next ();
@@ -122,9 +101,7 @@ public function nextShouldMoveTheCursorOneTokenAhead()
122101 $ this ->assertEquals ('5 ' , $ this ->stream ->getCurrentToken ()->getValue ());
123102 }
124103
125- /**
126- * @test
127- */
104+ #[Test]
128105 public function nextShouldThrowAnExceptionWhenAtTheEndOfTheStream ()
129106 {
130107 $ this ->expectException (OutOfBoundsException::class);
0 commit comments