Answer: How I can run specific phinx seeder and get the generated records in phpunit?

DDD
发布: 2024-09-13 20:16:10
原创
693 人浏览过

In this answer was solving a problem that I had: Running a phinx seeder upon phpunit:

Answer: How I can run specific phinx seeder and get the generated records in phpunit?answer re: How I can run specific phinx seeder and get the generated records in 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?

I had a case as the one you mention, I needed to run the seeder upon a mysql db at my unit test, thus I did following steps:

STEP1: Extending the Phinx\Db\Adapter\MysqlAdapter to accept an existing PDO connection*

namespace Tests use Phinx\Db\Adapter\MysqlAdapter; class TestAdapter extends MysqlAdapter { public function __construct(\PDO
登录后复制
Open Full Answer

The answer above also gives solutions at this problem as well:
How given a PDO instance I can make a MysqlConnectionAdapter as well?

Feel free to provide improvements or suggestions to the mentioned problem. This was a solution of mine that may have some caveats.

以上是Answer: How I can run specific phinx seeder and get the generated records in phpunit?的详细内容。更多信息请关注PHP中文网其他相关文章!

来源:dev.to
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!