Skip to content

Commit f5299fb

Browse files
committed
tests: refactoring
1 parent 8b0d808 commit f5299fb

File tree

3 files changed

+45
-50
lines changed

3 files changed

+45
-50
lines changed

tests/PhpGenerator/Extractor.extractAll.phpt

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -24,56 +24,8 @@ sameFile(__DIR__ . '/expected/Extractor.traits.expect', (string) $file);
2424
$file = (new Extractor(file_get_contents(__DIR__ . '/fixtures/bodies.php')))->extractAll();
2525
sameFile(__DIR__ . '/expected/Extractor.bodies.expect', (string) $file);
2626

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

7830
Assert::exception(function () {
7931
(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)