@@ 95-112 (lines=18) @@ | ||
92 | /** |
|
93 | * @throws \ReflectionException |
|
94 | */ |
|
95 | public function testUseStmtsInSameNamespace(): void |
|
96 | { |
|
97 | $class = Fixtures\Entity::class; |
|
98 | $as = 'EntityProxy' . __LINE__; |
|
99 | ||
100 | $declaration = new Declaration(new \ReflectionClass($class), $as); |
|
101 | $output = $this->make($declaration); |
|
102 | $output = ltrim($output, '<?php'); |
|
103 | ||
104 | $this->assertFalse(class_exists($declaration->class->getFullName())); |
|
105 | ||
106 | eval($output); |
|
107 | ||
108 | $this->assertSame($this->fetchUseStatements($output), $this->fetchExternalDependencies($declaration->class->getFullName(), [ |
|
109 | PromiseResolver::class, |
|
110 | PromiseInterface::class |
|
111 | ])); |
|
112 | } |
|
113 | ||
114 | /** |
|
115 | * @throws \ReflectionException |
|
@@ 117-135 (lines=19) @@ | ||
114 | /** |
|
115 | * @throws \ReflectionException |
|
116 | */ |
|
117 | public function testUseStmtsInDifferentNamespace(): void |
|
118 | { |
|
119 | $class = Fixtures\Entity::class; |
|
120 | $as = "\EntityProxy" . __LINE__; |
|
121 | ||
122 | $declaration = new Declaration(new \ReflectionClass($class), $as); |
|
123 | $output = $this->make($declaration); |
|
124 | $output = ltrim($output, '<?php'); |
|
125 | ||
126 | $this->assertFalse(class_exists($declaration->class->getFullName())); |
|
127 | ||
128 | eval($output); |
|
129 | ||
130 | $this->assertSame($this->fetchUseStatements($output), $this->fetchExternalDependencies($declaration->class->getFullName(), [ |
|
131 | PromiseResolver::class, |
|
132 | PromiseInterface::class, |
|
133 | $class |
|
134 | ])); |
|
135 | } |
|
136 | ||
137 | private function fetchUseStatements(string $code): array |
|
138 | { |