Open ilijastojkovic opened 5 years ago
if (!$entity) {
Check $this->entity
instead.
thanks for the hint, but this is a typo.
Have you made another typo in this line?
$this->entity = $I->have(Entity::class, ['name' => 'test']);
If you actually used haveInRepository
there, this method does not return entity, so null is assigned to $this->entity
.
I don't think so. $I->have() return
* [!] Method is generated. Documentation taken from corresponding module.
*
* Generates and saves a record,.
*
* ```php
* $I->have('User'); // creates user
* $I->have('User', ['is_active' => true]); // creates active user
* ```
*
* Returns an instance of created user.
*
* @param string $name
* @param array $extraAttrs
*
* @return object
* @see \Codeception\Module\DataFactory::have()
*/
public function have($name, $extraAttrs = null) {
return $this->getScenario()->runStep(new \Codeception\Step\Action('have', func_get_args()));
}
So $this->entity
is instance of provided Entity::class
Did you have a solution? I have the same problem right now
Same problem for me: https://github.com/Codeception/Codeception/issues/6682
What are you trying to achieve?
Right now, I have some strange behaviour while running functional tests. If I run one file
codecept run functional /FunctionalFolder/Services/ServiceOneCest
, all tests are success - as expected. But in secound case, when I run all created testscodecept run functional /FunctionalFolder
, some tests are finished as expected, while some others are failed.Somehow, in _before() section, are not executed all dependeces.
I expect same results if I run one test file or more. I need to say, don't have any dependece between test data created in
_before()
Please, if you see any reason or my bad code/configuration anything, give me handsup. If you have some other questions, please feel free to contact me.
Details
composer show
)