From b2a548e1830fa57b2677cc5e9710aa184f82d503 Mon Sep 17 00:00:00 2001 From: kaste Date: Fri, 22 Feb 2008 17:56:32 +0000 Subject: [PATCH] Added unit test for #123 git-svn-id: http://svn.akelos.org/trunk@482 a2fa5c27-f921-0410-a72c-bf682d381be0 --- .../AkActiveRecord/_AkActiveRecord_datatypes.php | 32 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/test/unit/lib/AkActiveRecord/_AkActiveRecord_datatypes.php b/test/unit/lib/AkActiveRecord/_AkActiveRecord_datatypes.php index e554011..668b123 100644 --- a/test/unit/lib/AkActiveRecord/_AkActiveRecord_datatypes.php +++ b/test/unit/lib/AkActiveRecord/_AkActiveRecord_datatypes.php @@ -4,7 +4,11 @@ defined('AK_TEST_DATABASE_ON') ? null : define('AK_TEST_DATABASE_ON', true); require_once(dirname(__FILE__).'/../../../fixtures/config/config.php'); class test_AkActiceRecord_datatypes extends AkUnitTest -{ +{ + /** + * @var ActiveRecord + */ + var $Hybrid; function test_installer_should_handle_integers() { $this->installAndIncludeModels(array('Hybrid'=>'id,title,price integer')); @@ -107,8 +111,30 @@ class test_AkActiceRecord_datatypes extends AkUnitTest $Celebrity =& $this->Hybrid->findBy('celebrity','true'); $this->assertTrue($Celebrity[0]->celebrity); $this->assertEqual($Celebrity[0]->title,'Kate'); - - } + } + + function test_strings_can_be_empty() + { + $this->installAndIncludeModels(array('Hybrid'=>'id,title')); + $Post = $this->Hybrid->create(array('title'=>'')); + $Post->reload(); + $this->assertEqual('',$Post->title); + $this->assertNotNull($Post->title,'Known bug #123'); + + $Post->updateAttribute('title','',true); + $Post->reload(); + $this->assertEqual('',$Post->title); + $this->assertNotNull($Post->title); + } + + function test_strings_can_be_null() + { + $this->installAndIncludeModels(array('Hybrid'=>'id,title')); + $Post = $this->Hybrid->create(array('title'=>null)); + $Post->reload(); + $this->assertNull($Post->title); + } + } ak_test('test_AkActiceRecord_datatypes',true); -- 2.11.4.GIT