[請益] 請問有人也有在用codeception在做測試嗎

看板PHP作者時間11年前 (2014/12/22 13:54), 編輯推噓0(006)
留言6則, 2人參與, 最新討論串1/1
最近打算要用Codeception 做測試 我在yaml 設定檔有 用到Db 模組 Db 的設定檔如下 Db: dsn: 'mysql:host=192.168.1.1;dbname=testdb' user: 'root' password: 'pass word' dump: 'tests/_data/dumper.sql' populate: true cleanup: true 現在的問題是,開始測試的時候,的確是會執行dumper.sql的語法 可是問題是,我要怎麼在測試結束的時候,執行清除資料 是要另外寫test helper 去執行嗎 謝謝回覆 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 125.227.47.246 ※ 文章網址: http://www.ptt.cc/bbs/PHP/M.1419227684.A.7FA.html

12/22 14:27, , 1F
記得是 cleanup 設 true 就會自動清掉了,你已經有設啦
12/22 14:27, 1F

12/22 18:19, , 2F
可是我發現舊的資料還是存在,還是要另外寫sql去刪
12/22 18:19, 2F

12/22 18:20, , 3F
還是說清除的sql 也是寫在dumper.sql裡
12/22 18:20, 3F

12/25 22:32, , 4F
你確定你的 dumper.sql 有執行嗎?
12/25 22:32, 4F

12/25 22:32, , 5F
你在跑 codeception 時 env 應該是 testing 會不會沒
12/25 22:32, 5F

12/25 22:33, , 6F
沒有讀到 db 的設定?
12/25 22:33, 6F
文章代碼(AID): #1Kbx8aVw (PHP)
文章代碼(AID): #1Kbx8aVw (PHP)