Skip to content

Commit 9c262df

Browse files
committed
tests: class moved to fixtures (doesn't suit CS)
1 parent 95984c1 commit 9c262df

File tree

4 files changed

+94
-85
lines changed

4 files changed

+94
-85
lines changed

tests/PhpGenerator/ClassType.from.php71.phpt

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,7 @@ use Tester\Assert;
1010

1111

1212
require __DIR__ . '/../bootstrap.php';
13-
14-
/** */
15-
class ClassA
16-
{
17-
public function func1(A $a, ?B $b, ?C $c = null, D $d = null, E $e, ?int $i = 1, ?array $arr = [])
18-
{
19-
}
20-
21-
22-
public function func2(): ?stdClass
23-
{
24-
}
25-
26-
27-
public function func3(): void
28-
{
29-
}
30-
}
13+
require __DIR__ . '/fixtures/classes.php71.php';
3114

3215

3316
$res[] = ClassType::from(ClassA::class);

tests/PhpGenerator/ClassType.from.phpt

Lines changed: 6 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -4,79 +4,18 @@
44
* Test: Nette\PhpGenerator generator.
55
*/
66

7-
namespace Abc;
8-
97
use Nette\PhpGenerator\ClassType;
108
use Tester\Assert;
119

1210

1311
require __DIR__ . '/../bootstrap.php';
12+
require __DIR__ . '/fixtures/classes.php';
1413

15-
16-
/**
17-
* Interface
18-
* @author John Doe
19-
*/
20-
interface Interface1
21-
{
22-
public function func1();
23-
}
24-
25-
interface Interface2
26-
{
27-
}
28-
29-
abstract class Class1 implements Interface1
30-
{
31-
/** @return Class1 */
32-
public function func1()
33-
{
34-
}
35-
36-
37-
abstract protected function func2();
38-
}
39-
40-
class Class2 extends Class1 implements Interface2
41-
{
42-
/**
43-
* Public
44-
* @var int
45-
*/
46-
public $public;
47-
48-
/** @var int */
49-
protected $protected = 10;
50-
51-
private $private = [];
52-
53-
static public $static;
54-
55-
56-
/**
57-
* Func3
58-
* @return Class1
59-
*/
60-
private function &func3(array $a = [], Class2 $b = null, \Abc\Unknown $c, \Xyz\Unknown $d, callable $e, $f = Unknown::ABC, $g)
61-
{
62-
}
63-
64-
65-
final public function func2()
66-
{
67-
}
68-
}
69-
70-
class Class3
71-
{
72-
public $prop1;
73-
}
74-
75-
$res[] = ClassType::from(Interface1::class);
76-
$res[] = ClassType::from(Interface2::class);
77-
$res[] = ClassType::from(Class1::class);
78-
$res[] = ClassType::from(new \ReflectionClass(Class2::class));
79-
$obj = new Class3;
14+
$res[] = ClassType::from(Abc\Interface1::class);
15+
$res[] = ClassType::from(Abc\Interface2::class);
16+
$res[] = ClassType::from(Abc\Class1::class);
17+
$res[] = ClassType::from(new \ReflectionClass(Abc\Class2::class));
18+
$obj = new Abc\Class3;
8019
$obj->prop2 = 1;
8120
$res[] = ClassType::from(new \ReflectionObject($obj));
8221

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace Abc;
5+
6+
/**
7+
* Interface
8+
* @author John Doe
9+
*/
10+
interface Interface1
11+
{
12+
public function func1();
13+
}
14+
15+
16+
interface Interface2
17+
{
18+
}
19+
20+
21+
abstract class Class1 implements Interface1
22+
{
23+
/** @return Class1 */
24+
public function func1()
25+
{
26+
}
27+
28+
29+
abstract protected function func2();
30+
}
31+
32+
33+
class Class2 extends Class1 implements Interface2
34+
{
35+
/**
36+
* Public
37+
* @var int
38+
*/
39+
public $public;
40+
41+
/** @var int */
42+
protected $protected = 10;
43+
44+
private $private = [];
45+
46+
static public $static;
47+
48+
49+
/**
50+
* Func3
51+
* @return Class1
52+
*/
53+
private function &func3(array $a = [], Class2 $b = null, \Abc\Unknown $c, \Xyz\Unknown $d, callable $e, $f = Unknown::ABC, $g)
54+
{
55+
}
56+
57+
58+
final public function func2()
59+
{
60+
}
61+
}
62+
63+
64+
class Class3
65+
{
66+
public $prop1;
67+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/** */
5+
class ClassA
6+
{
7+
public function func1(A $a, ?B $b, ?C $c = null, D $d = null, E $e, ?int $i = 1, ?array $arr = [])
8+
{
9+
}
10+
11+
12+
public function func2(): ?stdClass
13+
{
14+
}
15+
16+
17+
public function func3(): void
18+
{
19+
}
20+
}

0 commit comments

Comments
 (0)