Replacing test case compatibility functions

This commit is contained in:
Kyle Robinson Young 2011-11-15 16:07:56 -08:00 committed by mark_story
parent 2c5350bb4b
commit 98f03dc6df
107 changed files with 6357 additions and 6357 deletions

File diff suppressed because it is too large Load diff

View file

@ -269,17 +269,17 @@ class PostgresTest extends CakeTestCase {
$result = $this->Dbo->fields($this->model);
$expected = $fields;
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$result = $this->Dbo->fields($this->model, null, 'PostgresTestModel.*');
$expected = $fields;
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$result = $this->Dbo->fields($this->model, null, array('*', 'AnotherModel.id', 'AnotherModel.name'));
$expected = array_merge($fields, array(
'"AnotherModel"."id" AS "AnotherModel__id"',
'"AnotherModel"."name" AS "AnotherModel__name"'));
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$result = $this->Dbo->fields($this->model, null, array('*', 'PostgresClientTestModel.*'));
$expected = array_merge($fields, array(
@ -288,7 +288,7 @@ class PostgresTest extends CakeTestCase {
'"PostgresClientTestModel"."email" AS "PostgresClientTestModel__email"',
'"PostgresClientTestModel"."created" AS "PostgresClientTestModel__created"',
'"PostgresClientTestModel"."updated" AS "PostgresClientTestModel__updated"'));
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}
/**
@ -297,12 +297,12 @@ class PostgresTest extends CakeTestCase {
* @return void
*/
public function testColumnParsing() {
$this->assertEqual($this->Dbo2->column('text'), 'text');
$this->assertEqual($this->Dbo2->column('date'), 'date');
$this->assertEqual($this->Dbo2->column('boolean'), 'boolean');
$this->assertEqual($this->Dbo2->column('character varying'), 'string');
$this->assertEqual($this->Dbo2->column('time without time zone'), 'time');
$this->assertEqual($this->Dbo2->column('timestamp without time zone'), 'datetime');
$this->assertEquals($this->Dbo2->column('text'), 'text');
$this->assertEquals($this->Dbo2->column('date'), 'date');
$this->assertEquals($this->Dbo2->column('boolean'), 'boolean');
$this->assertEquals($this->Dbo2->column('character varying'), 'string');
$this->assertEquals($this->Dbo2->column('time without time zone'), 'time');
$this->assertEquals($this->Dbo2->column('timestamp without time zone'), 'datetime');
}
/**
@ -311,30 +311,30 @@ class PostgresTest extends CakeTestCase {
* @return void
*/
public function testValueQuoting() {
$this->assertEqual($this->Dbo->value(1.2, 'float'), "1.200000");
$this->assertEqual($this->Dbo->value('1,2', 'float'), "'1,2'");
$this->assertEquals($this->Dbo->value(1.2, 'float'), "1.200000");
$this->assertEquals($this->Dbo->value('1,2', 'float'), "'1,2'");
$this->assertEqual($this->Dbo->value('0', 'integer'), "0");
$this->assertEqual($this->Dbo->value('', 'integer'), 'NULL');
$this->assertEqual($this->Dbo->value('', 'float'), 'NULL');
$this->assertEqual($this->Dbo->value('', 'integer', false), "NULL");
$this->assertEqual($this->Dbo->value('', 'float', false), "NULL");
$this->assertEqual($this->Dbo->value('0.0', 'float'), "'0.0'");
$this->assertEquals($this->Dbo->value('0', 'integer'), "0");
$this->assertEquals($this->Dbo->value('', 'integer'), 'NULL');
$this->assertEquals($this->Dbo->value('', 'float'), 'NULL');
$this->assertEquals($this->Dbo->value('', 'integer', false), "NULL");
$this->assertEquals($this->Dbo->value('', 'float', false), "NULL");
$this->assertEquals($this->Dbo->value('0.0', 'float'), "'0.0'");
$this->assertEqual($this->Dbo->value('t', 'boolean'), "'TRUE'");
$this->assertEqual($this->Dbo->value('f', 'boolean'), "'FALSE'");
$this->assertEqual($this->Dbo->value(true), "'TRUE'");
$this->assertEqual($this->Dbo->value(false), "'FALSE'");
$this->assertEqual($this->Dbo->value('t'), "'t'");
$this->assertEqual($this->Dbo->value('f'), "'f'");
$this->assertEqual($this->Dbo->value('true', 'boolean'), "'TRUE'");
$this->assertEqual($this->Dbo->value('false', 'boolean'), "'FALSE'");
$this->assertEqual($this->Dbo->value('', 'boolean'), "'FALSE'");
$this->assertEqual($this->Dbo->value(0, 'boolean'), "'FALSE'");
$this->assertEqual($this->Dbo->value(1, 'boolean'), "'TRUE'");
$this->assertEqual($this->Dbo->value('1', 'boolean'), "'TRUE'");
$this->assertEqual($this->Dbo->value(null, 'boolean'), "NULL");
$this->assertEqual($this->Dbo->value(array()), "NULL");
$this->assertEquals($this->Dbo->value('t', 'boolean'), "'TRUE'");
$this->assertEquals($this->Dbo->value('f', 'boolean'), "'FALSE'");
$this->assertEquals($this->Dbo->value(true), "'TRUE'");
$this->assertEquals($this->Dbo->value(false), "'FALSE'");
$this->assertEquals($this->Dbo->value('t'), "'t'");
$this->assertEquals($this->Dbo->value('f'), "'f'");
$this->assertEquals($this->Dbo->value('true', 'boolean'), "'TRUE'");
$this->assertEquals($this->Dbo->value('false', 'boolean'), "'FALSE'");
$this->assertEquals($this->Dbo->value('', 'boolean'), "'FALSE'");
$this->assertEquals($this->Dbo->value(0, 'boolean'), "'FALSE'");
$this->assertEquals($this->Dbo->value(1, 'boolean'), "'TRUE'");
$this->assertEquals($this->Dbo->value('1', 'boolean'), "'TRUE'");
$this->assertEquals($this->Dbo->value(null, 'boolean'), "NULL");
$this->assertEquals($this->Dbo->value(array()), "NULL");
}
/**
@ -361,17 +361,17 @@ class PostgresTest extends CakeTestCase {
* @return void
*/
public function testDateAndTimeAsNull() {
$this->assertEqual($this->Dbo->value(null, 'date'), 'NULL');
$this->assertEqual($this->Dbo->value('', 'date'), 'NULL');
$this->assertEquals($this->Dbo->value(null, 'date'), 'NULL');
$this->assertEquals($this->Dbo->value('', 'date'), 'NULL');
$this->assertEqual($this->Dbo->value('', 'datetime'), 'NULL');
$this->assertEqual($this->Dbo->value(null, 'datetime'), 'NULL');
$this->assertEquals($this->Dbo->value('', 'datetime'), 'NULL');
$this->assertEquals($this->Dbo->value(null, 'datetime'), 'NULL');
$this->assertEqual($this->Dbo->value('', 'timestamp'), 'NULL');
$this->assertEqual($this->Dbo->value(null, 'timestamp'), 'NULL');
$this->assertEquals($this->Dbo->value('', 'timestamp'), 'NULL');
$this->assertEquals($this->Dbo->value(null, 'timestamp'), 'NULL');
$this->assertEqual($this->Dbo->value('', 'time'), 'NULL');
$this->assertEqual($this->Dbo->value(null, 'time'), 'NULL');
$this->assertEquals($this->Dbo->value('', 'time'), 'NULL');
$this->assertEquals($this->Dbo->value(null, 'time'), 'NULL');
}
/**
@ -405,7 +405,7 @@ class PostgresTest extends CakeTestCase {
$model = new Model(array('name' => 'Datatype', 'table' => 'datatypes', 'ds' => 'test'));
$model->create();
$this->assertIdentical(false, $model->data['Datatype']['bool']);
$this->assertSame(false, $model->data['Datatype']['bool']);
}
/**
@ -423,10 +423,10 @@ class PostgresTest extends CakeTestCase {
"INSERT INTO {$table} (\"user\", password) VALUES ('mariano', '{$password}')"
);
$this->assertEqual($db1->lastInsertId($table), 5);
$this->assertEquals($db1->lastInsertId($table), 5);
$db1->execute("INSERT INTO {$table} (\"user\", password) VALUES ('hoge', '{$password}')");
$this->assertEqual($db1->lastInsertId($table), 6);
$this->assertEquals($db1->lastInsertId($table), 6);
}
/**
@ -438,11 +438,11 @@ class PostgresTest extends CakeTestCase {
public function testColumnUseLength() {
$result = array('name' => 'foo', 'type' => 'string', 'length' => 100, 'default' => 'FOO');
$expected = '"foo" varchar(100) DEFAULT \'FOO\'';
$this->assertEqual($this->Dbo->buildColumn($result), $expected);
$this->assertEquals($this->Dbo->buildColumn($result), $expected);
$result = array('name' => 'foo', 'type' => 'text', 'length' => 100, 'default' => 'FOO');
$expected = '"foo" text DEFAULT \'FOO\'';
$this->assertEqual($this->Dbo->buildColumn($result), $expected);
$this->assertEquals($this->Dbo->buildColumn($result), $expected);
}
/**
@ -475,7 +475,7 @@ class PostgresTest extends CakeTestCase {
$model->save(compact('data'));
$result = $model->find('first');
$this->assertEqual($result['BinaryTest']['data'], $data);
$this->assertEquals($result['BinaryTest']['data'], $data);
}
/**
@ -507,7 +507,7 @@ class PostgresTest extends CakeTestCase {
));
$result = $this->Dbo->createSchema($schema);
$this->assertNoPattern('/^CREATE INDEX(.+);,$/', $result);
$this->assertNotRegExp('/^CREATE INDEX(.+);,$/', $result);
}
/**
@ -541,9 +541,9 @@ class PostgresTest extends CakeTestCase {
$result = $db1->createSchema($schema, 'datatype_tests');
$this->assertNoPattern('/timestamp DEFAULT/', $result);
$this->assertPattern('/\"full_length\"\s*text\s.*,/', $result);
$this->assertPattern('/timestamp\s*,/', $result);
$this->assertNotRegExp('/timestamp DEFAULT/', $result);
$this->assertRegExp('/\"full_length\"\s*text\s.*,/', $result);
$this->assertRegExp('/timestamp\s*,/', $result);
$db1->query('DROP TABLE ' . $db1->fullTableName('datatype_tests'));
@ -555,7 +555,7 @@ class PostgresTest extends CakeTestCase {
));
$schema->tables = array('datatype_tests' => $result2['tables']['missing']['datatype_tests']);
$result2 = $db1->createSchema($schema, 'datatype_tests');
$this->assertEqual($result, $result2);
$this->assertEquals($result, $result2);
$db1->query('DROP TABLE ' . $db1->fullTableName('datatype_tests'));
}
@ -577,7 +577,7 @@ class PostgresTest extends CakeTestCase {
);
$result = $this->Dbo->index($name);
$this->Dbo->query('DROP TABLE ' . $name);
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$name = $this->Dbo->fullTableName('index_test_2', false);
$this->Dbo->query('CREATE TABLE ' . $name . ' ("id" serial NOT NULL PRIMARY KEY, "bool" integer, "small_char" varchar(50), "description" varchar(40) )');
@ -588,7 +588,7 @@ class PostgresTest extends CakeTestCase {
);
$result = $this->Dbo->index($name);
$this->Dbo->query('DROP TABLE ' . $name);
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}
/**
@ -631,10 +631,10 @@ class PostgresTest extends CakeTestCase {
$result = $model->schema();
$this->assertTrue(isset($result['status']));
$this->assertFalse(isset($result['published']));
$this->assertEqual($result['body']['type'], 'string');
$this->assertEqual($result['status']['default'], 1);
$this->assertEqual($result['author_id']['null'], true);
$this->assertEqual($result['title']['null'], false);
$this->assertEquals($result['body']['type'], 'string');
$this->assertEquals($result['status']['default'], 1);
$this->assertEquals($result['author_id']['null'], true);
$this->assertEquals($result['title']['null'], false);
$this->Dbo->query($this->Dbo->dropSchema($New));
@ -652,7 +652,7 @@ class PostgresTest extends CakeTestCase {
)
));
$result = $this->Dbo->alterSchema($New->compare($Old), 'alter_posts');
$this->assertNoPattern('/varchar\(36\) NOT NULL/i', $result);
$this->assertNotRegExp('/varchar\(36\) NOT NULL/i', $result);
}
/**
@ -695,7 +695,7 @@ class PostgresTest extends CakeTestCase {
$this->Dbo->query($this->Dbo->alterSchema($schema2->compare($schema1)));
$indexes = $this->Dbo->index('altertest');
$this->assertEqual($schema2->tables['altertest']['indexes'], $indexes);
$this->assertEquals($schema2->tables['altertest']['indexes'], $indexes);
// Change three indexes, delete one and add another one
$schema3 = new CakeSchema(array(
@ -716,16 +716,16 @@ class PostgresTest extends CakeTestCase {
$this->Dbo->query($this->Dbo->alterSchema($schema3->compare($schema2)));
$indexes = $this->Dbo->index('altertest');
$this->assertEqual($schema3->tables['altertest']['indexes'], $indexes);
$this->assertEquals($schema3->tables['altertest']['indexes'], $indexes);
// Compare us to ourself.
$this->assertEqual($schema3->compare($schema3), array());
$this->assertEquals($schema3->compare($schema3), array());
// Drop the indexes
$this->Dbo->query($this->Dbo->alterSchema($schema1->compare($schema3)));
$indexes = $this->Dbo->index('altertest');
$this->assertEqual(array(), $indexes);
$this->assertEquals(array(), $indexes);
$this->Dbo->query($this->Dbo->dropSchema($schema1));
}
@ -745,10 +745,10 @@ class PostgresTest extends CakeTestCase {
'subquery' => 'SELECT count(*) FROM ' . $Article->Comment->table
);
$result = $Article->find('first');
$this->assertEqual($result['Article']['next_id'], 2);
$this->assertEqual($result['Article']['complex'], $result['Article']['title'] . $result['Article']['body']);
$this->assertEqual($result['Article']['functional'], $result['User']['user']);
$this->assertEqual($result['Article']['subquery'], 6);
$this->assertEquals($result['Article']['next_id'], 2);
$this->assertEquals($result['Article']['complex'], $result['Article']['title'] . $result['Article']['body']);
$this->assertEquals($result['Article']['functional'], $result['User']['user']);
$this->assertEquals($result['Article']['subquery'], 6);
}
/**
@ -778,7 +778,7 @@ class PostgresTest extends CakeTestCase {
public function testOrderAdditionalParams() {
$result = $this->Dbo->order(array('title' => 'DESC NULLS FIRST', 'body' => 'DESC'));
$expected = ' ORDER BY "title" DESC NULLS FIRST, "body" DESC';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}
/**
@ -789,15 +789,15 @@ class PostgresTest extends CakeTestCase {
$Article = new Article;
$result = $this->Dbo->fields($Article, null, array('COUNT(DISTINCT Article.id)'));
$expected = array('COUNT(DISTINCT "Article"."id")');
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$result = $this->Dbo->fields($Article, null, array('COUNT(DISTINCT id)'));
$expected = array('COUNT(DISTINCT "id")');
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$result = $this->Dbo->fields($Article, null, array('COUNT(DISTINCT FUNC(id))'));
$expected = array('COUNT(DISTINCT FUNC("id"))');
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}
/**
@ -814,7 +814,7 @@ class PostgresTest extends CakeTestCase {
$result = $Article->find('count', array(
'conditions' => array('Article.title' => 'Awesome')
));
$this->assertEqual($result, 1, 'Article count is wrong or fixture has changed.');
$this->assertEquals($result, 1, 'Article count is wrong or fixture has changed.');
}
/**
@ -848,7 +848,7 @@ class PostgresTest extends CakeTestCase {
)
));
$result = $this->db->alterSchema($schema2->compare($schema1));
$this->assertEqual(2, substr_count($result, 'field_two'), 'Too many fields');
$this->assertEquals(2, substr_count($result, 'field_two'), 'Too many fields');
$this->assertFalse(strpos(';ALTER', $result), 'Too many semi colons');
}
@ -862,12 +862,12 @@ class PostgresTest extends CakeTestCase {
$this->assertTrue($result) ;
$result = $this->Dbo->getEncoding();
$this->assertEqual('utf8', $result) ;
$this->assertEquals('utf8', $result) ;
$result = $this->Dbo->setEncoding('EUC-JP');
$this->assertTrue($result) ;
$result = $this->Dbo->getEncoding();
$this->assertEqual('EUC-JP', $result) ;
$this->assertEquals('EUC-JP', $result) ;
}
}

View file

@ -139,7 +139,7 @@ class SqliteTest extends CakeTestCase {
);
$result = $this->Dbo->index($name);
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$this->Dbo->query('DROP TABLE ' . $name);
$this->Dbo->query('CREATE TABLE ' . $name . ' ("id" int(11) PRIMARY KEY, "bool" int(1), "small_char" varchar(50), "description" varchar(40) );');
@ -149,7 +149,7 @@ class SqliteTest extends CakeTestCase {
'multi_col' => array('column' => array('small_char', 'bool'), 'unique' => 1),
);
$result = $this->Dbo->index($name);
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$this->Dbo->query('DROP TABLE ' . $name);
}
@ -170,13 +170,13 @@ class SqliteTest extends CakeTestCase {
$db->execute("CREATE TABLE test_list (id VARCHAR(255));");
$db->cacheSources = true;
$this->assertEqual($db->listSources(), array('test_list'));
$this->assertEquals($db->listSources(), array('test_list'));
$db->cacheSources = false;
$fileName = '_' . preg_replace('/[^A-Za-z0-9_\-+]/', '_', TMP . $dbName) . '_list';
$result = Cache::read($fileName, '_cake_model_');
$this->assertEqual($result, array('test_list'));
$this->assertEquals($result, array('test_list'));
Cache::delete($fileName, '_cake_model_');
Configure::write('Cache.disable', true);
@ -195,7 +195,7 @@ class SqliteTest extends CakeTestCase {
);
$result = $this->Dbo->buildColumn($data);
$expected = '"int_field" integer NOT NULL';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$data = array(
'name' => 'name',
@ -205,7 +205,7 @@ class SqliteTest extends CakeTestCase {
);
$result = $this->Dbo->buildColumn($data);
$expected = '"name" varchar(20) NOT NULL';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$data = array(
'name' => 'testName',
@ -217,7 +217,7 @@ class SqliteTest extends CakeTestCase {
);
$result = $this->Dbo->buildColumn($data);
$expected = '"testName" varchar(20) DEFAULT NULL COLLATE NOCASE';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$data = array(
'name' => 'testName',
@ -228,7 +228,7 @@ class SqliteTest extends CakeTestCase {
);
$result = $this->Dbo->buildColumn($data);
$expected = '"testName" varchar(20) DEFAULT \'test-value\' NOT NULL';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$data = array(
'name' => 'testName',
@ -239,7 +239,7 @@ class SqliteTest extends CakeTestCase {
);
$result = $this->Dbo->buildColumn($data);
$expected = '"testName" integer(10) DEFAULT 10 NOT NULL';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$data = array(
'name' => 'testName',
@ -251,7 +251,7 @@ class SqliteTest extends CakeTestCase {
);
$result = $this->Dbo->buildColumn($data);
$expected = '"testName" integer(10) DEFAULT 10 NOT NULL';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}
/**
@ -319,7 +319,7 @@ class SqliteTest extends CakeTestCase {
'default' => null,
'key' => 'primary',
);
$this->assertEqual($result['id'], $expected);
$this->assertEquals($result['id'], $expected);
$this->Dbo->query('DROP TABLE ' . $tableName);
$tableName = 'uuid_tests';
@ -333,7 +333,7 @@ class SqliteTest extends CakeTestCase {
'default' => null,
'key' => 'primary',
);
$this->assertEqual($result['id'], $expected);
$this->assertEquals($result['id'], $expected);
$this->Dbo->query('DROP TABLE ' . $tableName);
}

View file

@ -284,23 +284,23 @@ class SqlserverTest extends CakeTestCase {
public function testQuoting() {
$expected = "1.200000";
$result = $this->db->value(1.2, 'float');
$this->assertIdentical($expected, $result);
$this->assertSame($expected, $result);
$expected = "'1,2'";
$result = $this->db->value('1,2', 'float');
$this->assertIdentical($expected, $result);
$this->assertSame($expected, $result);
$expected = 'NULL';
$result = $this->db->value('', 'integer');
$this->assertIdentical($expected, $result);
$this->assertSame($expected, $result);
$expected = 'NULL';
$result = $this->db->value('', 'float');
$this->assertIdentical($expected, $result);
$this->assertSame($expected, $result);
$expected = "''";
$result = $this->db->value('', 'binary');
$this->assertIdentical($expected, $result);
$this->assertSame($expected, $result);
}
/**
* testFields method
@ -331,19 +331,19 @@ class SqlserverTest extends CakeTestCase {
$result = $this->db->fields($this->model);
$expected = $fields;
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$this->db->clearFieldMappings();
$result = $this->db->fields($this->model, null, 'SqlserverTestModel.*');
$expected = $fields;
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$this->db->clearFieldMappings();
$result = $this->db->fields($this->model, null, array('*', 'AnotherModel.id', 'AnotherModel.name'));
$expected = array_merge($fields, array(
'[AnotherModel].[id] AS [AnotherModel__id]',
'[AnotherModel].[name] AS [AnotherModel__name]'));
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$this->db->clearFieldMappings();
$result = $this->db->fields($this->model, null, array('*', 'SqlserverClientTestModel.*'));
@ -353,7 +353,7 @@ class SqlserverTest extends CakeTestCase {
'[SqlserverClientTestModel].[email] AS [SqlserverClientTestModel__email]',
'CONVERT(VARCHAR(20), [SqlserverClientTestModel].[created], 20) AS [SqlserverClientTestModel__created]',
'CONVERT(VARCHAR(20), [SqlserverClientTestModel].[updated], 20) AS [SqlserverClientTestModel__updated]'));
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}
/**
@ -364,11 +364,11 @@ class SqlserverTest extends CakeTestCase {
public function testDistinctFields() {
$result = $this->db->fields($this->model, null, array('DISTINCT Car.country_code'));
$expected = array('DISTINCT [Car].[country_code] AS [Car__country_code]');
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$result = $this->db->fields($this->model, null, 'DISTINCT Car.country_code');
$expected = array('DISTINCT [Car].[country_code] AS [Car__country_code]');
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}
/**
@ -382,7 +382,7 @@ class SqlserverTest extends CakeTestCase {
'limit' => 5
));
$result = $this->db->getLastQuery();
$this->assertPattern('/^SELECT DISTINCT TOP 5/', $result);
$this->assertRegExp('/^SELECT DISTINCT TOP 5/', $result);
}
/**
@ -457,7 +457,7 @@ class SqlserverTest extends CakeTestCase {
'key' => 'primary'
)
);
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}
/**
* testBuildColumn
@ -468,58 +468,58 @@ class SqlserverTest extends CakeTestCase {
$column = array('name' => 'id', 'type' => 'integer', 'null' => false, 'default' => '', 'length' => '8', 'key' => 'primary');
$result = $this->db->buildColumn($column);
$expected = '[id] int IDENTITY (1, 1) NOT NULL';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$column = array('name' => 'client_id', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '11');
$result = $this->db->buildColumn($column);
$expected = '[client_id] int DEFAULT 0 NOT NULL';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$column = array('name' => 'client_id', 'type' => 'integer', 'null' => true);
$result = $this->db->buildColumn($column);
$expected = '[client_id] int NULL';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
// 'name' => 'type' format for columns
$column = array('type' => 'integer', 'name' => 'client_id');
$result = $this->db->buildColumn($column);
$expected = '[client_id] int NULL';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$column = array('type' => 'string', 'name' => 'name');
$result = $this->db->buildColumn($column);
$expected = '[name] nvarchar(255) NULL';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$column = array('name' => 'name', 'type' => 'string', 'null' => false, 'default' => '', 'length' => '255');
$result = $this->db->buildColumn($column);
$expected = '[name] nvarchar(255) DEFAULT \'\' NOT NULL';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$column = array('name' => 'name', 'type' => 'string', 'null' => false, 'length' => '255');
$result = $this->db->buildColumn($column);
$expected = '[name] nvarchar(255) NOT NULL';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$column = array('name' => 'name', 'type' => 'string', 'null' => false, 'default' => null, 'length' => '255');
$result = $this->db->buildColumn($column);
$expected = '[name] nvarchar(255) NOT NULL';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$column = array('name' => 'name', 'type' => 'string', 'null' => true, 'default' => null, 'length' => '255');
$result = $this->db->buildColumn($column);
$expected = '[name] nvarchar(255) NULL';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$column = array('name' => 'name', 'type' => 'string', 'null' => true, 'default' => '', 'length' => '255');
$result = $this->db->buildColumn($column);
$expected = '[name] nvarchar(255) DEFAULT \'\'';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$column = array('name' => 'body', 'type' => 'text');
$result = $this->db->buildColumn($column);
$expected = '[body] nvarchar(MAX)';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}
/**
* testBuildIndex method
@ -536,16 +536,16 @@ class SqlserverTest extends CakeTestCase {
'PRIMARY KEY ([id])',
'ALTER TABLE items ADD CONSTRAINT client_id UNIQUE([client_id]);'
);
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$indexes = array('client_id' => array('column' => 'client_id'));
$result = $this->db->buildIndex($indexes, 'items');
$this->assertEqual($result, array());
$this->assertEquals($result, array());
$indexes = array('client_id' => array('column' => array('client_id', 'period_id'), 'unique' => 1));
$result = $this->db->buildIndex($indexes, 'items');
$expected = array('ALTER TABLE items ADD CONSTRAINT client_id UNIQUE([client_id], [period_id]);');
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}
/**
* testUpdateAllSyntax method
@ -558,9 +558,9 @@ class SqlserverTest extends CakeTestCase {
$this->db->update($this->model, $fields, null, $conditions);
$result = $this->db->getLastQuery();
$this->assertNoPattern('/SqlserverTestModel/', $result);
$this->assertPattern('/^UPDATE \[sqlserver_test_models\]/', $result);
$this->assertPattern('/SET \[client_id\] = \[client_id\] \+ 1/', $result);
$this->assertNotRegExp('/SqlserverTestModel/', $result);
$this->assertRegExp('/^UPDATE \[sqlserver_test_models\]/', $result);
$this->assertRegExp('/SET \[client_id\] = \[client_id\] \+ 1/', $result);
}
/**
@ -573,7 +573,7 @@ class SqlserverTest extends CakeTestCase {
$this->db->describe = $schema;
$result = $this->db->getPrimaryKey($this->model);
$this->assertEqual($result, 'id');
$this->assertEquals($result, 'id');
unset($schema['id']['key']);
$this->db->describe = $schema;
@ -602,7 +602,7 @@ class SqlserverTest extends CakeTestCase {
"INSERT INTO [sqlserver_test_models] ([id], [name], [login]) VALUES (2, N'Renan', N'renan.saddam')",
'SET IDENTITY_INSERT [sqlserver_test_models] OFF'
);
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$fields = array('name', 'login');
$values = array(
@ -615,7 +615,7 @@ class SqlserverTest extends CakeTestCase {
"INSERT INTO [sqlserver_test_models] ([name], [login]) VALUES (N'Larry', N'PhpNut')",
"INSERT INTO [sqlserver_test_models] ([name], [login]) VALUES (N'Renan', N'renan.saddam')",
);
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}
/**