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.
Port PR propelorm#326 from Propel 1.6
- Loading branch information
1 parent
c5af3f1
commit cdd3699
Showing
2 changed files
with
89 additions
and
9 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
68 changes: 68 additions & 0 deletions
68
tests/Propel/Tests/Generator/Reverse/MssqlSchemaParserTest.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,68 @@ | |||
<?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\Generator\Reverse; | |||
|
|||
use Propel\Generator\Reverse\MssqlSchemaParser; | |||
|
|||
/** | |||
* Tests for Mssql database schema parser. | |||
* | |||
* @author Pierre Tachoire | |||
*/ | |||
class MssqlSchemaParserTest extends \PHPUnit_Framework_TestCase | |||
{ | |||
public function testCleanDelimitedIdentifiers() | |||
{ | |||
$parser = new TestableMssqlSchemaParser(null); | |||
|
|||
$expected = 'this is a tablename'; | |||
|
|||
$tested = $parser->cleanDelimitedIdentifiers('\''.$expected.'\''); | |||
$this->assertEquals($expected, $tested); | |||
|
|||
$tested = $parser->cleanDelimitedIdentifiers('\''.$expected); | |||
$this->assertEquals('\''.$expected, $tested); | |||
|
|||
$tested = $parser->cleanDelimitedIdentifiers($expected.'\''); | |||
$this->assertEquals($expected.'\'', $tested); | |||
|
|||
$expected = 'this is a tabl\'ename'; | |||
|
|||
$tested = $parser->cleanDelimitedIdentifiers('\''.$expected.'\''); | |||
$this->assertEquals($expected, $tested); | |||
|
|||
$tested = $parser->cleanDelimitedIdentifiers('\''.$expected); | |||
$this->assertEquals('\''.$expected, $tested); | |||
|
|||
$tested = $parser->cleanDelimitedIdentifiers($expected.'\''); | |||
$this->assertEquals($expected.'\'', $tested); | |||
|
|||
$expected = 'this is a\'tabl\'ename'; | |||
|
|||
$tested = $parser->cleanDelimitedIdentifiers('\''.$expected.'\''); | |||
$this->assertEquals($expected, $tested); | |||
|
|||
$tested = $parser->cleanDelimitedIdentifiers('\''.$expected); | |||
$this->assertEquals('\''.$expected, $tested); | |||
|
|||
$tested = $parser->cleanDelimitedIdentifiers($expected.'\''); | |||
$this->assertEquals($expected.'\'', $tested); | |||
|
|||
} | |||
} | |||
|
|||
class TestableMssqlSchemaParser extends MssqlSchemaParser | |||
{ | |||
public function cleanDelimitedIdentifiers($identifier) | |||
{ | |||
return parent::cleanDelimitedIdentifiers($identifier); | |||
} | |||
} |