Skip to content

Commit

Permalink
Fixing some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverryan committed Feb 27, 2018
1 parent a822400 commit d65d772
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Maker/MakeEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ function ($name) use ($targetClass) {
Str::singularCamelCaseToPluralCamelCase(Str::getShortClassName($relation->getOwningClass()))
));

// orphan removal only applies of the inverse relation is set
// orphan removal only applies if the inverse relation is set
if (!$relation->isNullable()) {
$relation->setOrphanRemoval($askOrphanRemoval(
$relation->getOwningClass(),
Expand Down
5 changes: 2 additions & 3 deletions tests/Maker/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ public function getCommandTests()
'ManyToOne',
// the target entity
'Some\Vendor\Group',
// nullable
'',
/*
* normally, we ask for the field on the *other* side, but we
* do not here, since the other side won't be mapped.
Expand All @@ -351,7 +353,6 @@ public function getCommandTests()
'"App\\\Tests\\\": "tests/",' . "\n" . ' "Some\\\Vendor\\\": "vendor/some-vendor/src",'
)
->assert(function (string $output, string $directory) {
$this->assertContains('inverse side of the relation was not mapped in "Some\Vendor\Group"', $output);
$this->assertContains('updated: src/Entity/User.php', $output);
$this->assertNotContains('updated: vendor/', $output);

Expand Down Expand Up @@ -391,7 +392,6 @@ public function getCommandTests()
'"App\\\Tests\\\": "tests/",'."\n".' "Some\\\Vendor\\\": "vendor/some-vendor/src",'
)
->assert(function(string $output, string $directory) {
$this->assertContains('inverse side of the relation was not mapped in "Some\Vendor\Group"', $output);
$this->assertNotContains('updated: vendor/', $output);

$this->assertNotContains('inversedBy', file_get_contents($directory.'/src/Entity/User.php'));
Expand Down Expand Up @@ -427,7 +427,6 @@ public function getCommandTests()
'"App\\\Tests\\\": "tests/",'."\n".' "Some\\\Vendor\\\": "vendor/some-vendor/src",'
)
->assert(function(string $output, string $directory) {
$this->assertContains('inverse side of the relation was not mapped in "Some\Vendor\Group"', $output);
$this->assertNotContains('updated: vendor/', $output);

$this->assertNotContains('inversedBy', file_get_contents($directory.'/src/Entity/User.php'));
Expand Down

0 comments on commit d65d772

Please sign in to comment.