首页 >后端开发 >php教程 >Answer: 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?

DDD
DDD原创
2024-09-13 20:16:101033浏览

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中文网其他相关文章!

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn