Skip to content

Commit

Permalink
Merge pull request #40 from xefi/issue-39
Browse files Browse the repository at this point in the history
Closes #39 - Bad namespace in the generated mixin
  • Loading branch information
GautierDele authored Nov 28, 2024
2 parents 82ce3c0 + 2468f93 commit 9f97fcc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Manifests/ContainerMixinManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ protected function write(string $docComment): void

file_put_contents(
$this->containerMixinPath,
"<?php namespace Xefi\\Faker\\Container{\n{$docComment}\n\tclass ContainerMixin{}"
"<?php namespace Xefi\\Faker\\Container;\n{$docComment}\n\tclass ContainerMixin{}"
);
}
}
19 changes: 19 additions & 0 deletions tests/Unit/ContainerMixinManifestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@ public function testContainerMixinBuild()
unlink('/tmp/ContainerMixin.php');
}

public function testContainerMixinNamespace()
{
@unlink('/tmp/ContainerMixin.php');
$container = new \Xefi\Faker\Container\Container(shouldBuildContainerMixin: false);
$manifest = new \Xefi\Faker\Manifests\ContainerMixinManifest(__DIR__.'/../Support', '/tmp/ContainerMixin.php');
$manifest->build($container->getExtensionMethods(), $container->getExtensions());

$this->assertFileExists('/tmp/ContainerMixin.php');

$containerMixinContent = file_get_contents('/tmp/ContainerMixin.php');

$this->assertStringContainsString(
'namespace Xefi\\Faker\\Container;',
$containerMixinContent
);

unlink('/tmp/ContainerMixin.php');
}

public function testShouldRecompile()
{
@unlink('/tmp/ContainerMixin.php');
Expand Down

0 comments on commit 9f97fcc

Please sign in to comment.