@@ 42-59 (lines=18) @@ | ||
39 | /** |
|
40 | * @test |
|
41 | */ |
|
42 | public function shouldTokenizeSimpleType() |
|
43 | { |
|
44 | //given |
|
45 | $param = 'int $age'; |
|
46 | $tokenizer = new Tokenizer(); |
|
47 | ||
48 | //when |
|
49 | $tokens = $tokenizer->lex($param); |
|
50 | ||
51 | //then |
|
52 | Assert::thatArray($tokens) |
|
53 | ->extracting('getName()', 'getValue()') |
|
54 | ->containsExactly( |
|
55 | [Token::TYPE, 'int'], |
|
56 | [Token::NAME, '$age'], |
|
57 | [Token::EOF, 'eof'] |
|
58 | ); |
|
59 | } |
|
60 | ||
61 | /** |
|
62 | * @test |
|
@@ 64-82 (lines=19) @@ | ||
61 | /** |
|
62 | * @test |
|
63 | */ |
|
64 | public function shouldTokenizeSimpleTypeWithArray() |
|
65 | { |
|
66 | //given |
|
67 | $param = 'string[] $name'; |
|
68 | $tokenizer = new Tokenizer(); |
|
69 | ||
70 | //when |
|
71 | $tokens = $tokenizer->lex($param); |
|
72 | ||
73 | //then |
|
74 | Assert::thatArray($tokens) |
|
75 | ->extracting('getName()', 'getValue()') |
|
76 | ->containsExactly( |
|
77 | [Token::TYPE, 'string'], |
|
78 | [Token::ARRAYS, '[]'], |
|
79 | [Token::NAME, '$name'], |
|
80 | [Token::EOF, 'eof'] |
|
81 | ); |
|
82 | } |
|
83 | ||
84 | /** |
|
85 | * @test |