Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-109

Doctrine/DBAL/Platforms/MySqlPlatform.php is missing test coverage around _getCreateTableSQL method

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1
    • 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

        Wil Moore III created issue -
        Wil Moore III made changes -
        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.
        Hide
        Benjamin Eberlei added a comment -

        This is an improvement

        Show
        Benjamin Eberlei added a comment - This is an improvement
        Benjamin Eberlei made changes -
        Issue Type Bug [ 1 ] Improvement [ 4 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 12558 ] jira-feedback2 [ 17572 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 17572 ] jira-feedback3 [ 19926 ]
        Hide
        Steve Müller added a comment -

        Is this issue still an issue? I neither see a "quote" method nor a "$table->addOption()" here...

        Show
        Steve Müller added a comment - Is this issue still an issue? I neither see a "quote" method nor a "$table->addOption()" here...
        Hide
        Steve Müller added a comment -
        Show
        Steve Müller added a comment - Undefined method call fixed in commit: https://github.com/doctrine/dbal/commit/79e04e98895648e2a72075377dac13a3e7c7fd53
        Steve Müller made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.1 [ 10068 ]
        Resolution Fixed [ 1 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DBAL-109, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Wil Moore III
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: