-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow usage of imported class names in custom transformers (#33)
- Loading branch information
Showing
5 changed files
with
39 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
/** | ||
* @author Baptiste Leduc <[email protected]> | ||
*/ | ||
class AstExtractorTest extends TestCase | ||
class ClassMethodToCallbackExtractorTest extends TestCase | ||
{ | ||
/** | ||
* @dataProvider extractSimpleMethodProvider | ||
|
@@ -30,7 +30,7 @@ public function testExtractSimpleMethod(string $varName): void | |
|
||
$this->assertEquals(<<<PHP | ||
(function (mixed \$object) : mixed { | ||
if (\$object instanceof Foo) { | ||
if (\$object instanceof \AutoMapper\Tests\Extractor\Fixtures\Foo) { | ||
\$object->bar = 'Hello World!'; | ||
} | ||
return \$object; | ||
|
@@ -53,7 +53,7 @@ public function testExtractMethodWithTwoVariables(): void | |
|
||
$this->assertEquals(<<<PHP | ||
(function (mixed \$object, string \$someString) : mixed { | ||
if (\$object instanceof Foo) { | ||
if (\$object instanceof \AutoMapper\Tests\Extractor\Fixtures\Foo) { | ||
\$object->bar = 'Hello World!'; | ||
\$object->baz = \$someString; | ||
} | ||
|
@@ -98,7 +98,7 @@ public function testInvalidExtractedMethodParameters(): void | |
private function assertGeneratedCodeIsRunnable(string $generatedCode, string $varName): void | ||
{ | ||
$codeToEval = <<<PHP | ||
if(!class_exists(Foo::class)) | ||
if(!class_exists(\AutoMapper\Tests\Extractor\Fixtures\Foo::class)) | ||
{ | ||
class Foo | ||
{ | ||
|
@@ -107,7 +107,7 @@ class Foo | |
} | ||
} | ||
\${$varName} = new Foo(); | ||
\${$varName} = new \AutoMapper\Tests\Extractor\Fixtures\Foo(); | ||
\${$varName}->bar = 'Hello'; | ||
{$generatedCode} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters