Example #1
0
 public function testConstraints()
 {
     $table = new Table('foo');
     $table->addConstraint(new PrimaryKey(array('pk')));
     $table->addConstraint(new ForeignKey($table, new Table('bar')));
     $table->addConstraint(new Unique('uniq'));
     $this->assertCount(3, $table->getConstraints());
     $constraints = $table->getConstraints();
     $this->assertInstanceOf('Rentgen\\Database\\Constraint\\PrimaryKey', $constraints[0]);
     $this->assertInstanceOf('Rentgen\\Database\\Constraint\\ForeignKey', $constraints[1]);
     $this->assertInstanceOf('Rentgen\\Database\\Constraint\\Unique', $constraints[2]);
 }