Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / dbal / tests / Doctrine / Tests / DBAL / Platforms / ReservedKeywordsValidatorTest.php
1 <?php
2
3 namespace Doctrine\Tests\DBAL\Platforms;
4
5 use Doctrine\DBAL\Platforms\Keywords\ReservedKeywordsValidator;
6 use Doctrine\DBAL\Schema\Table;
7 use Doctrine\DBAL\Schema\Column;
8 use Doctrine\DBAL\Types\Type;
9
10 class ReservedKeywordsValidatorTest extends \Doctrine\Tests\DbalTestCase
11 {
12     /**
13      * @var ReservedKeywordsValidator
14      */
15     private $validator;
16
17     public function setUp()
18     {
19         $this->validator = new ReservedKeywordsValidator(array(
20             new \Doctrine\DBAL\Platforms\Keywords\MySQLKeywords()
21         ));
22     }
23
24     public function testReservedTableName()
25     {
26         $table = new Table("TABLE");
27         $this->validator->acceptTable($table);
28
29         $this->assertEquals(
30             array('Table TABLE keyword violations: MySQL'),
31             $this->validator->getViolations()
32         );
33     }
34
35     public function testReservedColumnName()
36     {
37         $table = new Table("TABLE");
38         $column = $table->addColumn('table', 'string');
39
40         $this->validator->acceptColumn($table, $column);
41
42         $this->assertEquals(
43             array('Table TABLE column table keyword violations: MySQL'),
44             $this->validator->getViolations()
45         );
46     }
47 }