unit test fixes

This commit is contained in:
Dennis Eichhorn 2021-10-02 22:42:46 +02:00
parent 0d83f2a22b
commit 9d6e431c3b
3 changed files with 11 additions and 9 deletions

View File

@ -95,14 +95,14 @@ abstract class StatusAbstract
*/
protected static function installRoutesHooks(string $destRoutePath, string $srcRoutePath) : void
{
if (!\is_file($destRoutePath)) {
\file_put_contents($destRoutePath, '<?php return [];');
}
if (!\is_file($srcRoutePath)) {
return;
}
if (!\is_file($destRoutePath)) {
\file_put_contents($destRoutePath, '<?php return [];');
}
if (!\is_file($destRoutePath)) {
throw new PathException($destRoutePath);
}

View File

@ -105,14 +105,14 @@ abstract class StatusAbstract
*/
protected static function installRoutesHooks(string $destRoutePath, string $srcRoutePath) : void
{
if (!\is_file($destRoutePath)) {
\file_put_contents($destRoutePath, '<?php return [];');
}
if (!\is_file($srcRoutePath)) {
return;
}
if (!\is_file($destRoutePath)) {
\file_put_contents($destRoutePath, '<?php return [];');
}
if (!\is_file($destRoutePath)) {
throw new PathException($destRoutePath);
}

View File

@ -428,8 +428,10 @@ class ModuleAbstractTest extends \PHPUnit\Framework\TestCase
BaseModelMapper::clearCache();
$model = BaseModelMapper::get(1);
self::assertCount(0, $model->hasManyRelations);
// count = 2 because the moduel automatically initializes 2 hasMany relationships in the __construct()
// This actually means that the delete was successful, otherwise the hasManyRelations would have been overwritten with 1 relation (see above before the delete)
self::assertCount(2, $model->hasManyRelations);
$this->dbTeardown();
}
}