From e5a1244e0f630ac56a3d356b5a22cf715f2b45b1 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Fri, 1 Nov 2013 16:46:41 +0100 Subject: [PATCH] moved unit test from cubrid to general should be tested for all dbms not only cubrid even if the problem may not exist in all of them it is good to verify that. --- tests/unit/framework/db/ActiveRecordTest.php | 28 ++++++++++++++++++++++ .../framework/db/cubrid/CubridActiveRecordTest.php | 28 ---------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/tests/unit/framework/db/ActiveRecordTest.php b/tests/unit/framework/db/ActiveRecordTest.php index 1d6005e..9e68f5e 100644 --- a/tests/unit/framework/db/ActiveRecordTest.php +++ b/tests/unit/framework/db/ActiveRecordTest.php @@ -426,4 +426,32 @@ class ActiveRecordTest extends DatabaseTestCase $this->assertEquals(0, $record->var3); $this->assertEquals('', $record->stringcol); } + + /** + * Some PDO implementations(e.g. cubrid) do not support boolean values. + * Make sure this does not affect AR layer. + */ + public function testBooleanAttribute() + { + $customer = new Customer(); + $customer->name = 'boolean customer'; + $customer->email = 'mail@example.com'; + $customer->status = true; + $customer->save(false); + + $customer->refresh(); + $this->assertEquals(1, $customer->status); + + $customer->status = false; + $customer->save(false); + + $customer->refresh(); + $this->assertEquals(0, $customer->status); + + $customers = Customer::find()->where(['status' => true])->all(); + $this->assertEquals(2, count($customers)); + + $customers = Customer::find()->where(['status' => false])->all(); + $this->assertEquals(1, count($customers)); + } } diff --git a/tests/unit/framework/db/cubrid/CubridActiveRecordTest.php b/tests/unit/framework/db/cubrid/CubridActiveRecordTest.php index 9fb9915..3949ba2 100644 --- a/tests/unit/framework/db/cubrid/CubridActiveRecordTest.php +++ b/tests/unit/framework/db/cubrid/CubridActiveRecordTest.php @@ -11,32 +11,4 @@ use yiiunit\framework\db\ActiveRecordTest; class CubridActiveRecordTest extends ActiveRecordTest { public $driverName = 'cubrid'; - - /** - * cubrid PDO does not support boolean values. - * Make sure this does not affect AR layer. - */ - public function testBooleanAttribute() - { - $customer = new Customer(); - $customer->name = 'boolean customer'; - $customer->email = 'mail@example.com'; - $customer->status = true; - $customer->save(false); - - $customer->refresh(); - $this->assertEquals(1, $customer->status); - - $customer->status = false; - $customer->save(false); - - $customer->refresh(); - $this->assertEquals(0, $customer->status); - - $customers = Customer::find()->where(['status' => true])->all(); - $this->assertEquals(2, count($customers)); - - $customers = Customer::find()->where(['status' => false])->all(); - $this->assertEquals(1, count($customers)); - } }