private function doTestViewsDroppedInOrder($format) { dbsteward::set_sql_format($format); // by dropping the entire schema $doc = $this->doc_with; $actual = $this->capture(function ($ofs) use($doc) { format_diff_views::drop_views_ordered($ofs, $doc, null); }); if ($format == 'pgsql8') { // if we drop the whole schema, we don't need to drop individual views in it. $expected = <<<SQL SQL; } else { $expected = <<<SQL DROP VIEW IF EXISTS `view2`; DROP VIEW IF EXISTS `view1`; SQL; } $this->assertEquals($expected, $actual); // by dropping only the views $doc_without = $this->doc_without; $actual = $this->capture(function ($ofs) use($doc, $doc_without) { format_diff_views::drop_views_ordered($ofs, $doc, $doc_without); }); if ($format == 'pgsql8') { $expected = <<<SQL DROP VIEW IF EXISTS "public"."view2"; DROP VIEW IF EXISTS "public"."view1"; SQL; } else { $expected = <<<SQL DROP VIEW IF EXISTS `view2`; DROP VIEW IF EXISTS `view1`; SQL; } $this->assertEquals($expected, $actual); }