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

pcmagas

Dimitrios Desyllas

Posted on September 13, 2024

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

In this answer was solving a problem that I had: Running a phinx seeder upon 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

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.

💖 💪 🙅 🚩
pcmagas
Dimitrios Desyllas

Posted on September 13, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related