php - Symfony 5 - 无法使用 phpunit 加载固定装置
问题描述
我正在尝试从 phpunit 加载我的装置(php 文件)。
我安装了 LiipTestFixture,并在我的 AbstractControllerTest.php 中:
<?php
namespace App\Tests\Controller;
use App\Entity\App\User;
use App\Services\App\EntrepriseServiceTest;
use Liip\TestFixturesBundle\Test\FixturesTrait;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
abstract class AbstractControllerTest extends WebTestCase
{
use FixturesTrait;
protected function setUp(): void
{
if (!$this->client) {
$this->client = static::createClient();
}
$this->loadFixtures([
"App\DataFixtures\AppFixtures",
])->getReferenceRepository();
}
我的灯具类:
class AppFixtures extends Fixture implements FixtureInterface
{
//...
}
但是当我启动测试时,我没有错误,但固定装置不收费。有人能帮助我吗 ?
PS:我使用的是MySql数据库
解决方案
推荐阅读
- python - 了解 dataframe.shape df.shape
- java - 尝试通过 Selenium 和 Java 使用 sendKeys 时获取验证消息
- java - 字符之间的Java有损XOR
- c# - C# IsMDIParent 容器 LabVIEW
- javascript - 在Javascript中使用indexOf将变量类型号与数组进行比较
- java - 如何从另一个类 JAVA 访问变量
- c - 使用 gtk2 创建和存储图像?
- python - 使用多个查询对 Python 中的数据框进行子集化
- android - android studio profiler 奇怪字符中的阿拉伯字母响应
- python - 根据 Pandas 中的时间戳分组生成值