Files
luos/tests/unit/gulliver/system/GTest.php
Herbert Saal Gutierrez 273dff4745 BUG 9180 Correct display priority in cases lists
Code Issue
----------
A number is display in the Priority column in the cases lists instead of the
priority in text.

Solution
--------
Correct display of priority column in cases lists.
The text that describes the priority is display instead of the priority number.
The number is converted to the corresponding text with the help of the function
G::LoadTranslation("ID_PRIORITY_N");
2012-06-18 17:58:14 -04:00

1811 lines
50 KiB
PHP

<?php
require_once PATH_TRUNK . 'gulliver' . PATH_SEP . "system" . PATH_SEP . "class.g.php";
/**
* Generated by PHPUnit_SkeletonGenerator on 2012-05-09 at 10:14:57.
*/
class GTest extends PHPUnit_Framework_TestCase
{
/**
* @covers G::is_https
* @todo Implement testIs_https().
*/
public function testIs_https()
{
$this->assertFalse(G::is_https());
$_SERVER̈́['HTTPS'] = '';
$this->assertFalse(G::is_https());
$_SERVER['HTTPS'] = 'on';
$this->assertTrue(G::is_https());
}
/**
* @covers G::array_fill_value
* @todo Implement testArray_fill_value().
*/
public function testArray_fill_value()
{
$arrayTest = '1';
$arrayRes = G::array_fill_value($arrayTest);
$this->assertTrue( (is_array($arrayRes) && (count($arrayRes) == 0)) );
// $recursive = false and new Value = ''
$arrayTest = array('value1','value2','value3','value4');
$arrayRes = G::array_fill_value($arrayTest);
$this->assertEquals($arrayRes['0'],'');
$this->assertEquals($arrayRes['1'],'');
$this->assertEquals($arrayRes['2'],'');
$this->assertEquals($arrayRes['3'],'');
// $recursive = false and new Value = 'valueTest'
$arrayTest = array('value1','value2','value3','value4');
$arrayRes = G::array_fill_value($arrayTest,'valueTest');
$this->assertEquals($arrayRes['0'],'valueTest');
$this->assertEquals($arrayRes['1'],'valueTest');
$this->assertEquals($arrayRes['2'],'valueTest');
$this->assertEquals($arrayRes['3'],'valueTest');
// $recursive = true and new Value = 'valueTest'
$arrayTestSub1 = array('value11', 'value12', 'value13');
$arrayTestSub2 = array('value21', 'value22', 'value23');
$arrayTestSub3 = array('value31', 'value32', 'value33');
$arrayTest = array('value1', $arrayTestSub1, $arrayTestSub1, $arrayTestSub1);
$arrayRes = G::array_fill_value($arrayTest,'valueTest',true);
$this->assertEquals($arrayRes['0'],'valueTest');
$this->assertEquals($arrayRes['1']['0'],'valueTest');
$this->assertEquals($arrayRes['1']['1'],'valueTest');
$this->assertEquals($arrayRes['1']['2'],'valueTest');
$this->assertEquals($arrayRes['2']['0'],'valueTest');
$this->assertEquals($arrayRes['2']['1'],'valueTest');
$this->assertEquals($arrayRes['2']['2'],'valueTest');
$this->assertEquals($arrayRes['3']['0'],'valueTest');
$this->assertEquals($arrayRes['3']['1'],'valueTest');
$this->assertEquals($arrayRes['3']['2'],'valueTest');
// $recursive = true and new Value = ''
$arrayTestSub1 = array('value11', 'value12', 'value13');
$arrayTestSub2 = array('value21', 'value22', 'value23');
$arrayTestSub3 = array('value31', 'value32', 'value33');
$arrayTest = array('value1', $arrayTestSub1, $arrayTestSub1, $arrayTestSub1);
$arrayRes = G::array_fill_value($arrayTest,'',true);
$this->assertEquals($arrayRes['0'],'');
$this->assertEquals($arrayRes['1']['0'],'');
$this->assertEquals($arrayRes['1']['1'],'');
$this->assertEquals($arrayRes['1']['2'],'');
$this->assertEquals($arrayRes['2']['0'],'');
$this->assertEquals($arrayRes['2']['1'],'');
$this->assertEquals($arrayRes['2']['2'],'');
$this->assertEquals($arrayRes['3']['0'],'');
$this->assertEquals($arrayRes['3']['1'],'');
$this->assertEquals($arrayRes['3']['2'],'');
}
/**
* @covers G::generate_password
* @todo Implement testGenerate_password().
*/
public function testGenerate_password()
{
// $length = ''
$responsePass = G::generate_password();
$this->assertEquals(strlen($responsePass),8);
// $length = '32'
$responsePass = G::generate_password(10);
$this->assertEquals(strlen($responsePass),10);
}
/**
* @covers G::array_concat
* @todo Implement testArray_concat().
*/
public function testArray_concat()
{
$arrayTest1 = array('value11','value12');
$arrayTest2 = array('value21','value22');
$arrayTest3 = array('value31','value32');
$arrayTest = array($arrayTest1, $arrayTest2, $arrayTest3);
$arrayResponse = G::array_concat($arrayTest);
$this->assertEquals($arrayResponse['0']['0'],'value11');
$this->assertEquals($arrayResponse['0']['1'],'value12');
$this->assertEquals($arrayResponse['1']['0'],'value21');
$this->assertEquals($arrayResponse['1']['1'],'value22');
$this->assertEquals($arrayResponse['2']['0'],'value31');
$this->assertEquals($arrayResponse['2']['1'],'value32');
}
/**
* @covers G::var_compare
* @todo Implement testVar_compare().
*/
public function testVar_compare()
{
/**
* @error : Function may receive only one variable, but fires a warning.
@example : <php G::var_compare(true); ?>
*/
//
$this->assertTrue(G::var_compare(true,true));
$this->assertFalse(G::var_compare(true,false));
$this->assertTrue(G::var_compare(true,true,true));
$this->assertFalse(G::var_compare(true,true,false));
}
/**
* @covers G::var_probe
* @todo Implement testVar_probe().
*/
public function testVar_probe()
{
$this->assertEquals(G::var_probe('string'),'string');
$this->assertEquals(G::var_probe(false,false),1);
}
/**
* @covers G::getVersion
* @todo Implement testGetVersion().
*/
public function testGetVersion()
{
// @verify
//$this->assertEquals($valueResponse,'3.0-1');
}
/**
* @covers G::getIpAddress
* @todo Implement testGetIpAddress().
*/
public function testGetIpAddress()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::getMacAddress
* @todo Implement testGetMacAddress().
*/
public function testGetMacAddress()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::microtime_float
* @todo Implement testMicrotime_float().
*/
public function testMicrotime_float()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::setFatalErrorHandler
* @todo Implement testSetFatalErrorHandler().
*/
public function testSetFatalErrorHandler()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::setErrorHandler
* @todo Implement testSetErrorHandler().
*/
public function testSetErrorHandler()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::fatalErrorHandler
* @todo Implement testFatalErrorHandler().
*/
public function testFatalErrorHandler()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::customErrorHandler
* @todo Implement testCustomErrorHandler().
*/
public function testCustomErrorHandler()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::showErrorSource
* @todo Implement testShowErrorSource().
*/
public function testShowErrorSource()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::customErrorLog
* @todo Implement testCustomErrorLog().
*/
public function testCustomErrorLog()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::verboseError
* @todo Implement testVerboseError().
*/
public function testVerboseError()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::encrypt
* @todo Implement testEncrypt().
*/
public function testEncrypt()
{
$encryptPassword = '6czY7OLU688';
$encryptResponse = G::encrypt('password','key');
$this->assertEquals($encryptResponse, $encryptPassword);
}
/**
* @covers G::decrypt
* @todo Implement testDecrypt().
*/
public function testDecrypt()
{
$encryptPassword = 'password';
$encryptResponse = G::decrypt('6czY7OLU688','key');
}
/**
* @covers G::lookup
* @todo Implement testLookup().
*/
public function testLookup()
{
// @verify function
}
/**
* @covers G::mk_dir
* @todo Implement testMk_dir().
*/
public function testMk_dir()
{
$newDir = PATH_HOME.'test';
G::mk_dir($newDir);
$this->assertTrue(is_dir($newDir));
if ( is_dir($newDir) )
{
rmdir($newDir);
}
}
/**
* @covers G::rm_dir
* @todo Implement testRm_dir().
*/
public function testRm_dir()
{
/*
*
*@verify function does not work
$newDir = PATH_HOME.'test';
G::mk_dir($newDir);
if ( is_dir($newDir) )
{
G::rm_dir($newDir);
$this->assertFalse(is_dir($newDir));
}
*/
}
/**
* @covers G::verifyPath
* @todo Implement testVerifyPath().
*/
public function testVerifyPath()
{
$dirExist = PATH_HOME;
$this->assertTrue(G::verifyPath($dirExist));
$dirNoExist = PATH_HOME.'test';
if ( is_dir($dirNoExist) ) {
rmdir($dirNoExist);
}
$this->assertFalse(G::verifyPath($dirNoExist));
$dirNoExist = PATH_HOME.'test';
$this->assertFalse(G::verifyPath($dirNoExist,true));
$this->assertTrue(G::verifyPath($dirNoExist));
if ( is_dir($dirNoExist) ) {
rmdir($dirNoExist);
}
}
/**
* @covers G::expandPath
* @todo Implement testExpandPath().
*/
public function testExpandPath()
{
$valueResponse = G::expandPath('');
$this->assertEquals($valueResponse, PATH_CORE);
$valueResponse = G::expandPath('test');
$this->assertEquals($valueResponse, PATH_CORE . "test/");
}
/**
* @covers G::LoadSystem
* @todo Implement testLoadSystem().
*/
public function testLoadSystem()
{
G::LoadSystem("controller");
$this->assertTrue(class_exists('Controller'));
}
/**
* @covers G::LoadSystemExist
* @todo Implement testLoadSystemExist().
*/
public function testLoadSystemExist()
{
$this->assertTrue(G::LoadSystemExist("controller"));
$this->assertFalse(G::LoadSystemExist("noExist"));
}
/**
* @covers G::RenderPage
* @todo Implement testRenderPage().
*/
public function testRenderPage()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::LoadSkin
* @todo Implement testLoadSkin().
*/
public function testLoadSkin()
{
// @verify useless function
}
/**
* @covers G::LoadInclude
* @todo Implement testLoadInclude().
*/
public function testLoadInclude()
{
$this->assertTrue( G::LoadInclude('application') && class_exists('App') );
$this->assertTrue( G::LoadInclude('ajax') && function_exists('ajax_show_menu'));
$this->assertFalse( G::LoadInclude('test') );
}
/**
* @covers G::LoadAllModelClasses
* @todo Implement testLoadAllModelClasses().
*/
public function testLoadAllModelClasses()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::LoadAllPluginModelClasses
* @todo Implement testLoadAllPluginModelClasses().
*/
public function testLoadAllPluginModelClasses()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::LoadTemplate
* @todo Implement testLoadTemplate().
*/
public function testLoadTemplate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::LoadClassRBAC
* @todo Implement testLoadClassRBAC().
*/
public function testLoadClassRBAC()
{
/*
* @verify useless function
*/
}
/**
* @covers G::LoadClass
* @todo Implement testLoadClass().
*/
public function testLoadClass()
{
G::LoadClass('cli');
$this->assertTrue(class_exists('CLI'));
G::LoadClass('rbac');
$this->assertTrue(class_exists('RBAC'));
$this->assertFalse(G::LoadClass('noExist'));
}
/**
* @covers G::LoadThirdParty
* @todo Implement testLoadThirdParty().
*/
public function testLoadThirdParty()
{
G::LoadThirdParty('lime','lime');
$this->assertTrue(class_exists('lime_test'));
}
/**
* @covers G::encryptlink
* @todo Implement testEncryptlink().
*/
public function testEncryptlink()
{
$this->assertEquals(G::encryptlink('url'),'url');
define('ENABLE_ENCRYPT', 'yes');
$urlEncrypt = 'qNWc';
$this->assertEquals(G::encryptlink('url'),$urlEncrypt);
}
/**
* @covers G::parseURI
* @todo Implement testParseURI().
*/
public function testParseURI()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::strip_slashes
* @todo Implement testStrip_slashes().
*/
public function testStrip_slashes()
{
$stringTest = 'h\e\l\l\o';
$this->assertEquals(G::strip_slashes($stringTest),'hello');
$arrayTest = array('h\e\l\l\o', 'h\i' , 't\e\s\t');
$arrayResponse = G::strip_slashes($arrayTest);
$this->assertEquals($arrayResponse['0'],'hello');
$this->assertEquals($arrayResponse['1'],'hi');
$this->assertEquals($arrayResponse['2'],'test');
}
/**
* @covers G::logTimeByPage
* @todo Implement testLogTimeByPage().
*/
public function testLogTimeByPage()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::streamCSSBigFile
* @todo Implement testStreamCSSBigFile().
*/
public function testStreamCSSBigFile()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::streamJSTranslationFile
* @todo Implement testStreamJSTranslationFile().
*/
public function testStreamJSTranslationFile()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::streamFile
* @todo Implement testStreamFile().
*/
public function testStreamFile()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::trimSourceCodeFile
* @todo Implement testTrimSourceCodeFile().
*/
public function testTrimSourceCodeFile()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::sendHeaders
* @todo Implement testSendHeaders().
*/
public function testSendHeaders()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::virtualURI
* @todo Implement testVirtualURI().
*/
public function testVirtualURI()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::createUID
* @todo Implement testCreateUID().
*/
public function testCreateUID()
{
$uidTest001 = 'cDhpajRHQ2paUQ______';
$responseUID = G::createUID('test','001');
$this->assertEquals($responseUID, $uidTest001);
}
/**
* @covers G::getUIDName
* @todo Implement testGetUIDName().
*/
public function testGetUIDName()
{
$uidTest001 = 'cDhpajRHQ2paUQ______';
$responseUID = G::getUIDName($uidTest001);
$this->assertEquals($responseUID, 'test'.'001');
}
/**
* @covers G::formatNumber
* @todo Implement testFormatNumber().
*/
public function testFormatNumber()
{
$valueNum = 100;
$responseNum = G::formatNumber($valueNum);
$this->assertEquals($valueNum, $responseNum);
}
/**
* @covers G::formatDate
* @todo Implement testFormatDate().
*/
public function testFormatDate()
{
/*
* @verify function does not return the correct value in the variable F
*
*
*/
$valueFormatDate = Date('d j F m n y Y g G h H i s');
$stringDate = G::formatDate(Date("Y-m-d H:i:s"), 'd j F m n y Y g G h H i s', 'es');
//$this->assertEquals($valueFormatDate, $responseNum);
}
/**
* @covers G::getformatedDate
* @todo Implement testGetformatedDate().
*/
public function testGetformatedDate()
{
/*
* @verify function does not return the correct value in the variable F
*
*
*/
$valueFormatDate = Date('d j F m n y Y g G h H i s');
$stringDate = G::formatDate(Date("Y-m-d H:i:s"), 'd j F m n y Y g G h H i s', 'es');
//$this->assertEquals($valueFormatDate, $responseNum);
}
/**
* @covers G::arrayDiff
* @todo Implement testArrayDiff().
*/
public function testArrayDiff()
{
$arrayValues1 = array('value1', 'value2', 'value3', 'value4', 'value5', 'value6', 'value7', 'value8');
$arrayValues2 = array('value1', 'value2', 'value3', 'value4');
$arrayRes = G::arrayDiff($arrayValues1, $arrayValues2);
$this->assertEquals($arrayRes['0'], 'value5');
$this->assertEquals($arrayRes['1'], 'value6');
$this->assertEquals($arrayRes['2'], 'value7');
$this->assertEquals($arrayRes['3'], 'value8');
$arrayRes = G::arrayDiff($arrayValues2, $arrayValues1);
$this->assertEquals(count($arrayRes), 0);
}
/**
* @covers G::complete_field
* @todo Implement testComplete_field().
*/
public function testComplete_field()
{
$intTest1 = 145;
$valueResponse = G::complete_field($intTest1, 3, 1);
$this->assertEquals($valueResponse, '145');
$intTest1 = 145;
$valueResponse = G::complete_field($intTest1, 5, 1);
$this->assertEquals($valueResponse, '00145');
$intTest1 = 'test';
$valueResponse = G::complete_field($intTest1, 3, 2);
$this->assertEquals($valueResponse, 'test');
$intTest1 = 'test';
$valueResponse = G::complete_field($intTest1, 8, 2);
$this->assertEquals($valueResponse, ' test');
$intTest1 = 541;
$valueResponse = G::complete_field($intTest1, 3, 2);
$this->assertEquals($valueResponse, '541.');
$intTest1 = 541;
$valueResponse = G::complete_field($intTest1, 5, 2);
$this->assertEquals($valueResponse, '00541.');
$intTest1 = 541.45;
$valueResponse = G::complete_field($intTest1, 3, 2);
$this->assertEquals($valueResponse, '541.45');
$intTest1 = 541.45;
$valueResponse = G::complete_field($intTest1, 5, 2);
$this->assertEquals($valueResponse, '00541.45');
}
/**
* @covers G::sqlEscape
* @todo Implement testSqlEscape().
*/
public function testSqlEscape()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::MySQLSintaxis
* @todo Implement testMySQLSintaxis().
*/
public function testMySQLSintaxis()
{
//define('DB_ADAPTER', 'mysql');
$this->assertTrue(G::MySQLSintaxis());
}
/**
* @covers G::replaceDataField
* @todo Implement testReplaceDataField().
*/
public function testReplaceDataField()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::loadLanguageFile
* @todo Implement testLoadLanguageFile().
*/
public function testLoadLanguageFile()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::registerLabel
* @todo Implement testRegisterLabel().
*/
public function testRegisterLabel()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::LoadMenuXml
* @todo Implement testLoadMenuXml().
*/
public function testLoadMenuXml()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::SendMessageXml
* @todo Implement testSendMessageXml().
*/
public function testSendMessageXml()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::SendTemporalMessage
* @todo Implement testSendTemporalMessage().
*/
public function testSendTemporalMessage()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::SendMessage
* @todo Implement testSendMessage().
*/
public function testSendMessage()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::SendMessageText
* @todo Implement testSendMessageText().
*/
public function testSendMessageText()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::LoadMessage
* @todo Implement testLoadMessage().
*/
public function testLoadMessage()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::LoadXmlLabel
* @todo Implement testLoadXmlLabel().
*/
public function testLoadXmlLabel()
{
$response = 'xxxxxx';
$this->assertEquals(G::LoadXmlLabel('test'),'xxxxxx');
}
/**
* @covers G::LoadMessageXml
* @todo Implement testLoadMessageXml().
*/
public function testLoadMessageXml()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::LoadTranslationObject
* @todo Implement testLoadTranslationObject().
*/
public function testLoadTranslationObject()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::LoadTranslation
* @todo Implement testLoadTranslation().
*/
public function testLoadTranslation()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::getTranslations
* @todo Implement testGetTranslations().
*/
public function testGetTranslations()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::LoadArrayFile
* @todo Implement testLoadArrayFile().
*/
public function testLoadArrayFile()
{
$this->assertEquals(G::LoadArrayFile(),null);
}
/**
* @covers G::expandUri
* @todo Implement testExpandUri().
*/
public function testExpandUri()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::genericForceLogin
* @todo Implement testGenericForceLogin().
*/
public function testGenericForceLogin()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::capitalize
* @todo Implement testCapitalize().
*/
public function testCapitalize()
{
$name = 'brayan';
$this->assertEquals('Brayan',G::capitalize($name));
}
/**
* @covers G::toUpper
* @todo Implement testToUpper().
*/
public function testToUpper()
{
$name = 'brayan';
$this->assertEquals('BRAYAN',G::toUpper($name));
}
/**
* @covers G::toLower
* @todo Implement testToLower().
*/
public function testToLower()
{
$name = 'BRAYAN';
$this->assertEquals('brayan',G::toLower($name));
}
/**
* @covers G::http_build_query
* @todo Implement testHttp_build_query().
*/
public function testHttp_build_query()
{
$response = G::http_build_query(array('valor1','valor2'),'num','val');
$this->assertEquals('val[num0]=valor1&val[num1]=valor2', $response);
}
/**
* @covers G::header
* @todo Implement testHeader().
*/
public function testHeader()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::forceLogin
* @todo Implement testForceLogin().
*/
public function testForceLogin()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::add_slashes
* @todo Implement testAdd_slashes().
*/
public function testAdd_slashes()
{
// @verify : function not work
//$response = G::add_slashes('path\\dirc');
//$this->assertEquals($response,'\\test\\ ');
}
/**
* @covers G::uploadFile
* @todo Implement testUploadFile().
*/
public function testUploadFile()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::resizeImage
* @todo Implement testResizeImage().
*/
public function testResizeImage()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::array_merges
* @todo Implement testArray_merges().
*/
public function testArray_merges()
{
$arrayTest1 = array( 'camp1' => 'val1',
'camp2' => 'val2',
'camp3' => 'val3',
'camp4' => 'val4'
);
$arrayTest2 = array( 'camp1' => '1',
'camp2' => '2'
);
$arrayResponse = G::array_merges($arrayTest1, $arrayTest2);
$this->assertEquals($arrayResponse['camp1'],'1');
$this->assertEquals($arrayResponse['camp2'],'2');
$arrayResponse = G::array_merges($arrayTest2, $arrayTest1);
$this->assertEquals($arrayResponse['camp3'],'val3');
$this->assertEquals($arrayResponse['camp4'],'val4');
}
/**
* @covers G::array_merge_2
* @todo Implement testArray_merge_2().
*/
public function testArray_merge_2()
{
$arrayTest1 = array( 'camp1' => 'val1',
'camp2' => 'val2',
'camp3' => 'val3',
'camp4' => 'val4'
);
$arrayTest2 = array( 'camp1' => '1',
'camp2' => '2'
);
$arrayResponse = G::array_merge_2($arrayTest1, $arrayTest2);
$this->assertEquals($arrayTest1['camp1'],'1');
$this->assertEquals($arrayTest1['camp2'],'2');
$arrayResponse = G::array_merge_2($arrayTest2, $arrayTest1);
$this->assertEquals($arrayTest2['camp3'],'val3');
$this->assertEquals($arrayTest2['camp4'],'val4');
}
/**
* @covers G::generateUniqueID
* @todo Implement testGenerateUniqueID().
*/
public function testGenerateUniqueID()
{
$uid = G::generateUniqueID();
$this->assertTrue(is_string($uid) && (strlen($uid) == 32));
}
/**
* @covers G::generateCode
* @todo Implement testGenerateCode().
*/
public function testGenerateCode()
{
$uid = G::generateCode();
$this->assertTrue(is_numeric($uid) && (strlen($uid) == 4));
$uid = G::generateCode(10);
$this->assertTrue(is_numeric($uid) && (strlen($uid) == 10));
$uid = G::generateCode('ALPHA');
$this->assertTrue(is_string($uid) && (strlen($uid) == 4));
}
/**
* @covers G::verifyUniqueID
* @todo Implement testVerifyUniqueID().
*/
public function testVerifyUniqueID()
{
$uid = G::generateUniqueID();
$response = G::verifyUniqueID($uid);
$this->assertTrue($response);
}
/**
* @covers G::is_utf8
* @todo Implement testIs_utf8().
*/
public function testIs_utf8()
{
$this->assertTrue(G::is_utf8('árbol'));
$this->assertTrue(G::is_utf8('&aacute;rbol'));
}
/**
* @covers G::CurDate
* @todo Implement testCurDate().
*/
public function testCurDate()
{
$dateNow = Date('Y-m-d H:i:s');
$this->assertEquals($dateNow,G::CurDate());
$dateNow = Date('H:i:s');
$this->assertEquals($dateNow,G::CurDate('H:i:s'));
}
/**
* @covers G::getSystemConstants
* @todo Implement testGetSystemConstants().
*/
public function testGetSystemConstants()
{
$response = G::getSystemConstants();
$this->assertTrue(is_array($response));
}
/**
* @covers G::capitalizeWords
* @todo Implement testCapitalizeWords().
*/
public function testCapitalizeWords()
{
$response = G::capitalizeWords('brian real');
$this->assertEquals('Brian Real', $response);
}
/**
* @covers G::unhtmlentities
* @todo Implement testUnhtmlentities().
*/
public function testUnhtmlentities()
{
$response = G::unhtmlentities('&aacute;rbol');
$this->assertEquals($response, 'árbol');
}
/**
* @covers G::xmlParser
* @todo Implement testXmlParser().
*/
public function testXmlParser()
{
// conchalo : no file xml
}
/**
* @covers G::_del_p
* @todo Implement test_del_p().
*/
public function test_del_p()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::ary2xml
* @todo Implement testAry2xml().
*/
public function testAry2xml()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::ins2ary
* @todo Implement testIns2ary().
*/
public function testIns2ary()
{
$test = array('value1', 'value2');
G::ins2ary($test,'newValue',0);
$this->assertEquals($test['0'],'newValue');
$this->assertEquals($test['1'],'value1');
}
/**
* @covers G::evalJScript
* @todo Implement testEvalJScript().
*/
public function testEvalJScript()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::inflect
* @todo Implement testInflect().
*/
public function testInflect()
{
$this->assertEquals( G::inflect('àchélo'), 'achelo');
}
/**
* @covers G::pr
* @todo Implement testPr().
*/
public function testPr()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::dump
* @todo Implement testDump().
*/
public function testDump()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::stripCDATA
* @todo Implement testStripCDATA().
*/
public function testStripCDATA()
{
$this->assertEquals('value',G::stripCDATA('<![CDATA[value]]>'));
}
/**
* @covers G::sys_get_temp_dir
* @todo Implement testSys_get_temp_dir().
*/
public function testSys_get_temp_dir()
{
$tmpDir = G::sys_get_temp_dir();
$this->assertFileExists($tmpDir);
$this->assertTrue(is_writable($tmpDir));
}
/**
* @covers G::PMWSCompositeResponse
* @todo Implement testPMWSCompositeResponse().
*/
public function testPMWSCompositeResponse()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::emailAddress
* @todo Implement testEmailAddress().
*/
public function testEmailAddress()
{
$this->assertFalse(G::emailAddress('email'));
$response = G::emailAddress('test@email.com');
$this->assertEquals('test@email.com',$response->email);
$this->assertEquals('',$response->name);
$response = G::emailAddress('Person <test@email.com>');
//$this->assertEquals('test@email.com',$response->email);
//$this->assertEquals('',$response->name);
}
/**
* @covers G::json_encode
* @todo Implement testJson_encode().
*/
public function testJson_encode()
{
$arrayTest = array( 'pos1' => 'value1',
'pos2' => 'value2',
'pos3' => 'value3',
);
$response = G::json_encode($arrayTest);
$this->assertEquals('{"pos1":"value1","pos2":"value2","pos3":"value3"}',$response);
}
/**
* @covers G::json_decode
* @todo Implement testJson_decode().
*/
public function testJson_decode()
{
$jsonTest = '{"pos1":"value1","pos2":"value2","pos3":"value3"}';
$response = G::json_decode($jsonTest);
$this->assertEquals($response->pos1, 'value1');
$this->assertEquals($response->pos2, 'value2');
$this->assertEquals($response->pos3, 'value3');
}
/**
* @covers G::isHttpRequest
* @todo Implement testIsHttpRequest().
*/
public function testIsHttpRequest()
{
$response = G::isHttpRequest();
$this->assertFalse($response);
$_SERVER['SERVER_SOFTWARE'] = 'Apache/2.2.8 (CentOS)';
$response = G::isHttpRequest();
$this->assertTrue($response);
}
/**
* @covers G::sendMail
* @todo Implement testSendMail().
*/
public function testSendMail()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::envelopEmailAddresses
* @todo Implement testEnvelopEmailAddresses().
*/
public function testEnvelopEmailAddresses()
{
$dataAddresses = array( 'to' => 'test1@colosa.com',
'cc' => array( 'test2@colosa.com <Email Test2>',
'test3@colosa.com',
'test4@colosa.com'
),
'bcc'=> array( 'test5@colosa.com')
);
$response = G::envelopEmailAddresses($dataAddresses);
$this->assertEquals($response['to']['0']['0'], 'test1@colosa.com');
/*
$this->assertEquals($response['cc']['0']['0'], 'test2@colosa.com');
$this->assertEquals($response['cc']['0']['1'], 'test3@colosa.com');
$this->assertEquals($response['cc']['0']['2'], 'test4@colosa.com');
*/
$this->assertEquals($response['bcc']['0']['0'], 'test5@colosa.com');
}
/**
* @covers G::gettype
* @todo Implement testGettype().
*/
public function testGettype()
{
$value = NULL;
//$this->assertEquals(G::gettype($value),'NULL');
// Remove the following lines when you implement this test.
// function no work with null
$value = true;
$this->assertEquals(G::gettype($value),'boolean');
$value = 15.25;
$this->assertEquals(G::gettype($value),'double');
$value = 142;
$this->assertEquals(G::gettype($value),'integer');
$value = 'string';
$this->assertEquals(G::gettype($value),'string');
$value = array('val1', 'val2');
$this->assertEquals(G::gettype($value),'array');
$value = new stdClass();
$this->assertEquals(G::gettype($value),'object');
// need conexion BD is_resource
}
/**
* @covers G::removeComments
* @todo Implement testRemoveComments().
*/
public function testRemoveComments()
{
$value = 'code1 /* comment 1 */ code2 code3';
$response = G::removeComments($value);
$this->assertEquals('code1 code2 code3',$response);
}
/**
* @covers G::getMemoryUsage
* @todo Implement testGetMemoryUsage().
*/
public function testGetMemoryUsage()
{
$response = G::getMemoryUsage();
$mb = "Mb";
$this->assertTrue($response != '' && strpos($response, $mb));
}
/**
* @covers G::getFormatUserList
* @todo Implement testGetFormatUserList().
*/
public function testGetFormatUserList()
{
$aUserInfo['USR_USERNAME'] = 'fontiveros';
$aUserInfo['USR_FIRSTNAME'] = 'Fernando';
$aUserInfo['USR_LASTNAME'] = 'Ontiveros';
$response = G::getFormatUserList('@firstName @lastName', $aUserInfo);
$this->assertEquals('Fernando Ontiveros',$response);
$response = G::getFormatUserList('@firstName @lastName (@userName)', $aUserInfo);
$this->assertEquals('Fernando Ontiveros (fontiveros)',$response);
$response = G::getFormatUserList('@userName', $aUserInfo);
$this->assertEquals('fontiveros',$response);
$response = G::getFormatUserList('@userName (@firstName @lastName)', $aUserInfo);
$this->assertEquals('fontiveros (Fernando Ontiveros)',$response);
$response = G::getFormatUserList('@lastName @firstName', $aUserInfo);
$this->assertEquals('Ontiveros Fernando',$response);
$response = G::getFormatUserList('@lastName, @firstName', $aUserInfo);
$this->assertEquals('Ontiveros, Fernando',$response);
$response = G::getFormatUserList('@lastName, @firstName (@userName)', $aUserInfo);
$this->assertEquals('Ontiveros, Fernando (fontiveros)',$response);
$response = G::getFormatUserList('test', $aUserInfo);
$this->assertEquals('fontiveros',$response);
}
/**
* @covers G::getModel
* @todo Implement testGetModel().
*/
public function testGetModel()
{
/*
require_once PATH_TRUNK . 'gulliver' . PATH_SEP . 'thirparty' . PATH_SEP . 'propel' . PATH_SEP . 'Propel.php';
$model = 'AdditionalTables';
$additionalTables = G::getModel($model);
$this->assertTrue(is_object($additionalTables) && class_exists($model));
*/
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::is_rwritable
* @todo Implement testIs_rwritable().
*/
public function testIs_rwritable()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::rglob
* @todo Implement testRglob().
*/
public function testRglob()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::browser_detection
* @todo Implement testBrowser_detection().
*/
public function testBrowser_detection()
{
// $res = G::browser_detection('full_assoc');
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
// $this->assertEquals(is_array($res));
}
/**
* @covers G::get_os_data
* @todo Implement testGet_os_data().
*/
public function testGet_os_data()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::get_item_version
* @todo Implement testGet_item_version().
*/
public function testGet_item_version()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::get_set_count
* @todo Implement testGet_set_count().
*/
public function testGet_set_count()
{
$this->assertEquals(G::get_set_count('get'),1);
$this->assertEquals(G::get_set_count('set',0),'');
}
/**
* @covers G::check_is_mobile
* @todo Implement testCheck_is_mobile().
*/
public function testCheck_is_mobile()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::get_mobile_data
* @todo Implement testGet_mobile_data().
*/
public function testGet_mobile_data()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::getBrowser
* @todo Implement testGetBrowser().
*/
public function testGetBrowser()
{
//$this->assertTrue(is_array(G::getBrowser()));
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::script_time
* @todo Implement testScript_time().
*/
public function testScript_time()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::getDirectorySize
* @todo Implement testGetDirectorySize().
*/
public function testGetDirectorySize()
{
$path = PATH_TRUNK . 'gulliver' . PATH_SEP . "system";
$response = G::getDirectorySize($path);
$this->assertTrue(is_array($response) && count($response));
}
/**
* @covers G::getCacheFileNameByPattern
* @todo Implement testGetCacheFileNameByPattern().
*/
public function testGetCacheFileNameByPattern()
{
$response = G::getCacheFileNameByPattern(PATH_TRUNK . 'gulliver' . PATH_SEP . "system" . PATH_SEP . "class.g.php" ,'');
$this->assertTrue(is_array($response) && count($response));
}
/**
* @covers G::getCheckSum
* @todo Implement testGetCheckSum().
*/
public function testGetCheckSum()
{
$response = G::getCheckSum(PATH_TRUNK . 'gulliver' . PATH_SEP . "system" . PATH_SEP . "class.g.php");
$this->assertTrue(is_string($response));
}
/**
* @covers G::parse_ini_string
* @todo Implement testParse_ini_string().
*/
public function testParse_ini_string()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::disableEnableINIvariable
* @todo Implement testDisableEnableINIvariable().
*/
public function testDisableEnableINIvariable()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::setINIvariable
* @todo Implement testSetINIvariable().
*/
public function testSetINIvariable()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::write_php_ini
* @todo Implement testWrite_php_ini().
*/
public function testWrite_php_ini()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::verifyWriteAccess
* @todo Implement testVerifyWriteAccess().
*/
public function testVerifyWriteAccess()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::renderTemplate
* @todo Implement testRenderTemplate().
*/
public function testRenderTemplate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::parseTemplate
* @todo Implement testParseTemplate().
*/
public function testParseTemplate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::update_php_ini
* @todo Implement testUpdate_php_ini().
*/
public function testUpdate_php_ini()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers G::is_writable_r
* @todo Implement testIs_writable_r().
*/
public function testIs_writable_r()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}