forked from akeneo/transporteo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3dd0f9c
commit d738b1d
Showing
4 changed files
with
58 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
/var/* | ||
!.gitkeep | ||
.php_cs.cache | ||
tests/test_config.yml |
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,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace integration\Akeneo\PimMigration; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\Yaml\Yaml; | ||
|
||
/** | ||
* Able to reach the config of a pim. | ||
* | ||
* @author Anael Chardan <[email protected]> | ||
* @copyright 2017 Akeneo SAS (http://www.akeneo.com) | ||
*/ | ||
abstract class ConfiguredTestCase extends TestCase | ||
{ | ||
protected function getConfig(string $pimName): array | ||
{ | ||
$configPath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'test_config.yml'; | ||
|
||
$config = file_get_contents($configPath); | ||
|
||
if (false === $config) { | ||
throw new \Exception(sprintf('You should configure %s before running test.', $configPath)); | ||
} | ||
|
||
$testConfiguration = Yaml::parse($config); | ||
|
||
if (!isset($testConfiguration['parameters'][$pimName])) { | ||
throw new \InvalidArgumentException(sprintf('The pim %s is not configured', $pimName)); | ||
} | ||
|
||
return $testConfiguration['parameters'][$pimName]; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
* @author Anael Chardan <[email protected]> | ||
* @copyright 2017 Akeneo SAS (http://www.akeneo.com) | ||
*/ | ||
abstract class DatabaseSetupedTestCase extends TestCase | ||
abstract class DatabaseSetupedTestCase extends ConfiguredTestCase | ||
{ | ||
protected $sourcePim; | ||
protected $destinationPim; | ||
|
@@ -24,8 +24,11 @@ public function setUp() | |
{ | ||
parent::setUp(); | ||
|
||
$this->sourcePim = new SourcePim('localhost', 3306, 'akeneo_pim_one_seven_for_test', 'akeneo_pim', 'akeneo_pim', null, null, false, null, false); | ||
$this->destinationPim = new DestinationPim('localhost', 3306, 'akeneo_pim_two_for_test', 'akeneo_pim', 'akeneo_pim', false, null, 'akeneo_pim', 'localhost', '/a-path'); | ||
$sourcePimConfig = $this->getConfig('pim_community_standard_one_seven_with_reference_data'); | ||
$destinationPimConfig = $this->getConfig('pim_community_standard_two'); | ||
|
||
$this->sourcePim = new SourcePim($sourcePimConfig['database_host'], $sourcePimConfig['database_port'], $sourcePimConfig['database_name'], $sourcePimConfig['database_user'], $sourcePimConfig['database_password'], null, null, false, null, false, '/a-path'); | ||
$this->destinationPim = new DestinationPim($destinationPimConfig['database_host'], $destinationPimConfig['database_port'], $destinationPimConfig['database_name'], $destinationPimConfig['database_user'], $destinationPimConfig['database_password'], false, null, 'akeneo_pim', 'localhost', '/a-path'); | ||
|
||
$connection = $this->getConnection($this->destinationPim, false); | ||
$connection->exec('DROP DATABASE IF EXISTS akeneo_pim_two_for_test'); | ||
|
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,15 @@ | ||
parameters: | ||
pim_community_standard_one_dot_seven_with_reference_data: | ||
absolute_path: ~ | ||
database_host: ~ | ||
database_name: ~ | ||
database_port: ~ | ||
database_user: ~ | ||
database_password: ~ | ||
pim_community_standard_two_dot_zero: | ||
absolute_path: ~ | ||
database_host: ~ | ||
database_name: ~ | ||
database_port: ~ | ||
database_user: ~ | ||
database_password: ~ |