Console::writeln(); } if (count($extra)) { Console::left(get_class($obj) . ' extra fields', 40); Console::write($extra); Console::writeln(); } } $old = null; $arr = $DB->query('show create table `' . $new['name'] . '`'); if (isset($arr[0]['Create Table'])) { $old = parseCreateTable($arr[0]['Create Table']); } if ($old) { // existent table $arr = compareTables($old, $new); if (count($arr)) { Console::left($new['name'], 30); foreach ($arr as $key => $q) { $DB->execute($q); if (in_array($DB->getError(), $codes)) { Console::write($key . ' '); } else { Console::write($key . ' '); $error[] = $q; } } Console::writeln(); } else { } } else {
$expected_rows[] = $world->replace_variables(implode("\t", $row)); } compareTables($expected_rows, $actual_rows, $output); }); $steps->Then('/^STDOUT should end with a table containing rows:$/', function ($world, TableNode $expected) { $output = $world->result->stdout; $actual_rows = explode("\n", rtrim($output, "\n")); $expected_rows = array(); foreach ($expected->getRows() as $row) { $expected_rows[] = $world->replace_variables(implode("\t", $row)); } $start = array_search($expected_rows[0], $actual_rows); if (false === $start) { throw new \Exception($world->result); } compareTables($expected_rows, array_slice($actual_rows, $start), $output); }); $steps->Then('/^STDOUT should be JSON containing:$/', function ($world, PyStringNode $expected) { $output = $world->result->stdout; $expected = $world->replace_variables((string) $expected); if (!checkThatJsonStringContainsJsonString($output, $expected)) { throw new \Exception($world->result); } }); $steps->Then('/^STDOUT should be a JSON array containing:$/', function ($world, PyStringNode $expected) { $output = $world->result->stdout; $expected = $world->replace_variables((string) $expected); $actualValues = json_decode($output); $expectedValues = json_decode($expected); $missing = array_diff($expectedValues, $actualValues); if (!empty($missing)) {