本文整理汇总了PHP中lime_test::can_ok方法的典型用法代码示例。如果您正苦于以下问题:PHP lime_test::can_ok方法的具体用法?PHP lime_test::can_ok怎么用?PHP lime_test::can_ok使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lime_test
的用法示例。
在下文中一共展示了lime_test::can_ok方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strtolower
$className = strtolower(substr($className, 0, 1)) . substr($className, 1);
$reflect = new ReflectionClass($className);
$method = array();
$testItems = 0;
foreach ($reflect->getMethods() as $reflectmethod) {
$params = '';
foreach ($reflectmethod->getParameters() as $key => $row) {
if ($params != '') {
$params .= ', ';
}
$params .= '$' . $row->name;
}
$testItems++;
$methods[$reflectmethod->getName()] = $params;
}
//To change the case only the first letter of each word, TIA
$className = ucwords($className);
$t->diag("class {$className}");
$t->isa_ok($obj, "XMLDB", "class {$className} created");
$t->is(count($methods), 2, "class {$className} have " . 2 . ' methods.');
//checking method 'connect'
$t->can_ok($obj, 'connect', 'connect() is callable');
//$result = $obj->connect ( $dsn, $options);
//$t->isa_ok( $result, 'NULL', 'call to method connect ');
$t->todo("call to method connect using {$dsn}, {$options} ");
//checking method 'isError'
$t->can_ok($obj, 'isError', 'isError() is callable');
//$result = $obj->isError ( $result);
//$t->isa_ok( $result, 'NULL', 'call to method isError ');
$t->todo("call to method isError using {$result} ");
$t->todo('review all pendings methods in this class');
示例2: ucwords
if ($params != '') {
$params .= ', ';
}
$params .= '$' . $row->name;
}
$testItems++;
$methods[$reflectmethod->getName()] = $params;
}
//To change the case only the first letter of each word, TIA
$className = ucwords($className);
$t->diag("class {$className}");
$t->isa_ok($obj, "wsBase", "class {$className} created");
//$t->is( count($methods) , 26, "class $className have " . 26 . ' methods.' );
$t->is(count($methods), 28, "class {$className} have " . 28 . ' methods.');
//checking method '__construct'
$t->can_ok($obj, '__construct', '__construct() is callable');
//$result = $obj->__construct ( );
//$t->isa_ok( $result, 'NULL', 'call to method __construct ');
$t->todo("call to method __construct using ");
//checking method 'login'
$t->can_ok($obj, 'login', 'login() is callable');
//$result = $obj->login ( $userid, $password);
//$t->isa_ok( $result, 'NULL', 'call to method login ');
$t->todo("call to method login using {$userid}, {$password} ");
//checking method 'processList'
$t->can_ok($obj, 'processList', 'processList() is callable');
//$result = $obj->processList ( );
//$t->isa_ok( $result, 'NULL', 'call to method processList ');
$t->todo("call to method processList using ");
//checking method 'roleList'
$t->can_ok($obj, 'roleList', 'roleList() is callable');
示例3: Languages
require_once PATH_CORE . "config/databases.php";
G::LoadClass('languages');
$obj = new Languages($dbc);
$t = new lime_test(5, new lime_output_color());
$className = Languages;
$className = strtolower(substr($className, 0, 1)) . substr($className, 1);
$reflect = new ReflectionClass($className);
$method = array();
$testItems = 0;
foreach ($reflect->getMethods() as $reflectmethod) {
$params = '';
foreach ($reflectmethod->getParameters() as $key => $row) {
if ($params != '') {
$params .= ', ';
}
$params .= '$' . $row->name;
}
$testItems++;
$methods[$reflectmethod->getName()] = $params;
}
//To change the case only the first letter of each word, TIA
$className = ucwords($className);
$t->diag("class {$className}");
$t->isa_ok($obj, "languages", "class {$className} created");
$t->is(count($methods), 1, "class {$className} have " . 1 . ' methods.');
//checking method 'importLanguage'
$t->can_ok($obj, 'importLanguage', 'importLanguage() is callable');
//$result = $obj->importLanguage ( $sLanguageFile, $bXml);
//$t->isa_ok( $result, 'NULL', 'call to method importLanguage ');
$t->todo("call to method importLanguage using {$sLanguageFile}, {$bXml} ");
$t->todo('review all pendings methods in this class');
示例4: SwimlanesElements
Propel::init(PATH_CORE . 'config/databases.php');
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('error');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('dbtable');
G::LoadSystem('testTools');
require_once PATH_CORE . 'classes/model/SwimlanesElements.php';
$obj = new SwimlanesElements();
$t = new lime_test(7, new lime_output_color());
$t->diag('Class SwimlanesElements');
//class SwimlanesElements
$t->isa_ok($obj, 'SwimlanesElements', 'Class SwimlanesElements created!');
//method load
$t->can_ok($obj, 'load', 'load() is callable!');
//method create
$t->can_ok($obj, 'create', 'create() is callable!');
//method update
$t->can_ok($obj, 'update', 'update() is callable!');
//method remove
$t->can_ok($obj, 'remove', 'remove() is callable!');
//method getSwiEleText
$t->can_ok($obj, 'getSwiEleText', 'getSwiEleText() is callable!');
//method setSwiEleText
$t->can_ok($obj, 'setSwiEleText', 'setSwiEleText() is callable!');
/***** TEST CLASS SWIMLANESELEMENTS *****/
///////// INITIAL VALUES /////////
define('SYS_LANG', 'en');
//Test class
class SwimlanesElementsTest extends unitTest
示例5: exit
exit(201);
}
G::LoadThirdParty('pear/json', 'class.json');
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('xmlDocument');
$t = new lime_test(11, new lime_output_color());
$obj = new Xml_Node('name', 'type', 'value');
$method = array();
$testItems = 0;
$class_methods = get_class_methods('Xml_Node');
foreach ($class_methods as $method_name) {
$methods[$testItems] = $method_name;
$testItems++;
}
$t->diag('class Xml_Node');
$t->is($testItems, 8, "class Xml_Node " . $testItems . " methods.");
$t->isa_ok($obj, 'Xml_Node', 'class Xml_Node created');
$t->can_ok($obj, 'addAttribute', 'addAttribute()');
$t->can_ok($obj, 'addChildNode', 'addChildNode()');
$t->can_ok($obj, 'toTree', 'toTree()');
$t->can_ok($obj, 'findNode', 'findNode()');
$t->can_ok($obj, 'getXML', 'getXML()');
$obj = new Xml_document('name', 'type', 'value');
$t->diag('class Xml_document');
$t->isa_ok($obj, 'Xml_document', 'class Xml_document created');
$t->can_ok($obj, 'parseXmlFile', 'parseXmlFile()');
$t->can_ok($obj, 'getXML', 'getXML()');
$t->todo('review all pendings in this class');
示例6: count
*
*/
if (!defined('PATH_THIRDPARTY')) {
require_once $_SERVER['PWD'] . '/test/bootstrap/unit.php';
}
require_once PATH_THIRDPARTY . 'lime/lime.php';
define('G_ENVIRONMENT', G_TEST_ENV);
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('database_base');
$counter = 1;
$t = new lime_test(12, new lime_output_color());
$obj = new database_base();
$methods = get_class_methods('database_base');
$t->diag('class database_base');
/* Listing Method */
$t->isa_ok($obj, 'database_base', 'class database_base created');
$t->todo('Listing Method');
$t->is(count($methods), 8, "class database_base " . count($methods) . " methods.");
/* checking methods */
$t->can_ok($obj, '__construct', $counter++ . ' __construct()');
$t->can_ok($obj, 'generateDropTableSQL', $counter++ . ' generateDropTableSQL()');
$t->can_ok($obj, 'generateCreateTableSQL', $counter++ . ' generateCreateTableSQL()');
$t->can_ok($obj, 'generateDropColumnSQL', $counter++ . ' generateDropColumnSQL()');
$t->can_ok($obj, 'generateAddColumnSQL', $counter++ . ' generateAddColumnSQL()');
$t->can_ok($obj, 'generateChangeColumnSQL', $counter++ . ' generateChangeColumnSQL()');
$t->can_ok($obj, 'executeQuery', $counter++ . ' executeQuery()');
$t->can_ok($obj, 'close', $counter++ . ' close()');
$t->todo('Review, specific examples.');
示例7: foreach
foreach ($reflect->getMethods() as $reflectmethod) {
$params = '';
foreach ($reflectmethod->getParameters() as $key => $row) {
if ($params != '') {
$params .= ', ';
}
$params .= '$' . $row->name;
}
$testItems++;
$methods[$reflectmethod->getName()] = $params;
}
$t->diag('class $className');
$t->isa_ok($obj, 'Jrml', 'class $className created');
$t->is(count($methods), 8, "class {$className} have " . 8 . ' methods.');
//checking method '__construct'
$t->can_ok($obj, '__construct', '__construct() is callable');
//$result = $obj->__construct ( $data);
//$t->isa_ok( $result, 'NULL', 'call to method __construct ');
$t->todo("call to method __construct using {$data} ");
//checking method 'get_rows'
$t->can_ok($obj, 'get_rows', 'get_rows() is callable');
//$result = $obj->get_rows ( $a);
//$t->isa_ok( $result, 'NULL', 'call to method get_rows ');
$t->todo("call to method get_rows using {$a} ");
//checking method 'get_md'
$t->can_ok($obj, 'get_md', 'get_md() is callable');
//$result = $obj->get_md ( );
//$t->isa_ok( $result, 'NULL', 'call to method get_md ');
$t->todo("call to method get_md using ");
//checking method 'get_header'
$t->can_ok($obj, 'get_header', 'get_header() is callable');
示例8: foreach
$testItems = 0;
foreach ($reflect->getMethods() as $reflectmethod) {
$params = '';
foreach ($reflectmethod->getParameters() as $key => $row) {
if ($params != '') {
$params .= ', ';
}
$params .= '$' . $row->name;
}
$testItems++;
$methods[$reflectmethod->getName()] = $params;
}
$t->diag('class $className');
$t->isa_ok($obj, $className, 'class $className created');
$t->is(count($methods), 3, "class {$className} have " . 3 . ' methods.');
//checking method '__construct'
$t->can_ok($obj, '__construct', '__construct() is callable');
//$result = $obj->__construct ( $status, $message);
//$t->isa_ok( $result, 'NULL', 'call to method __construct ');
$t->todo("call to method __construct using {$status}, {$message} ");
//checking method 'getPayloadString'
$t->can_ok($obj, 'getPayloadString', 'getPayloadString() is callable');
//$result = $obj->getPayloadString ( $operation);
//$t->isa_ok( $result, 'NULL', 'call to method getPayloadString ');
$t->todo("call to method getPayloadString using {$operation} ");
//checking method 'getPayloadArray'
$t->can_ok($obj, 'getPayloadArray', 'getPayloadArray() is callable');
//$result = $obj->getPayloadArray ( );
//$t->isa_ok( $result, 'NULL', 'call to method getPayloadArray ');
$t->todo("call to method getPayloadArray using ");
$t->todo('review all pendings methods in this class');
示例9: foreach
$params = '';
foreach ($reflectmethod->getParameters() as $key => $row) {
if ($params != '') {
$params .= ', ';
}
$params .= '$' . $row->name;
}
$testItems++;
$methods[$reflectmethod->getName()] = $params;
}
//To change the case only the first letter of each word, TIA
//$className = ucwords($className);
$t->diag("class {$className}");
$t->isa_ok($obj, $className, "class {$className} created");
$t->is(count($methods), 3, "class {$className} have " . 3 . ' methods.');
//checking method '__construct'
$t->can_ok($obj, '__construct', '__construct() is callable');
//$result = $obj->__construct ( $db_spool);
//$t->isa_ok( $result, 'NULL', 'call to method __construct ');
$t->todo("call to method __construct using {$db_spool} ");
//checking method 'returnStatus'
$t->can_ok($obj, 'returnStatus', 'returnStatus() is callable');
//$result = $obj->returnStatus ( );
//$t->isa_ok( $result, 'NULL', 'call to method returnStatus ');
$t->todo("call to method returnStatus using ");
//checking method 'db_insert'
$t->can_ok($obj, 'db_insert', 'db_insert() is callable');
//$result = $obj->db_insert ( $db_spool);
//$t->isa_ok( $result, 'NULL', 'call to method db_insert ');
$t->todo("call to method db_insert using {$db_spool} ");
$t->todo('review all pendings methods in this class');
示例10: printf
global $G_ENVIRONMENTS;
if (isset($G_ENVIRONMENTS)) {
$dbfile = $G_ENVIRONMENTS[G_TEST_ENV]['dbfile'];
if (!file_exists($dbfile)) {
printf("%s \n", pakeColor::colorize("dbfile {$dbfile} doesn't exist for environment " . G_ENVIRONMENT, 'ERROR'));
exit(200);
} else {
include $dbfile;
}
} else {
exit(201);
}
require_once PATH_GULLIVER . 'class.dbconnection.php';
require_once PATH_GULLIVER . 'class.dbsession.php';
require_once PATH_GULLIVER . 'class.dbrecordset.php';
$dbc = new DBConnection();
$ses = new DBSession($dbc);
$dset = $ses->Execute("SELECT * from APPLICATION");
$method = array();
$testItems = 0;
$methods = get_class_methods('DBRecordSet');
$t = new lime_test(8, new lime_output_color());
$t->diag('class DBRecordset');
$t->is(count($methods), 6, "class G " . count($methods) . " methods.");
$t->isa_ok($dset, 'DBRecordSet', 'class DBRecordset created');
$t->can_ok($dset, 'SetTo', 'SetTo()');
$t->can_ok($dset, 'Free', 'Free()');
$t->can_ok($dset, 'Count', 'Count()');
$t->can_ok($dset, 'Read', 'Read()');
$t->can_ok($dset, 'ReadAbsolute', 'ReadAbsolute()');
$t->todo('review all pendings in this class');
示例11: exit
}
} else {
exit(201);
}
G::LoadThirdParty('pear/json', 'class.json');
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('menu');
$obj = new Menu();
$counter = 1;
$method = get_class_methods('Menu');
print_r($class_methods);
$t = new lime_test(15, new lime_output_color());
$t->diag('class Menu');
$t->is(count($method), 11, "class Menu " . count($method) . " methods.");
$t->isa_ok($obj, 'Menu', 'class Menu created');
$t->can_ok($obj, 'SetClass', $counter++ . ' SetClass()');
$t->can_ok($obj, 'Load', $counter++ . ' Load()');
$t->can_ok($obj, 'OptionCount', $counter++ . ' OptionCount()');
$t->can_ok($obj, 'AddOption', $counter++ . ' AddOption()');
$t->can_ok($obj, 'AddIdOption', $counter++ . ' AddIdOption()');
$t->can_ok($obj, 'AddRawOption', $counter++ . ' AddRawOption()');
$t->can_ok($obj, 'AddIdRawOption', $counter++ . ' AddIdRawOption()');
$t->can_ok($obj, 'DisableOptionPos', $counter++ . ' DisableOptionPos()');
$t->can_ok($obj, 'DisableOptionId', $counter++ . ' DisableOptionId()');
$t->can_ok($obj, 'RenderOption', $counter++ . ' RenderOption()');
$t->can_ok($obj, 'generateArrayForTemplate', $counter++ . ' generateArrayForTemplate()');
$t->is(count($method), --$counter, " methods ");
$t->todo('review all pendings in this class');
示例12: printf
printf("%s \n", pakeColor::colorize("dbfile {$dbfile} doesn't exist for environment " . G_ENVIRONMENT, 'ERROR'));
exit(200);
} else {
include $dbfile;
}
} else {
exit(201);
}
G::LoadThirdParty('pear/json', 'class.json');
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('tree');
$t = new lime_test(7, new lime_output_color());
$obj = new Tree(array('name' => 'value'));
$method = array();
$testItems = 0;
$class_methods = get_class_methods('Tree');
foreach ($class_methods as $method_name) {
$methods[$testItems] = $method_name;
$testItems++;
}
$t->diag('class Tree');
$t->is($testItems, 14, "class Tree " . $testItems . " methods.");
$t->isa_ok($obj, 'Tree', 'class Tree created');
$t->can_ok($obj, 'addChild', 'addChild()');
$t->can_ok($obj, 'printPlus', 'printPlus()');
$t->can_ok($obj, 'printContent', 'printContent()');
$t->can_ok($obj, 'render', 'render()');
$t->todo('review all pendings in this class');
示例13: Route
Propel::init(PATH_CORE . 'config/databases.php');
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('error');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('dbtable');
G::LoadSystem('testTools');
require_once PATH_CORE . 'classes/model/Route.php';
$obj = new Route();
$t = new lime_test(13, new lime_output_color());
$t->diag('Class Route');
//class Route
$t->isa_ok($obj, 'Route', 'Class Route created!');
//method load
$t->can_ok($obj, 'load', 'load() is callable!');
//method create
$t->can_ok($obj, 'create', 'create() is callable!');
//method update
$t->can_ok($obj, 'update', 'update() is callable!');
//method remove
$t->can_ok($obj, 'remove', 'remove() is callable!');
/***** TEST CLASS ROUTE *****/
///////// INITIAL VALUES /////////
define('SYS_LANG', 'en');
//Test class
class RouteTest extends unitTest
{
function loadTest($aTestData, $aFields)
{
$oRoute = new Route();
示例14: printf
global $G_ENVIRONMENTS;
if (isset($G_ENVIRONMENTS)) {
$dbfile = $G_ENVIRONMENTS[G_TEST_ENV]['dbfile'];
if (!file_exists($dbfile)) {
printf("%s \n", pakeColor::colorize("dbfile {$dbfile} doesn't exist for environment " . G_ENVIRONMENT, 'ERROR'));
exit(200);
} else {
include $dbfile;
}
} else {
exit(201);
}
G::LoadThirdParty('pear/json', 'class.json');
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('rbac');
$method = array();
$method = get_class_methods('RBAC');
$t = new lime_test(8, new lime_output_color());
$obj =& RBAC::getSingleton();
$t->diag('class RBAC');
$t->is(count($method), 46, "class RBAC " . count($method) . " methods.");
$t->isa_ok($obj, 'RBAC', 'class RBAC created');
$t->can_ok($obj, 'VerifyLogin', 'VerifyLogin()');
$t->can_ok($obj, 'userCanAccess', 'userCanAccess()');
$t->can_ok($obj, 'load', 'load()');
$t->can_ok($obj, 'createUser', 'createUser()');
$t->can_ok($obj, 'listAllRoles', 'listAllRoles()');
$t->todo('review all pendings in this class');
示例15: DBConnection
G::LoadSystem('dbconnection');
G::LoadSystem('dbsession');
G::LoadSystem('dbrecordset');
G::LoadSystem('dbtable');
G::LoadSystem('testTools');
//G::LoadClass ( 'task');
require_once PATH_CORE . '/classes/model/Task.php';
require_once PATH_CORE . "config/databases.php";
$dbc = new DBConnection();
$ses = new DBSession($dbc);
$obj = new Task($dbc);
$t = new lime_test(11, new lime_output_color());
$t->diag('class Task');
$t->isa_ok($obj, 'Task', 'class Task created');
//method load
$t->can_ok($obj, 'load', 'load() is callable');
//method save
$t->can_ok($obj, 'update', 'update() is callable');
//method delete
$t->can_ok($obj, 'delete', 'delete() is callable');
//method create
$t->can_ok($obj, 'create', 'create() is callable');
class TaskTest extends UnitTest
{
function CreateTask($data, $fields)
{
try {
$task = new Task();
$result = $task->create($fields);
$this->domain->addDomainValue('CREATED', $task->getTasUid());
return $result;