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

DDD
Release: 2024-09-13 20:16:10
Original
676 people have browsed it

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 PhinxDbAdapterMysqlAdapter to accept an existing PDO connection*

namespace Tests use Phinx\Db\Adapter\MysqlAdapter; class TestAdapter extends MysqlAdapter { public function __construct(\PDO
Copy after login
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.

The above is the detailed content of Answer: How I can run specific phinx seeder and get the generated records in phpunit?. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!