@@ 604-613 (lines=10) @@ | ||
601 | ||
602 | } |
|
603 | ||
604 | public function testAddColumnComment() |
|
605 | { |
|
606 | $table = new \Phinx\Db\Table('table1', array(), $this->adapter); |
|
607 | $table->addColumn('field1', 'string', array('comment' => $comment = 'Comments from column "field1"')) |
|
608 | ->save(); |
|
609 | ||
610 | $resultComment = $this->adapter->getColumnComment('table1', 'field1'); |
|
611 | ||
612 | $this->assertEquals($comment, $resultComment, 'Dont set column comment correctly'); |
|
613 | } |
|
614 | ||
615 | /** |
|
616 | * @dependss testAddColumnComment |
@@ 687-705 (lines=19) @@ | ||
684 | ||
685 | } |
|
686 | ||
687 | public function testCanAddColumnComment() |
|
688 | { |
|
689 | $table = new \Phinx\Db\Table('table1', array(), $this->adapter); |
|
690 | $table->addColumn('field1', 'string', array('comment' => $comment = 'Comments from column "field1"')) |
|
691 | ->save(); |
|
692 | ||
693 | $row = $this->adapter->fetchRow( |
|
694 | 'SELECT |
|
695 | (select pg_catalog.col_description(oid,cols.ordinal_position::int) |
|
696 | from pg_catalog.pg_class c |
|
697 | where c.relname=cols.table_name ) as column_comment |
|
698 | FROM information_schema.columns cols |
|
699 | WHERE cols.table_catalog=\''. TESTS_PHINX_DB_ADAPTER_POSTGRES_DATABASE .'\' |
|
700 | AND cols.table_name=\'table1\' |
|
701 | AND cols.column_name = \'field1\'' |
|
702 | ); |
|
703 | ||
704 | $this->assertEquals($comment, $row['column_comment'], 'Dont set column comment correctly'); |
|
705 | } |
|
706 | ||
707 | /** |
|
708 | * @depends testCanAddColumnComment |