Skip to content

Commit 01bb9ed

Browse files
committed
tests: refactoring
1 parent e9387f9 commit 01bb9ed

File tree

3 files changed

+45
-53
lines changed

3 files changed

+45
-53
lines changed

tests/PhpGenerator/Extractor.extractAll.phpt

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -30,59 +30,8 @@ sameFile(__DIR__ . '/expected/Extractor.traits.expect', (string) $file);
3030
$file = (new Extractor(file_get_contents(__DIR__ . '/fixtures/bodies.php')))->extractAll();
3131
sameFile(__DIR__ . '/expected/Extractor.bodies.expect', (string) $file);
3232

33-
$file = (new Extractor(
34-
<<<'XX'
35-
<?php
36-
class Class1
37-
{
38-
public function foo()
39-
{
40-
new class {
41-
function bar() {
42-
}
43-
};
44-
}
45-
}
46-
47-
function () {};
48-
49-
/** doc */
50-
function foo(A $a): B|C
51-
{
52-
function bar()
53-
{
54-
}
55-
}
56-
57-
XX
58-
))->extractAll();
59-
Assert::type(Nette\PhpGenerator\PhpFile::class, $file);
60-
Assert::match(<<<'XX'
61-
<?php
62-
63-
class Class1
64-
{
65-
public function foo()
66-
{
67-
new class {
68-
function bar() {
69-
}
70-
};
71-
}
72-
}
73-
74-
/**
75-
* doc
76-
*/
77-
function foo(A $a): B|C
78-
{
79-
function bar()
80-
{
81-
}
82-
}
83-
XX
84-
, (string) $file);
85-
33+
$file = (new Extractor(file_get_contents(__DIR__ . '/fixtures/extractor.php')))->extractAll();
34+
sameFile(__DIR__ . '/expected/Extractor.expect', (string) $file);
8635

8736
Assert::exception(function () {
8837
(new Extractor(''));
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
class Class1
4+
{
5+
public function foo()
6+
{
7+
new class {
8+
function bar() {
9+
}
10+
};
11+
}
12+
}
13+
14+
/**
15+
* doc
16+
*/
17+
function foo(A $a): B|C
18+
{
19+
function bar()
20+
{
21+
}
22+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
class Class1
3+
{
4+
public function foo()
5+
{
6+
new class {
7+
function bar() {
8+
}
9+
};
10+
}
11+
}
12+
13+
function () {};
14+
15+
/** doc */
16+
function foo(A $a): B|C
17+
{
18+
function bar()
19+
{
20+
}
21+
}

0 commit comments

Comments
 (0)