Location: PHPKode > projects > OpenNitro > trunk/Tests/Nitro/Common.inc.php
<?php
//
// +---------------------------------------------------------------------------+
// | Nitro :: Tests :: Common                                                  |
// +---------------------------------------------------------------------------+
// | Copyright (c) 2003-2006 June Systems BV                                   |
// +---------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or modify it   |
// | under the terms of the GNU Lesser General Public License as published by  |
// | the Free Software Foundation; either version 2.1 of the License, or (at   |
// | your option) any later version.                                           |
// |                                                                           |
// | This library is distributed in the hope that it will be useful, but       |
// | WITHOUT ANY WARRANTY; without even the implied warranty of                |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser   |
// | General Public License for more details.                                  |
// |                                                                           |
// | You should have received a copy of the GNU Lesser General Public License  |
// | along with this library; if not, write to the Free Software Foundation,   |
// | Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA            |
// +---------------------------------------------------------------------------+
// | Authors: Jesper Avot <hide@address.com>                             |
// +---------------------------------------------------------------------------+
//
// $Id: Common.inc.php 229 2008-04-17 09:20:31Z oli $
//

/**
 * Set error_reporting
 */
error_reporting(E_ALL & ~E_NOTICE);

/**
 * Include required files
 */
require_once NITRO_ROOT.'Nitro/Common.inc.php';

/**
 * Common TestCase
 */
class Common_Test extends Nitro_TestCase {
	
	function Common_Test($Name = "Common_Test")
	{
		parent::Nitro_TestCase($Name);
	}
	
	function test_NitroPrepareDB()
	{
		$this->AssertEquals(NitroPrepareDB(3), 3, "String is not prepared");
		$this->AssertEquals(NitroPrepareDB("test"), "'test'", "String is not prepared");
		$this->AssertEquals(NitroPrepareDB("test's"), "'test\'s'", "String is not prepared");
	}
	
	function test_NitroCreateRandomString()
	{
		$this->AssertEquals(TRUE, NitroCreateRandomString(0) === NitroCreateRandomString(0), "Random empty strings");
		$this->AssertEquals(TRUE, NitroCreateRandomString(4) !== NitroCreateRandomString(4), "Random strings are the same !");
	}	
}
?>
Return current item: OpenNitro