forked from propelorm/Propel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request propelorm#816 from fzerorubigd/master
First try to load platform from the user provided build properties, try ...
- Loading branch information
Showing
4 changed files
with
60 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
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,6 @@ | ||
<?php | ||
|
||
class CustomPlatform extends DefaultPlatform | ||
{ | ||
|
||
} |
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,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<config> | ||
<log> | ||
<level>7</level> | ||
</log> | ||
<propel> | ||
<datasources> | ||
<datasource id="default"> | ||
<!-- I want to use this platform but with my custom platform --> | ||
<adapter>pgsql</adapter> | ||
<connection> | ||
<dsn>pgsql:host=localhost;port=5432;dbname=postgres;</dsn> | ||
<user>postgres</user> | ||
<password>password</password> | ||
</connection> | ||
</datasource> | ||
</datasources> | ||
</propel> | ||
</config> |
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,31 @@ | ||
<?php | ||
|
||
class CustomPlatformTest extends PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var GeneratorConfig | ||
*/ | ||
protected $generatorConfig; | ||
|
||
public function setUp() | ||
{ | ||
$projectDir = realpath(__DIR__ . '/../../../fixtures/generator/platform/'); | ||
$platformClass = str_replace('/', '.', $projectDir) . '.CustomPlatform'; | ||
$props = array( | ||
"propel.project" => "kfw-propel", | ||
"propel.database" => "pgsql", // Or anything else | ||
"propel.projectDir" => $projectDir, | ||
"propel.platform.class" => $platformClass, | ||
"propel.buildtime.conf.file" => "buildtime-conf.xml" | ||
|
||
); | ||
|
||
$this->generatorConfig = new GeneratorConfig($props); | ||
} | ||
|
||
public function testGetPLatform() | ||
{ | ||
$this->assertInstanceOf('CustomPlatform', $this->generatorConfig->getConfiguredPlatform()); | ||
$this->assertInstanceOf('CustomPlatform', $this->generatorConfig->getConfiguredPlatform(null, 'default')); | ||
} | ||
} |