答:我如何運行特定的phinx seeder並在phpunit中取得產生的記錄?

DDD
發布: 2024-09-13 20:16:10
原創
706 人瀏覽過

這個答案解決了我遇到的一個問題:在 phpunit 上運行 Phinx 播種者:

Answer: How I can run specific phinx seeder and get the generated records in phpunit? 回覆回覆:我如何運行特定的phinx seeder並獲取phpunit中產生的記錄?
Answer: How I can run specific phinx seeder and get the generated records in phpunit?
0
Answer: How I can run specific phinx seeder and get the generated records in phpunit?

我有一個像你提到的情況,我需要在單元測試中在 mysql 資料庫上運行播種器,因此我執行了以下步驟:

第 1 步:擴充 PhinxDbAdapterMysqlAdapter 以接受現有的 PDO 連線*

namespace Tests
use Phinx\Db\Adapter\MysqlAdapter;

class TestAdapter extends MysqlAdapter
{
    public function __construct(\PDO
登入後複製
打開完整答案

上面的答案也給了這個問題的解:
給定一個 PDO 實例,我如何也可以建立一個 MysqlConnectionAdapter?

歡迎對上述問題提出改進或建議。這是我的一個解決方案,可能會有一些警告。

以上是答:我如何運行特定的phinx seeder並在phpunit中取得產生的記錄?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

來源:dev.to
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!