-
Notifications
You must be signed in to change notification settings - Fork 892
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Abstract{Migration,Seed}::getAdapter return non-null (#2261)
- Loading branch information
1 parent
1ffe298
commit cb5afbf
Showing
4 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Test\Phinx\Seed; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use RuntimeException; | ||
|
||
class AbstractSeedTest extends TestCase | ||
{ | ||
public function testAdapterMethods() | ||
{ | ||
// stub migration | ||
$migrationStub = $this->getMockForAbstractClass('\Phinx\Seed\AbstractSeed', ['mockenv', 20230102030405]); | ||
|
||
// stub adapter | ||
$adapterStub = $this->getMockBuilder('\Phinx\Db\Adapter\PdoAdapter') | ||
->setConstructorArgs([[]]) | ||
->getMock(); | ||
|
||
// test methods | ||
$this->expectException(RuntimeException::class); | ||
$migrationStub->getAdapter(); | ||
$migrationStub->setAdapter($adapterStub); | ||
$this->assertInstanceOf( | ||
'Phinx\Db\Adapter\AdapterInterface', | ||
$migrationStub->getAdapter() | ||
); | ||
} | ||
} |