Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: Mockery, better structure, constants, ContainerHelperTest
- Loading branch information
1 parent
0986091
commit ebeb953
Showing
10 changed files
with
90 additions
and
29 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 was deleted.
Oops, something went wrong.
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,39 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Nettrine\Migrations\Helper; | ||
|
||
use Doctrine\DBAL\Migrations\Configuration\Configuration; | ||
use Doctrine\DBAL\Migrations\OutputWriter; | ||
use Mockery; | ||
use Mockery\MockInterface; | ||
use Nettrine\Migrations\Helper\ConfigurationHelper; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Tests\Nettrine\Migrations\TestCase; | ||
|
||
final class ConfigurationHelperTest extends TestCase | ||
{ | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function testGetMigrationConfig(): void | ||
{ | ||
/** @var InputInterface|MockInterface $input */ | ||
$input = Mockery::mock(InputInterface::class); | ||
/** @var OutputWriter|MockInterface $outputWriter */ | ||
$outputWriter = Mockery::mock(OutputWriter::class); | ||
|
||
$helper = new ConfigurationHelper(); | ||
self::assertNull($helper->getMigrationConfig($input, $outputWriter)); | ||
|
||
/** @var Configuration|MockInterface $configuration */ | ||
$configuration = Mockery::mock(Configuration::class) | ||
->shouldReceive('setOutputWriter') | ||
->withArgs([$outputWriter]) | ||
->getMock(); | ||
|
||
$helper = new ConfigurationHelper(NULL, $configuration); | ||
self::assertSame($configuration, $helper->getMigrationConfig($input, $outputWriter)); | ||
} | ||
|
||
} |
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,33 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Nettrine\Migrations; | ||
|
||
use Mockery; | ||
use PHPUnit\Framework\TestCase as PHPUnitTestCase; | ||
|
||
abstract class TestCase extends PHPUnitTestCase | ||
{ | ||
|
||
/** | ||
* @return void | ||
*/ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
if (!defined('TEMP_PATH')) { | ||
define('TEMP_PATH', __DIR__ . '/../tmp'); | ||
} | ||
if (!defined('FIXTURES_PATH')) { | ||
define('FIXTURES_PATH', __DIR__ . '/../fixtures'); | ||
} | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
protected function tearDown(): void | ||
{ | ||
Mockery::close(); | ||
} | ||
|
||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.