for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Zenstruck\Foundry\Tests\Functional;
use Zenstruck\Foundry\Tests\Fixtures\Factories\CategoryServiceFactory;
use Zenstruck\Foundry\Tests\FunctionalTestCase;
/**
* @author Kevin Bond <[email protected]>
*/
final class ModelFactoryServiceTest extends FunctionalTestCase
{
* @before
public function skipIfNotUsingFoundryBundle(): void
if (!\getenv('USE_FOUNDRY_BUNDLE')) {
$this->markTestSkipped('ZenstruckFoundryBundle not enabled.');
}
* @test
public function can_create_service_factory(): void
$factory = CategoryServiceFactory::new();
$this->assertSame('From Service', $factory->create()->getName());
getName()
Zenstruck\Foundry\Proxy
__call
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
$this->assertSame('From Service', $factory->create()->/** @scrutinizer ignore-call */ getName());
$this->assertSame('From Factory Create', $factory->create(['name' => 'From Factory Create'])->getName());
public function service_factories_are_not_the_same_object(): void
$this->assertNotSame(CategoryServiceFactory::new(), CategoryServiceFactory::new());