第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

功能測(cè)試中的夾具對(duì)象引用不正確

功能測(cè)試中的夾具對(duì)象引用不正確

PHP
智慧大石 2023-07-21 16:29:47
功能測(cè)試類依賴于夾具中創(chuàng)建的對(duì)象引用。但是,引用的 id 與實(shí)體管理器返回的對(duì)象的 id 屬性不同。下面的測(cè)試演示了這個(gè)問題。筆記:$this->setReference(...)使用 時(shí)的錯(cuò)誤與使用public const ...和 時(shí)的錯(cuò)誤相同$this->addReference(...)。測(cè)試中使用的對(duì)象引用似乎是非營(yíng)利實(shí)體的下一個(gè)可用 ID。在更一般的測(cè)試類中觀察到錯(cuò)誤后創(chuàng)建測(cè)試類。無(wú)論在運(yùn)行測(cè)試類之前是否加載了裝置,錯(cuò)誤都是相同的。該應(yīng)用程序使用 Symfony 5.1.2,并更新了所有依賴項(xiàng)。測(cè)試類:namespace App\Tests\Controller;use Liip\TestFixturesBundle\Test\FixturesTrait;use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;class ReferenceTest extends WebTestCase{    use FixturesTrait;    public function setup(): void {        $this->client = $this->createClient();        $this->fixtures = $this->loadFixtures([                    'App\DataFixtures\Test\OptionsFixture',                    'App\DataFixtures\Test\NonprofitFixture',                    'App\DataFixtures\Test\OpportunityFixture',                    'App\DataFixtures\Test\UserFixture',                ])                ->getReferenceRepository();        $this->client->followRedirects();        $kernel = self::bootKernel();        $this->entityManager = $kernel->getContainer()                ->get('doctrine')                ->getManager('test');    }    public function testNonprofitReference() {        $npo = $this->entityManager->getRepository(\App\Entity\Nonprofit::class)                ->findOneBy(['orgname' => 'Marmot Fund']);        $nId = $npo->getId();        $id = $this->fixtures->getReference('npo')->getId();        $this->assertEquals($nId, $id, 'Reference incorrect');    }   }測(cè)試結(jié)果:Reference incorrectFailed asserting that 4 matches expected 1.
查看完整描述

1 回答

?
ABOUTYOU

TA貢獻(xiàn)1812條經(jīng)驗(yàn) 獲得超5個(gè)贊

答案是,引用在功能測(cè)試中沒有地位。它們的使用實(shí)際上是單擊鏈接或執(zhí)行其他操作的快捷方式。更好的測(cè)試是使用爬蟲來(lái)模仿動(dòng)作。



查看完整回答
反對(duì) 回復(fù) 2023-07-21
  • 1 回答
  • 0 關(guān)注
  • 168 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)