diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2016-03-29 09:24:08 +0200 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2016-03-29 09:24:08 +0200 |
commit | 70e305a918fcf193009831d4e89aa8c386df3dc4 (patch) | |
tree | 8cc49f253f29636ddd623aa2c2b98835300604f0 /tests/unit/Data/DbCommon/MysqlColumnTest.php | |
parent | 55df8dac44f54a305e8bd7e50ef63f76725d2333 (diff) |
Ported / fixed most old tests
Diffstat (limited to 'tests/unit/Data/DbCommon/MysqlColumnTest.php')
-rw-r--r-- | tests/unit/Data/DbCommon/MysqlColumnTest.php | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/unit/Data/DbCommon/MysqlColumnTest.php b/tests/unit/Data/DbCommon/MysqlColumnTest.php index 3bdfe54f..88b1bb53 100644 --- a/tests/unit/Data/DbCommon/MysqlColumnTest.php +++ b/tests/unit/Data/DbCommon/MysqlColumnTest.php @@ -7,16 +7,25 @@ Prado::using('System.Data.Common.Mysql.TMysqlMetaData'); */ class MysqlColumnTest extends PHPUnit_Framework_TestCase { + protected function setUp() + { + if (!extension_loaded('mysql')) { + $this->markTestSkipped( + 'The mysql extension is not available.' + ); + } + } + function create_meta_data() { - $conn = new TDbConnection('mysql:host=localhost;dbname=tests;port=3307', 'test5','test5'); + $conn = new TDbConnection('mysql:host=localhost;dbname=prado_unitest', 'prado_unitest','prado_unitest'); return new TMysqlMetaData($conn); } function test_columns() { $table = $this->create_meta_data()->getTableInfo('table1'); - $this->assertEqual(count($table->getColumns()), 18); + $this->assertEquals(count($table->getColumns()), 18); $columns['id'] = array( 'ColumnName' => '`id`', @@ -233,8 +242,8 @@ class MysqlColumnTest extends PHPUnit_Framework_TestCase $this->assertColumn($columns, $table); $this->assertNull($table->getSchemaName()); - $this->assertEqual('table1', $table->getTableName()); - $this->assertEqual(array('id', 'name'), $table->getPrimaryKeys()); + $this->assertEquals('table1', $table->getTableName()); + $this->assertEquals(array('id', 'name'), $table->getPrimaryKeys()); } function assertColumn($columns, $table) @@ -247,7 +256,7 @@ class MysqlColumnTest extends PHPUnit_Framework_TestCase $ofAssert= var_export($assert,true); $value = $column->{$property}; $ofValue = var_export($value, true); - $this->assertEqual($value, $assert, + $this->assertEquals($value, $assert, "Column [{$id}] {$property} value {$ofValue} did not match {$ofAssert}"); } } |