Skip to content

Commit

Permalink
Merge pull request #173 from vierge-noire/cake3_next
Browse files Browse the repository at this point in the history
v1.7.1
  • Loading branch information
pabloelcolombiano authored Jul 18, 2022
2 parents fc6eaf0 + f225bb8 commit 99bdaeb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
"phpstan": "vendor/bin/phpstan analyse --memory-limit=-1"
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"cakephp/plugin-installer": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
2 changes: 1 addition & 1 deletion src/Factory/DataCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ private function getEntityFromDefaultTemplate(): EntityInterface
$data = $data($this->getFactory()->getFaker());
}
$entityClassName = $this->getFactory()->getTable()->getEntityClass();
$entity = new $entityClassName();
$entity = new $entityClassName([], ['source' => $this->getFactory()->getTable()->getRegistryAlias()]);

return $this->patchEntity($entity, $data);
}
Expand Down
6 changes: 6 additions & 0 deletions tests/TestCase/Factory/DataCompilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,10 @@ public function testCompileEntityWithoutSetters()
$this->assertSame($author->prependPrefixToField($value), $author->get("field_with_setter_2"));
$this->assertSame($author->prependPrefixToField($value), $author->get("field_with_setter_3"));
}

public function testEntityHasRegistryAlias()
{
$country = CountryFactory::make()->getEntity();
$this->assertSame('Countries', $country->getSource());
}
}

0 comments on commit 99bdaeb

Please sign in to comment.