/** * Test if change to expected dataset size changes configuration of ID field. */ public function testExpectedDatasetSizeChangeChangesIdField() { $type = new Type('writers'); $this->assertEquals(FieldInterface::SIZE_NORMAL, $type->getIdField()->getSize()); $type->expectedDatasetSize(FieldInterface::SIZE_BIG); $this->assertEquals(FieldInterface::SIZE_BIG, $type->getIdField()->getSize()); }
/** * Test constraint name for belongs to association. */ public function testConstraintName() { $writers = new Type('writers'); $writers->addAssociation(new HasManyAssociation('books')); $books = new Type('books'); $book_writer = new BelongsToAssociation('writer'); $books->addAssociation($book_writer); $this->assertEquals('book_writer_constraint', $book_writer->getConstraintName()); }
/** * Test how connection table name is prepared. */ public function testConnectionTableName() { $writers = new Type('writers'); $books = new Type('books'); $book_can_have_many_writers = new HasAndBelongsToManyAssociation('writers'); $books->addAssociation($book_can_have_many_writers); $writer_can_have_many_books = new HasAndBelongsToManyAssociation('books'); $writers->addAssociation($writer_can_have_many_books); $this->assertEquals('books_writers', $book_can_have_many_writers->getConnectionTableName()); $this->assertEquals('books_writers', $writer_can_have_many_books->getConnectionTableName()); }