"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > 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?

Published on 2024-09-18
Browse:925

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.

Release Statement This article is reproduced at: https://dev.to/pcmagas/answer-how-i-can-run-specific-phinx-seeder-and-get-the-generated-records-in-phpunit-4843?1 Any infringement , please contact [email protected] to delete
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3