Codeception\Command\Tests\Unit\DbSnapshotTest::it_should_allow_specifying_the_tables_to_skip_in_the_dump PHP Method

it_should_allow_specifying_the_tables_to_skip_in_the_dump() public method

    public function it_should_allow_specifying_the_tables_to_skip_in_the_dump()
    {
        $root = vfsStream::setup('dumps');
        $root->addChild(new vfsStreamFile('dump.sql'));
        $root->addChild(new vfsStreamFile('dump.dist.sql'));
        $expectedDump = $root->url() . '/dump.sql';
        $expectedDistDump = $root->url() . '/dump.dist.sql';
        $application = new Application();
        /** @var \tad\WPBrowser\Services\Db\MySQLDumpFactoryInterface $factory */
        $factory = $this->prophesize('\\tad\\WPBrowser\\Services\\Db\\MySQLDumpFactoryInterface');
        $dump = $this->prophesize('MySQLDump');
        $dump->write(Argument::any())->shouldBeCalled();
        $filesystem = $this->prophesize('tad\\WPBrowser\\Filesystem\\Filesystem');
        $filesystem->file_put_contents(Argument::type('string'), Argument::type('string'))->willReturn(true);
        $factory->makeDump(Argument::type('string'), Argument::type('string'), Argument::type('string'), Argument::type('string'))->willReturn($dump->reveal());
        $application->add(new DbSnapshot(null, $factory->reveal(), $filesystem->reveal()));
        $command = $application->find('db:snapshot');
        $commandTester = new CommandTester($command);
        $commandTester->execute(['command' => $command->getName(), 'name' => 'db', 'snapshot' => 'issue4455', '--dump-file' => $expectedDump, '--dist-dump-file' => $expectedDistDump, '--skip-tables' => 'foo,bar,baz']);
        $dumpTables = $application->get('db:snapshot')->_getDumpTables();
        $this->assertArrayHasKey('foo', $dumpTables);
        $this->assertArrayHasKey('bar', $dumpTables);
        $this->assertArrayHasKey('baz', $dumpTables);
        $this->assertEquals(\MySQLDump::NONE, $dumpTables['foo']);
        $this->assertEquals(\MySQLDump::NONE, $dumpTables['bar']);
        $this->assertEquals(\MySQLDump::NONE, $dumpTables['baz']);
    }