public function testNamedID() { $table1 = harness_Native::table($this->data1); $table2 = harness_Native::table($this->data2); $flags = new coopy_CompareFlags(); $flags->addPrimaryKey("Capital"); $alignment = coopy_Coopy::compareTables($table1, $table2, $flags)->align(); $data_diff = new _hx_array(array()); $table_diff = harness_Native::table($data_diff); $highlighter = new coopy_TableDiff($alignment, $flags); $highlighter->hilite($table_diff); $this->assertEquals("" . Std::string($table_diff->getCell(3, 6)), "Barcelona", _hx_anonymous(array("fileName" => "BasicTest.hx", "lineNumber" => 54, "className" => "harness.BasicTest", "methodName" => "testNamedID"))); }
public function addMeta($output) { $a_meta = null; $b_meta = null; $p_meta = null; $a_meta = $this->getMetaTable($this->a); $b_meta = $this->getMetaTable($this->b); $p_meta = $this->getMetaTable($this->p); if ($a_meta === null || $b_meta === null || $p_meta === null) { return false; } if (!$this->checkMeta($this->a, $a_meta)) { return false; } if (!$this->checkMeta($this->b, $b_meta)) { return false; } if (!$this->checkMeta($this->p, $p_meta)) { return false; } if (!$this->flags->show_meta) { return false; } $meta_diff = new coopy_SimpleTable(0, 0); $meta_flags = new coopy_CompareFlags(); $meta_flags->addPrimaryKey("@@"); $meta_flags->addPrimaryKey("@"); $meta_flags->unchanged_column_context = 65536; $meta_flags->unchanged_context = 0; $meta_align = coopy_Coopy::compareTables3($a_meta === $p_meta ? null : $p_meta, $a_meta, $b_meta, $meta_flags)->align(); $td = new coopy_TableDiff($meta_align, $meta_flags); $td->preserve_columns = true; $td->hilite($meta_diff); if ($td->hasDifference()) { $h = $output->get_height(); $dh = $meta_diff->get_height(); $offset = null; if ($td->hasSchemaDifference()) { $offset = 2; } else { $offset = 1; } $output->resize($output->get_width(), $h + $dh - $offset); $v = $meta_diff->getCellView(); $_g = $offset; while ($_g < $dh) { $y = $_g++; $_g2 = 1; $_g1 = $meta_diff->get_width(); while ($_g2 < $_g1) { $x = $_g2++; $c = $meta_diff->getCell($x, $y); if ($x === 1) { $c = "@" . _hx_string_or_null($v->toString($c)) . "@" . _hx_string_or_null($v->toString($meta_diff->getCell(0, $y))); } $output->setCell($x - 1, $h + $y - $offset, $c); unset($x, $c); } unset($_g2, $_g1); unset($y); } if ($this->active_column !== null) { if ($td->active_column->length === $meta_diff->get_width()) { $_g11 = 1; $_g3 = $meta_diff->get_width(); while ($_g11 < $_g3) { $i = $_g11++; if ($td->active_column->a[$i] >= 0) { $this->active_column[$i - 1] = 1; } unset($i); } } } } return false; }