Private
Public Access
1
0

new: pkg: add test cases to back-end w/ real database connection in it #10

This commit is contained in:
2026-04-21 17:56:04 +02:00
parent 6bf908b43e
commit d704be5bff
38 changed files with 5429 additions and 17 deletions

View File

@@ -0,0 +1,53 @@
<?php declare(strict_types=1);
/**
* This file is part of the SplendidBear Websites' projects.
*
* Copyright (c) 2026 @ www.splendidbear.org
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Tests\Factory;
use App\Entity\Grid;
use App\Entity\GridRow;
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
/**
* Class GridFactory
*
* @package App\Tests\Factory
* @author Lang <https://www.splendidbear.org>
* @category Class
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
* @link www.splendidbear.org
* @since 2026. 04. 21.
*
* @extends PersistentProxyObjectFactory<Grid>
*/
class GridFactory extends PersistentProxyObjectFactory
{
protected function defaults(): array
{
return [
'playedGame' => PlayedGameFactory::new(),
];
}
public static function class(): string
{
return Grid::class;
}
protected function initialize(): static
{
return $this->afterInstantiate(function (Grid $grid): void {
for ($i = 0; $i < 16; $i++) {
/** @var GridRow $factory */
$factory = GridRowFactory::new()->create()->_real();
$grid->addGridRow($factory);
}
});
}
}