forked from propelorm/Propel2
-
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.
Misconfigured connections throw exception
If a connection, in runtime or generator sections, isn't configured in propel.database.connections section, it throws a specific exception, with a more explaining message.
- Loading branch information
1 parent
2302f06
commit 4857392
Showing
5 changed files
with
247 additions
and
0 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
17 changes: 17 additions & 0 deletions
17
src/Propel/Common/Config/Exception/InvalidConfigurationException.php
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,17 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Propel package. | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @license MIT License | ||
*/ | ||
|
||
namespace Propel\Common\Config\Exception; | ||
|
||
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException as BaseConfigurationException; | ||
|
||
class InvalidConfigurationException extends BaseConfigurationException implements ExceptionInterface | ||
{ | ||
} |
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,179 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Propel package. | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @license MIT License | ||
*/ | ||
|
||
namespace Propel\Tests\Common\Config; | ||
|
||
/** | ||
* This trait contains the data providers for ConfigurationManagerTest class. | ||
*/ | ||
trait DataProviderTrait | ||
{ | ||
public function providerForInvalidConnections() | ||
{ | ||
return array( | ||
array(" | ||
propel: | ||
database: | ||
connections: | ||
mysource: | ||
adapter: mysql | ||
classname: Propel\Runtime\Connection\DebugPDO | ||
dsn: mysql:host=localhost;dbname=mydb | ||
user: root | ||
password: | ||
runtime: | ||
defaultConnection: wrongsource | ||
connections: | ||
- wrongsource | ||
" | ||
, 'runtime'), | ||
array(" | ||
propel: | ||
database: | ||
connections: | ||
mysource: | ||
adapter: mysql | ||
classname: Propel\Runtime\Connection\DebugPDO | ||
dsn: mysql:host=localhost;dbname=mydb | ||
user: root | ||
password: | ||
runtime: | ||
defaultConnection: wrongsource | ||
connections: | ||
- mysource | ||
- wrongsource | ||
" | ||
, 'runtime'), | ||
array(" | ||
propel: | ||
database: | ||
connections: | ||
mysource: | ||
adapter: mysql | ||
classname: Propel\Runtime\Connection\DebugPDO | ||
dsn: mysql:host=localhost;dbname=mydb | ||
user: root | ||
password: | ||
generator: | ||
defaultConnection: wrongsource | ||
connections: | ||
- wrongsource | ||
" | ||
, 'generator'), | ||
array(" | ||
propel: | ||
database: | ||
connections: | ||
mysource: | ||
adapter: mysql | ||
classname: Propel\Runtime\Connection\DebugPDO | ||
dsn: mysql:host=localhost;dbname=mydb | ||
user: root | ||
password: | ||
generator: | ||
defaultConnection: wrongsource | ||
connections: | ||
- wrongsource | ||
- mysource | ||
" | ||
, 'generator'), | ||
array(" | ||
propel: | ||
database: | ||
connections: | ||
mysource: | ||
adapter: mysql | ||
classname: Propel\Runtime\Connection\DebugPDO | ||
dsn: mysql:host=localhost;dbname=mydb | ||
user: root | ||
password: | ||
generator: | ||
defaultConnection: wrongsource | ||
connections: | ||
- wrongsource | ||
runtime: | ||
defaultConnection: wrongsource | ||
connections: | ||
- wrongsource | ||
" | ||
, 'runtime'), | ||
); | ||
} | ||
|
||
public function providerForInvalidDefaultConnection() | ||
{ | ||
return array( | ||
array(" | ||
propel: | ||
database: | ||
connections: | ||
mysource: | ||
adapter: mysql | ||
classname: Propel\Runtime\Connection\DebugPDO | ||
dsn: mysql:host=localhost;dbname=mydb | ||
user: root | ||
password: | ||
runtime: | ||
defaultConnection: wrongsource | ||
connections: | ||
- mysource | ||
" | ||
, 'runtime'), | ||
array(" | ||
propel: | ||
database: | ||
connections: | ||
mysource: | ||
adapter: mysql | ||
classname: Propel\Runtime\Connection\DebugPDO | ||
dsn: mysql:host=localhost;dbname=mydb | ||
user: root | ||
password: | ||
generator: | ||
defaultConnection: wrongsource | ||
connections: | ||
- mysource | ||
" | ||
, 'generator'), | ||
array(" | ||
propel: | ||
database: | ||
connections: | ||
mysource: | ||
adapter: mysql | ||
classname: Propel\Runtime\Connection\DebugPDO | ||
dsn: mysql:host=localhost;dbname=mydb | ||
user: root | ||
password: | ||
generator: | ||
defaultConnection: wrongsource | ||
connections: | ||
- mysource | ||
runtime: | ||
defaultConnection: wrongsource | ||
connections: | ||
- mysource | ||
" | ||
, 'runtime'), | ||
); | ||
} | ||
} |
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