Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.1
-
Fix Version/s: None
-
Component/s: Platforms
-
Labels:None
-
Environment:2.1.0-DEV
Description
In "Doctrine/DBAL/Platforms/MySqlPlatform.php", the following methods are public: getShowDatabasesSQL, getCreateDatabaseSQL, getDropDatabaseSQL, getDropTableSQL (easy to test); however, the "_getCreateTableSQL" method is not public.
Is there a specific reason for this difference?
As a result of this method not being tested, there is a "quote" method being called which doesn't exist.
See: https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php#L410
The only way at this time to test for this case is to get an error when doing: $table->addOption('comment', '...');
I would suggest making the protected method public so it can be tested. I also suggest moving the options parsing out of _getCreateTableSQL into a helper method...this method seems a bit overloaded.
If agreed, I'm happy to take care of the cleanup. Just wanted to get some feedback on the ideas first.
Activity
| Field | Original Value | New Value |
|---|---|---|
| Description |
In "Doctrine/DBAL/Platforms/MySqlPlatform.php", the following methods are public: getShowDatabasesSQL, getCreateDatabaseSQL, getDropDatabaseSQL, getDropTableSQL (easy to test); however, the "_getCreateTableSQL" method is not public. Is there a specific reason for this difference? As a result of this method not being tested, there is a "quote" method being called which doesn't exist. See: https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php#L410 The only way at this time to test for this case is to get an error when doing: $table->addOption('comment', '...'); I would suggest making the protected method public so it can be tested. I also suggest moving the options parsing out of _getCreateTableSQL into a helper method...this method seems a bit overloaded. Thoughts? |
In "Doctrine/DBAL/Platforms/MySqlPlatform.php", the following methods are public: getShowDatabasesSQL, getCreateDatabaseSQL, getDropDatabaseSQL, getDropTableSQL (easy to test); however, the "_getCreateTableSQL" method is not public. Is there a specific reason for this difference? As a result of this method not being tested, there is a "quote" method being called which doesn't exist. See: https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php#L410 The only way at this time to test for this case is to get an error when doing: $table->addOption('comment', '...'); I would suggest making the protected method public so it can be tested. I also suggest moving the options parsing out of _getCreateTableSQL into a helper method...this method seems a bit overloaded. If agreed, I'm happy to take care of the cleanup. Just wanted to get some feedback on the ideas first. |
| Issue Type | Bug [ 1 ] | Improvement [ 4 ] |
| Workflow | jira [ 12558 ] | jira-feedback2 [ 17572 ] |
| Workflow | jira-feedback2 [ 17572 ] | jira-feedback3 [ 19926 ] |