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