-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
223 additions
and
39 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
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
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
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 |
---|---|---|
|
@@ -11,6 +11,9 @@ | |
|
||
namespace Zenstruck\Foundry\Tests\Integration\Maker; | ||
|
||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use PHPUnit\Framework\Attributes\Group; | ||
use PHPUnit\Framework\Attributes\Test; | ||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use Symfony\Bundle\MakerBundle\Exception\RuntimeCommandException; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
|
@@ -29,6 +32,7 @@ | |
* @author Kevin Bond <[email protected]> | ||
* @group maker | ||
*/ | ||
#[Group('maker')] | ||
final class MakeFactoryTest extends MakerTestCase | ||
{ | ||
private const PHPSTAN_PATH = __DIR__.'/../../..'.FactoryGenerator::PHPSTAN_PATH; | ||
|
@@ -59,6 +63,7 @@ protected function tearDown(): void | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function can_create_factory(): void | ||
{ | ||
if (!\getenv('DATABASE_URL')) { | ||
|
@@ -79,6 +84,7 @@ public function can_create_factory(): void | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function can_create_factory_interactively(): void | ||
{ | ||
if (!\getenv('DATABASE_URL')) { | ||
|
@@ -106,6 +112,7 @@ public function can_create_factory_interactively(): void | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function can_create_factory_in_test_dir(): void | ||
{ | ||
if (!\getenv('DATABASE_URL')) { | ||
|
@@ -123,6 +130,8 @@ public function can_create_factory_in_test_dir(): void | |
* @test | ||
* @dataProvider scaToolProvider | ||
*/ | ||
#[Test] | ||
#[DataProvider('scaToolProvider')] | ||
public function can_create_factory_with_static_analysis_annotations(string $scaTool): void | ||
{ | ||
if (!\getenv('DATABASE_URL')) { | ||
|
@@ -150,6 +159,7 @@ public static function scaToolProvider(): iterable | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function can_create_factory_for_entity_with_repository(): void | ||
{ | ||
if (!\getenv('DATABASE_URL')) { | ||
|
@@ -166,6 +176,7 @@ public function can_create_factory_for_entity_with_repository(): void | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function invalid_entity_throws_exception(): void | ||
{ | ||
$tester = $this->makeFactoryCommandTester(); | ||
|
@@ -185,6 +196,7 @@ public function invalid_entity_throws_exception(): void | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function can_create_factory_for_not_persisted_class(): void | ||
{ | ||
$tester = $this->makeFactoryCommandTester(); | ||
|
@@ -197,6 +209,7 @@ public function can_create_factory_for_not_persisted_class(): void | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function can_create_factory_for_not_persisted_class_interactively(): void | ||
{ | ||
$tester = $this->makeFactoryCommandTester(); | ||
|
@@ -215,6 +228,7 @@ public function can_create_factory_for_not_persisted_class_interactively(): void | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function can_customize_namespace(): void | ||
{ | ||
if (!\getenv('DATABASE_URL')) { | ||
|
@@ -234,6 +248,7 @@ public function can_customize_namespace(): void | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function can_customize_namespace_with_test_flag(): void | ||
{ | ||
if (!\getenv('DATABASE_URL')) { | ||
|
@@ -253,6 +268,7 @@ public function can_customize_namespace_with_test_flag(): void | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function can_customize_namespace_with_root_namespace_prefix(): void | ||
{ | ||
if (!\getenv('DATABASE_URL')) { | ||
|
@@ -272,6 +288,7 @@ public function can_customize_namespace_with_root_namespace_prefix(): void | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function can_customize_namespace_with_test_flag_with_root_namespace_prefix(): void | ||
{ | ||
if (!\getenv('DATABASE_URL')) { | ||
|
@@ -292,6 +309,8 @@ public function can_customize_namespace_with_test_flag_with_root_namespace_prefi | |
* @test | ||
* @dataProvider documentProvider | ||
*/ | ||
#[Test] | ||
#[DataProvider('documentProvider')] | ||
public function can_create_factory_for_odm(string $class, string $file): void | ||
{ | ||
if (!\getenv('MONGO_URL')) { | ||
|
@@ -318,6 +337,7 @@ public static function documentProvider(): iterable | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function can_create_all_factories_for_doctrine_objects(): void | ||
{ | ||
if (!\getenv('MONGO_URL') && !\getenv('DATABASE_URL')) { | ||
|
@@ -350,6 +370,7 @@ public function can_create_all_factories_for_doctrine_objects(): void | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function can_create_factory_with_auto_activated_not_persisted_option(): void | ||
{ | ||
if (\getenv('MONGO_URL') || \getenv('DATABASE_URL')) { | ||
|
@@ -369,6 +390,7 @@ public function can_create_factory_with_auto_activated_not_persisted_option(): v | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function can_create_factory_with_all_fields(): void | ||
{ | ||
if (!\getenv('DATABASE_URL')) { | ||
|
@@ -386,6 +408,8 @@ public function can_create_factory_with_all_fields(): void | |
* @test | ||
* @dataProvider objectsWithEmbeddableProvider | ||
*/ | ||
#[Test] | ||
#[DataProvider('objectsWithEmbeddableProvider')] | ||
public function can_create_factory_with_embeddable(string $objectClass, string $objectFactoryName): void | ||
{ | ||
$tester = $this->makeFactoryCommandTester(); | ||
|
@@ -413,6 +437,7 @@ public static function objectsWithEmbeddableProvider(): iterable | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function can_create_factory_with_default_enum(): void | ||
{ | ||
$tester = $this->makeFactoryCommandTester(); | ||
|
@@ -425,6 +450,7 @@ public function can_create_factory_with_default_enum(): void | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function does_not_initialize_non_settable(): void | ||
{ | ||
$tester = $this->makeFactoryCommandTester(); | ||
|
@@ -437,6 +463,7 @@ public function does_not_initialize_non_settable(): void | |
/** | ||
* @test | ||
*/ | ||
#[Test] | ||
public function does_force_initialization_of_non_settable_with_always_force(): void | ||
{ | ||
$tester = $this->makeFactoryCommandTester(['environment' => 'always_force']); | ||
|
Oops, something went wrong.