SequenceTest.php 785 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace Doctrine\Tests\DBAL\Schema;
  3. use Doctrine\DBAL\Schema\Table;
  4. use Doctrine\DBAL\Schema\Sequence;
  5. class SequenceTest extends \Doctrine\Tests\DbalTestCase
  6. {
  7. /**
  8. * @group DDC-1657
  9. */
  10. public function testIsAutoincrementFor()
  11. {
  12. $table = new Table("foo");
  13. $table->addColumn("id", "integer", array("autoincrement" => true));
  14. $table->setPrimaryKey(array("id"));
  15. $sequence = new Sequence("foo_id_seq");
  16. $sequence2 = new Sequence("bar_id_seq");
  17. $sequence3 = new Sequence("other.foo_id_seq");
  18. $this->assertTrue($sequence->isAutoIncrementsFor($table));
  19. $this->assertFalse($sequence2->isAutoIncrementsFor($table));
  20. $this->assertFalse($sequence3->isAutoIncrementsFor($table));
  21. }
  22. }