G::LoadClass('pmScript'); require_once PATH_CORE . "config/databases.php"; $dbc = new DBConnection(); $ses = new DBSession($dbc); $obj = new PmScript($dbc); $t = new lime_test(7, new lime_output_color()); $t->diag('class PmScript'); $t->isa_ok($obj, 'PMScript', 'class PmScript created'); //method setFields $t->can_ok($obj, 'setFields', 'setFields() is callable'); // $result = $obj->setFields ( $aFields); // $t->isa_ok( $result, 'NULL', 'call to method setFields '); //method setScript $t->can_ok($obj, 'setScript', 'setScript() is callable'); // $result = $obj->setScript ( $sScript); // $t->isa_ok( $result, 'NULL', 'call to method setScript '); //method validSyntax $t->can_ok($obj, 'validSyntax', 'validSyntax() is callable'); // $result = $obj->validSyntax ( $sScript); // $t->isa_ok( $result, 'NULL', 'call to method validSyntax '); //method execute $t->can_ok($obj, 'execute', 'execute() is callable'); // $result = $obj->execute ( ); // $t->isa_ok( $result, 'NULL', 'call to method execute '); //method evaluate $t->can_ok($obj, 'evaluate', 'evaluate() is callable'); // $result = $obj->evaluate ( ); // $t->isa_ok( $result, 'NULL', 'call to method evaluate '); // $t->fail( 'review all pendings methods in this class'); $t->todo("review all pendings methods in this class");
sfYaml::setSpecVersion('1.1'); $t = new lime_test(150); $parser = new sfYamlParser(); $path = __DIR__ . '/fixtures'; $files = $parser->parse(file_get_contents($path . '/index.yml')); foreach ($files as $file) { $t->diag($file); $yamls = file_get_contents($path . '/' . $file . '.yml'); // split YAMLs documents foreach (preg_split('/^---( %YAML\\:1\\.0)?/m', $yamls) as $yaml) { if (!$yaml) { continue; } $test = $parser->parse($yaml); if (isset($test['todo']) && $test['todo']) { $t->todo($test['test']); } else { $expected = var_export(eval('return ' . trim($test['php']) . ';'), true); $t->is(var_export($parser->parse($test['yaml']), true), $expected, $test['test']); } } } // test tabs in YAML $yamls = array("foo:\n\tbar", "foo:\n \tbar", "foo:\n\t bar", "foo:\n \t bar"); foreach ($yamls as $yaml) { try { $content = $parser->parse($yaml); $t->fail('YAML files must not contain tabs'); } catch (InvalidArgumentException $e) { $t->pass('YAML files must not contain tabs'); }
* This program 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ 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('pagedTable'); $t = new lime_test(2, new lime_output_color()); $obj = "pagedTable"; $method = array(); $testItems = 0; $method = get_class_methods('pagedTable'); $t->diag('class pagedTable'); $t->is(count($method), 10, "class pagedTable " . $testItems . " methods."); $t->todo('review all pendings in this class');
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), 8, "class {$className} have " . 8 . ' methods.'); //checking method '__construct' $t->can_ok($obj, '__construct', '__construct() is callable'); //$result = $obj->__construct ( $fileData); //$t->isa_ok( $result, 'NULL', 'call to method __construct '); $t->todo("call to method __construct using {$fileData} "); //checking method 'returnHeader' $t->can_ok($obj, 'returnHeader', 'returnHeader() is callable'); //$result = $obj->returnHeader ( ); //$t->isa_ok( $result, 'NULL', 'call to method returnHeader '); $t->todo("call to method returnHeader using "); //checking method 'returnBody' $t->can_ok($obj, 'returnBody', 'returnBody() is callable'); //$result = $obj->returnBody ( ); //$t->isa_ok( $result, 'NULL', 'call to method returnBody '); $t->todo("call to method returnBody using "); //checking method 'returnErrors' $t->can_ok($obj, 'returnErrors', 'returnErrors() is callable'); //$result = $obj->returnErrors ( $error); //$t->isa_ok( $result, 'NULL', 'call to method returnErrors '); $t->todo("call to method returnErrors using {$error} ");
if ($params != '') { $params .= ', '; } $params .= '$' . $row->name; } $testItems++; $methods[$reflectmethod->getName()] = $params; } $t->diag('class $className'); $t->isa_ok($obj, 'Report', 'class $className created'); $t->is(count($methods), 14, "class {$className} have " . 14 . ' methods.'); //checking method 'generatedReport1' $t->can_ok($obj, 'generatedReport1', 'generatedReport1() is callable'); //$result = $obj->generatedReport1 ( ); //$t->isa_ok( $result, 'NULL', 'call to method generatedReport1 '); $t->todo("call to method generatedReport1 using "); //checking method 'generatedReport1_filter' $t->can_ok($obj, 'generatedReport1_filter', 'generatedReport1_filter() is callable'); //$result = $obj->generatedReport1_filter ( $from, $to, $startedby); //$t->isa_ok( $result, 'NULL', 'call to method generatedReport1_filter '); $t->todo("call to method generatedReport1_filter using {$from}, {$to}, {$startedby} "); //checking method 'descriptionReport1' $t->can_ok($obj, 'descriptionReport1', 'descriptionReport1() is callable'); //$result = $obj->descriptionReport1 ( $PRO_UID); //$t->isa_ok( $result, 'NULL', 'call to method descriptionReport1 '); $t->todo("call to method descriptionReport1 using {$PRO_UID} "); //checking method 'generatedReport2' $t->can_ok($obj, 'generatedReport2', 'generatedReport2() is callable'); //$result = $obj->generatedReport2 ( ); //$t->isa_ok( $result, 'NULL', 'call to method generatedReport2 '); $t->todo("call to method generatedReport2 using ");
<?php /* * This file is part of the symfony package. * (c) 2004-2006 Fabien Potencier <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ require_once dirname(__FILE__) . '/../../bootstrap/unit.php'; require_once dirname(__FILE__) . '/../../../lib/helper/NumberHelper.php'; $t = new lime_test(10); // format_number() $t->diag('format_number()'); $t->is(format_number(10012.1, 'en'), '10,012.1', 'format_number() takes a number as its first argument'); //$t->is(format_number(10012.1, 'fr'), '10.012,1', 'format_number() takes a culture as its second argument'); $t->todo('format_number() takes the current user culture if no second argument is given'); // format_currency() $t->is(format_currency(1200000.0, 'USD', 'en'), '$1,200,000.00', 'format_currency() takes a number as its first argument'); $t->is(format_currency(1200000.1, 'USD', 'en'), '$1,200,000.10', 'format_currency() takes a number as its first argument'); $t->is(format_currency(1200000.1, 'USD', 'en'), '$1,200,000.10', 'format_currency() takes a number as its first argument'); $t->is(format_currency(1200000.101, 'USD', 'en'), '$1,200,000.10', 'format_currency() takes a number as its first argument'); $t->is(format_currency('1200000', 'USD', 'en'), '$1,200,000.00', 'format_currency() takes a number as its first argument'); $t->is(format_currency('11.50999', 'USD', 'en'), '$11.50', 'format_currency() takes a number as its first argument'); $t->is(format_currency('11.50999', 'EUR', 'fr'), '11,50 €', 'format_currency() takes a number as its first argument'); $t->is(format_currency('11.9999464', 'EUR', 'fr'), '11,99 €', 'format_currency() takes a number as its first argument');
$t->is(checkbox_tag('name', null, false, array('class' => 'foo')), '<input type="checkbox" name="name" id="name" value="" class="foo" />', 'checkbox_tag() takes an array of attribute options as its fourth argument'); $t->is(checkbox_tag('name', null, false, array('id' => 'foo')), '<input type="checkbox" name="name" id="foo" value="" />', 'checkbox_tag() can override the "id" attribute'); // radiobutton_tag() $t->diag('radiobutton_tag()'); $t->is(radiobutton_tag('name', 1), '<input type="radio" name="name" id="name_1" value="1" />', 'radiobutton_tag() takes a name as its first argument'); $t->is(radiobutton_tag('name', 2), '<input type="radio" name="name" id="name_2" value="2" />', 'radiobutton_tag() takes a value as its second argument'); $t->is(radiobutton_tag('name', null, true), '<input type="radio" name="name" id="name" value="" checked="checked" />', 'radiobutton_tag() takes a boolean as its third argument'); // options $t->is(radiobutton_tag('name', null, false, array('class' => 'foo')), '<input type="radio" name="name" id="name" value="" class="foo" />', 'radiobutton_tag() takes an array of attribute options as its fourth argument'); $t->is(radiobutton_tag('name', null, false, array('id' => 'foo')), '<input type="radio" name="name" id="foo" value="" />', 'radiobutton_tag() can override the "id" attribute'); // input_date_range_tag() $t->diag('input_date_range_tag()'); $t->unlike(input_date_range_tag('date', array('from' => time(), 'to' => time()), array('after' => 'foo')), '/after/', 'input_date_range_tag() output date fields for a date range'); // input_date_tag() $t->diag('input_date_tag()'); $t->todo('input_date_tag()'); // submit_tag() $t->diag('submit_tag()'); $t->is(submit_tag(), '<input type="submit" name="commit" value="Save changes" />', 'submit_tag() default value is "Save changes"'); $t->is(submit_tag("save"), '<input type="submit" name="commit" value="save" />', 'submit_tag() takes a value as its first argument'); // options $t->is(submit_tag('save', array('class' => 'foo')), '<input type="submit" name="commit" value="save" class="foo" />', 'submit_tag() takes an array of attribute options as its second argument'); $t->is(submit_tag('save', array('name' => 'foo')), '<input type="submit" name="foo" value="save" />', 'submit_tag() can override the "name" attribute'); // reset_tag() $t->diag('reset_tag()'); $t->is(reset_tag(), '<input type="reset" name="reset" value="Reset" />', 'reset_tag() default value is "Reset"'); $t->is(reset_tag("save"), '<input type="reset" name="reset" value="save" />', 'reset_tag() takes a value as its first argument'); // options $t->is(reset_tag('save', array('class' => 'foo')), '<input type="reset" name="reset" value="save" class="foo" />', 'reset_tag() takes an array of attribute options as its second argument'); $t->is(reset_tag('save', array('name' => 'foo')), '<input type="reset" name="foo" value="save" />', 'reset_tag() can override the "name" attribute'); // submit_image_tag()
if ($params != '') { $params .= ', '; } $params .= '$' . $row->name; } $testItems++; $methods[$reflectmethod->getName()] = $params; } $t->diag('$className'); $t->isa_ok($obj, 'Installer', 'class $className created'); $t->is(count($methods), 16, "class {$className} have " . 16 . ' 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 'create_site' $t->can_ok($obj, 'create_site', 'create_site() is callable'); //$result = $obj->create_site ( $config, $confirmed); //$t->isa_ok( $result, 'NULL', 'call to method create_site '); $t->todo("call to method create_site using {$config}, {$confirmed} "); //checking method 'isset_site' $t->can_ok($obj, 'isset_site', 'isset_site() is callable'); //$result = $obj->isset_site ( $name); //$t->isa_ok( $result, 'NULL', 'call to method isset_site '); $t->todo("call to method isset_site using {$name} "); //checking method 'create_site_test' $t->can_ok($obj, 'create_site_test', 'create_site_test() is callable'); //$result = $obj->create_site_test ( ); //$t->isa_ok( $result, 'NULL', 'call to method create_site_test '); $t->todo("call to method create_site_test using ");
exit(201); } require_once PATH_GULLIVER . 'class.dbconnection.php'; require_once PATH_GULLIVER . 'class.error.php'; $obj = new G_Error(); $method = array(); $testItems = 0; $class_methods = get_class_methods('G_Error'); foreach ($class_methods as $method_name) { $methods[$testItems] = $method_name; $testItems++; } $t = new lime_test(11, new lime_output_color()); $t->diag('class error'); // $t->is($testItems, 13, "class G_Error " . 13 . " methods."); $t->isa_ok($obj, 'G_Error', 'class G_Error created'); $t->is(G_ERROR, -100, 'G_ERROR constant defined'); $t->is(G_ERROR_ALREADY_ASSIGNED, -118, 'G_ERROR_ALREADY_ASSIGNED defined'); $obj = new G_Error("string"); $t->is($obj->code, -1, 'default code error'); $t->is($obj->message, "G Error: string", 'default message error'); $t->is($obj->level, E_USER_NOTICE, 'default level error'); $obj = new G_Error(G_ERROR_SYSTEM_UID); $t->is($obj->code, -105, 'code error'); $t->is($obj->message, "G Error: ", 'message error'); $t->can_ok($obj, "errorMessage", "exists method errorMessage"); $msg = $obj->errorMessage(G_ERROR); //$t->is( $msg->code, -100, 'fail in method errorMessage'); $t->todo('fail in method errorMessage');
$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');
$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');
$t->pass('restart() reinitializes the browser history'); } $t->is($b->getResponseText(), '', 'restart() reinitializes the response'); /*************/ /* Redirects */ /*************/ $t->diag('Redirects'); $b = new sfWebBrowser(array(), $adapter); $b->get('http://www.symfony-project.com/trac/wiki/sfUJSPlugin'); $t->like($b->getResponseText(), '/learn more about the unobtrusive approach/', 'follows 302 redirect after a GET'); $b = new myTestWebBrowser(array(), $adapter); $b->call($askeet_params['url'] . '/index.php/login', 'POST', array('nickname' => $askeet_params['login'], 'password' => $askeet_params['password'])); //$t->like($b->getResponseText(), '/url='.preg_quote($askeet_params['url'], '/').'\/index\.php/', 'does NOT follow a 302 redirect after a POST'); $t->like($b->getResponseText(), '/featured questions/', 'follows 302 redirect after POST ****** DESPITE THE HTTP SPEC ******'); $t->is($b->getRequestMethod(), 'GET', 'request method is changed to GET after POST for 302 redirect ***** DESPITE THE HTTP SPEC *****'); $t->todo('request method is changed to GET after POST for 303 redirect'); /***********/ /* Cookies */ /***********/ $t->diag('Cookies'); if ($adapter == 'sfCurlAdapter') { $b = new sfWebBrowser(array(), $adapter, array('cookies' => true, 'cookies_file' => $cookies_file, 'cookies_dir' => $cookies_dir)); $b->call($askeet_params['url'] . '/login', 'POST', array('nickname' => $askeet_params['login'], 'password' => $askeet_params['password'])); $t->like($b->getResponseBody(), '/' . $askeet_params['login'] . ' profile/', 'Cookies can be added to the request'); rmdir($cookies_dir); rmdir(dirname(__FILE__) . '/../data'); } else { $t->todo('Cookies can be added to the request (sfCurlAdapter only for now)'); } /****************/ /* File Uploads */
$ConLang = $fields['CON_LANG']; $ConValue = $fields['CON_VALUE']; try { $res = $obj->addContent($ConCategory, $ConParent, $ConId, $ConLang, $ConValue); } catch (Exception $e) { return $e; } return $res; } } $obj = new Content(); //$t = new lime_test( 5, new lime_output_color() ); $t = new lime_test(12, new lime_output_color()); $t->diag('class Content'); $t->isa_ok($obj, 'Content', 'class Content created'); $t->todo('review all combinations of is_utf8 '); $t->todo('review is_utf8 should be in another class'); //Initialize the global domain (It is optional) $testDomain = new ymlDomain(); $test = new ContentTest('content.yml', $t, $testDomain); //check if an row exists, $test->load('loadContent'); $test->runSingle(); //check if an row exists, $test->load('deleteContent'); $test->runAll(); $test->load('addContentAcentos'); $test->runSingle(); //add the same row twice, the first time goes good, but the second the class throw an error $test->load('addContent1'); $test->runSingle();
$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');
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'); //$result = $obj->get_header ( ); //$t->isa_ok( $result, 'NULL', 'call to method get_header '); $t->todo("call to method get_header using ");
$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, $className, "class {$className} created"); //$t->is( count($methods) , 2, "class $className have " . 2 . ' methods.' ); $t->is(count($methods), 7, "class {$className} have " . 7 . ' methods.'); //checking method 'getSessionUser' $t->can_ok($obj, 'getSessionUser', 'getSessionUser() is callable'); //$result = $obj->getSessionUser ( $sSessionId); //$t->isa_ok( $result, 'NULL', 'call to method getSessionUser '); $t->todo("call to method getSessionUser using {$sSessionId} "); //checking method 'verifySession' $t->can_ok($obj, 'verifySession', 'verifySession() is callable'); //$result = $obj->verifySession ( $sSessionId); //$t->isa_ok( $result, 'NULL', 'call to method verifySession '); $t->todo("call to method verifySession using {$sSessionId} "); $t->todo('review all pendings methods in this class');
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), 12, "class {$className} have " . 12 . ' methods.'); //checking method 'archive' $t->can_ok($obj, 'archive', 'archive() is callable'); //$result = $obj->archive ( $name); //$t->isa_ok( $result, 'NULL', 'call to method archive '); $t->todo("call to method archive using {$name} "); //checking method 'set_options' $t->can_ok($obj, 'set_options', 'set_options() is callable'); //$result = $obj->set_options ( $options); //$t->isa_ok( $result, 'NULL', 'call to method set_options '); $t->todo("call to method set_options using {$options} "); //checking method 'create_archive' $t->can_ok($obj, 'create_archive', 'create_archive() is callable'); //$result = $obj->create_archive ( ); //$t->isa_ok( $result, 'NULL', 'call to method create_archive '); $t->todo("call to method create_archive using "); //checking method 'add_data' $t->can_ok($obj, 'add_data', 'add_data() is callable'); //$result = $obj->add_data ( $data); //$t->isa_ok( $result, 'NULL', 'call to method add_data '); $t->todo("call to method add_data using {$data} ");
} $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), 14, "class {$className} have " . 14 . ' methods.'); //checking method 'getFieldnames' $t->can_ok($obj, 'getFieldnames', 'getFieldnames() is callable'); //$result = $obj->getFieldnames ( $classname, $type); //$t->isa_ok( $result, 'NULL', 'call to method getFieldnames '); $t->todo("call to method getFieldnames using {$classname}, {$type} "); //checking method 'translateFieldname' $t->can_ok($obj, 'translateFieldname', 'translateFieldname() is callable'); //$result = $obj->translateFieldname ( $classname, $fieldname, $fromType, $toType); //$t->isa_ok( $result, 'NULL', 'call to method translateFieldname '); $t->todo("call to method translateFieldname using {$classname}, {$fieldname}, {$fromType}, {$toType} "); //checking method 'doDelete' $t->can_ok($obj, 'doDelete', 'doDelete() is callable'); //$result = $obj->doDelete ( $criteria, $con); //$t->isa_ok( $result, 'NULL', 'call to method doDelete '); $t->todo("call to method doDelete using {$criteria}, {$con} "); //checking method 'doDeleteAll' $t->can_ok($obj, 'doDeleteAll', 'doDeleteAll() is callable'); //$result = $obj->doDeleteAll ( $tableName, $con); //$t->isa_ok( $result, 'NULL', 'call to method doDeleteAll '); $t->todo("call to method doDeleteAll using {$tableName}, {$con} ");
$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, 'JavaBridgePM', 'class $className created'); $t->is(count($methods), 3, "class {$className} have " . 3 . ' methods.'); //checking method 'checkJavaExtension' $t->can_ok($obj, 'checkJavaExtension', 'checkJavaExtension() is callable'); //$result = $obj->checkJavaExtension ( ); //$t->isa_ok( $result, 'NULL', 'call to method checkJavaExtension '); $t->todo("call to method checkJavaExtension using "); //checking method 'convertValue' $t->can_ok($obj, 'convertValue', 'convertValue() is callable'); //$result = $obj->convertValue ( $value, $className); //$t->isa_ok( $result, 'NULL', 'call to method convertValue '); $t->todo("call to method convertValue using {$value}, {$className} "); //checking method 'generateJrxmlFromDynaform' $t->can_ok($obj, 'generateJrxmlFromDynaform', 'generateJrxmlFromDynaform() is callable'); //$result = $obj->generateJrxmlFromDynaform ( $outDocUid, $dynaformUid, $template); //$t->isa_ok( $result, 'NULL', 'call to method generateJrxmlFromDynaform '); $t->todo("call to method generateJrxmlFromDynaform using {$outDocUid}, {$dynaformUid}, {$template} "); $t->todo('review all pendings methods in this class');
//checking method 'getAllObjectsFromProcess' $t->is ( $aMethods[66], 'getAllObjectsFromProcess', 'getAllObjectsFromProcess() is callable' ); //$result = $obj->getAllObjectsFromProcess ( $PRO_UID, $OBJ_TYPE); //$t->isa_ok( $result, 'NULL', 'call to method getAllObjectsFromProcess '); $t->todo( "call to method getAllObjectsFromProcess using $PRO_UID, $OBJ_TYPE "); //checking method 'executeTriggersAfterExternal' $t->is ( $aMethods[67], 'executeTriggersAfterExternal', 'executeTriggersAfterExternal() is callable' ); //$result = $obj->executeTriggersAfterExternal ( $sProcess, $sTask, $sApplication, $iIndex, $iStepPosition, $aNewData); //$t->isa_ok( $result, 'NULL', 'call to method executeTriggersAfterExternal '); $t->todo( "call to method executeTriggersAfterExternal using $sProcess, $sTask, $sApplication, $iIndex, $iStepPosition, $aNewData "); //checking method 'thisIsTheCurrentUser' $t->is ( $aMethods[68], 'thisIsTheCurrentUser', 'thisIsTheCurrentUser() is callable' ); //$result = $obj->thisIsTheCurrentUser ( $sApplicationUID, $iIndex, $sUserUID, $sAction, $sURL); //$t->isa_ok( $result, 'NULL', 'call to method thisIsTheCurrentUser '); $t->todo( "call to method thisIsTheCurrentUser using $sApplicationUID, $iIndex, $sUserUID, $sAction, $sURL "); //checking method 'getCriteriaUsersCases' $t->is ( $aMethods[69], 'getCriteriaUsersCases', 'getCriteriaUsersCases() is callable' ); //$result = $obj->getCriteriaUsersCases ( $status, $USR_UID); //$t->isa_ok( $result, 'NULL', 'call to method getCriteriaUsersCases '); $t->todo( "call to method getCriteriaUsersCases using $status, $USR_UID "); //checking method 'getAdvancedSearch' $t->is ( $aMethods[70], 'getAdvancedSearch', 'getAdvancedSearch() is callable' ); //$result = $obj->getAdvancedSearch ( $sCase, $sProcess, $sTask, $sCurrentUser, $sSentby, $sLastModFrom, $sLastModTo, $sStatus, $permisse, $userlogged, $aSupervisor); //$t->isa_ok( $result, 'NULL', 'call to method getAdvancedSearch '); */ $t->todo("call to method getAdvancedSearch using {$sCase}, {$sProcess}, {$sTask}, {$sCurrentUser}, {$sSentby}, {$sLastModFrom}, {$sLastModTo}, {$sStatus}, {$permisse}, {$userlogged}, {$aSupervisor} "); $t->todo('review all pendings methods in this class');
$t = new lime_test(47, new lime_output_color()); class MySessionStorage extends sfSessionTestStorage { public function regenerate($destroy = false) { $this->sessionId = rand(1, 9999); return true; } } $dispatcher = new sfEventDispatcher(); $sessionPath = sfToolkit::getTmpDir() . '/sessions_' . rand(11111, 99999); $storage = new MySessionStorage(array('session_path' => $sessionPath)); $user = new sfBasicSecurityUser($dispatcher, $storage); // ->initialize() $t->diag('->initialize()'); $t->todo('->initialize() times out the user if no request made for a long time'); // ->listCredentials() $t->diag('->listCredentials()'); $user->clearCredentials(); $user->addCredential('user'); $t->is($user->listCredentials(), array('user'), '->listCredentials() returns user credentials as an array'); // ->setAuthenticated() ->isAuthenticated() $t->diag('->setAuthenticated() ->isAuthenticated()'); $t->is($user->isAuthenticated(), false, '->isAuthenticated() returns false by default'); $user->setAuthenticated(true); $t->is($user->isAuthenticated(), true, '->isAuthenticated() returns true if the user is authenticated'); $user->setAuthenticated(false); $t->is($user->isAuthenticated(), false, '->setAuthenticated() accepts a boolean as its first parameter'); // session id regeneration $user->setAuthenticated(false); $id = $storage->getSessionId();
} $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), 17, "class {$className} have " . 17 . ' methods.'); //checking method 'calculateDate' $t->can_ok($obj, 'calculateDate', 'calculateDate() is callable'); //$result = $obj->calculateDate ( $sInitDate, $iDuration, $sTimeUnit, $iTypeDay, $UsrUid, $ProUid, $TasUid); //$t->isa_ok( $result, 'NULL', 'call to method calculateDate '); $t->todo("call to method calculateDate using {$sInitDate}, {$iDuration}, {$sTimeUnit}, {$iTypeDay}, {$UsrUid}, {$ProUid}, {$TasUid} "); //checking method 'calculateDuration' $t->can_ok($obj, 'calculateDuration', 'calculateDuration() is callable'); //$result = $obj->calculateDuration ( $sInitDate, $sEndDate, $UsrUid, $ProUid, $TasUid); //$t->isa_ok( $result, 'NULL', 'call to method calculateDuration '); $t->todo("call to method calculateDuration using {$sInitDate}, {$sEndDate}, {$UsrUid}, {$ProUid}, {$TasUid} "); //checking method 'prepareInformation' $t->can_ok($obj, 'prepareInformation', 'prepareInformation() is callable'); //$result = $obj->prepareInformation ( $UsrUid, $ProUid, $TasUid); //$t->isa_ok( $result, 'NULL', 'call to method prepareInformation '); $t->todo("call to method prepareInformation using {$UsrUid}, {$ProUid}, {$TasUid} "); //checking method 'setSkipEveryYear' $t->can_ok($obj, 'setSkipEveryYear', 'setSkipEveryYear() is callable'); //$result = $obj->setSkipEveryYear ( $bSkipEveryYear); //$t->isa_ok( $result, 'NULL', 'call to method setSkipEveryYear '); $t->todo("call to method setSkipEveryYear using {$bSkipEveryYear} ");
$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'); //$result = $obj->roleList ( ); //$t->isa_ok( $result, 'NULL', 'call to method roleList '); $t->todo("call to method roleList using ");
* * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ if (!defined('PATH_THIRDPARTY')) { require_once $_SERVER['PWD'] . '/test/bootstrap/unit.php'; } require_once PATH_THIRDPARTY . '/lime/lime.php'; require_once PATH_THIRDPARTY . 'lime/yaml.class.php'; $t = new lime_test(2, new lime_output_color()); $t->is(strlen(WS_WSDL_URL) > 10, true, 'include wsConfig.php'); $t->todo('complete this test'); /* $t = new lime_test( 12, new lime_output_color()); $t->diag('Sequential Derivation Test' ); include_once ( "wsConfig.php" ); include_once ( "wsClient.php" ); define ( 'PROCESS_UID_SEQUENTIAL', '34537126948bc50f6dc0ad8058165755'); define ( 'START_SEQ_CYCLICAL_TASK', '31132134648bc50fb7afa90020304752'); define ( 'START_SEQ_MANUAL_TASK', '58845888048bc514a9ca3f6076028720'); define ( 'START_REQ_VALUE_TASK', '42952443148bc515a7aae98069470300'); global $sessionId; global $client; $t->is( strlen (WS_WSDL_URL) > 10 , true, 'include wsConfig.php'); $t->is( function_exists ('ws_open') , true, 'include wsClient.php'); $t->is( function_exists('ws_open'),true, 'ws_open()'); $t->is( function_exists('ws_newCase'),true, 'ws_newCase()');
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');
<?php include dirname(__FILE__) . '/../../bootstrap/Doctrine.php'; $t = new lime_test(3); $t->todo('->getActiveJobs'); $t->todo('->countActiveJobs'); $t->todo('->getActiveJobsQuery'); /* $t->comment('->getCompanySlug()'); $job = Doctrine_Core::getTable('JobeetJob')->createQuery()->fetchOne(); $t->is($job->getCompanySlug(), Jobeet::slugify($job->getCompany()), '->getCompanySlug() return the slug for the company'); $t->comment('->save()'); $job = create_job(); $job->save(); $expiresAt = date('Y-m-d', time() + 86400 * sfConfig::get('app_active_days')); $t->is($job->getDateTimeObject('expires_at')->format('Y-m-d'), $expiresAt, '->save() updates expires_at if not set'); $job = create_job(array('expires_at' => '2008-08-08')); $job->save(); $t->is($job->getDateTimeObject('expires_at')->format('Y-m-d'), '2008-08-08', '->save() does not update expires_at if set'); function create_job($defaults = array()) { static $category = null; if (is_null($category)) { $category = Doctrine_Core::getTable('JobeetCategory') ->createQuery() ->limit(1)
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), 13, "class {$className} have " . 13 . ' 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 'setServer' $t->can_ok($obj, 'setServer', 'setServer() is callable'); //$result = $obj->setServer ( $sServer); //$t->isa_ok( $result, 'NULL', 'call to method setServer '); $t->todo("call to method setServer using {$sServer} "); //checking method 'setPort' $t->can_ok($obj, 'setPort', 'setPort() is callable'); //$result = $obj->setPort ( $iPort); //$t->isa_ok( $result, 'NULL', 'call to method setPort '); $t->todo("call to method setPort using {$iPort} "); //checking method 'setReturnPath' $t->can_ok($obj, 'setReturnPath', 'setReturnPath() is callable'); //$result = $obj->setReturnPath ( $sReturnPath); //$t->isa_ok( $result, 'NULL', 'call to method setReturnPath '); $t->todo("call to method setReturnPath using {$sReturnPath} ");
exit(200); } else { include $dbfile; } } else { exit(201); } require_once PATH_GULLIVER . 'class.dbconnection.php'; $obj = new DBConnection(); $method = array(); $methods = get_class_methods('DBConnection'); $t = new lime_test(20, new lime_output_color()); $t->diag('class DBConnection'); /* Listing Method */ $t->is(count($methods), 8, "class DBConnection " . 8 . " methods."); $t->todo('Listing Method'); $t->is($methods[0], 'DBConnection', $counter++ . ' DBConnection'); $t->is($methods[1], 'Reset', $counter++ . ' Reset'); $t->is($methods[2], 'Free', $counter++ . ' Free'); $t->is($methods[3], 'Close', $counter++ . ' Close'); $t->is($methods[4], 'logError', $counter++ . ' logError'); $t->is($methods[5], 'traceError', $counter++ . ' traceError'); $t->is($methods[6], 'printArgs', $counter++ . ' printArgs'); $t->is($methods[7], 'GetLastID', $counter++ . ' GetLastID'); /* checking methods */ $t->todo('checking methods'); $t->can_ok($obj, 'DBConnection', 'DBConnection()'); $t->can_ok($obj, 'Reset', 'Reset()'); $t->can_ok($obj, 'Free', 'Free()'); $t->can_ok($obj, 'Close', 'Close()'); $t->can_ok($obj, 'logError', 'logError()');
$sf_root_dir = realpath(dirname(__FILE__) . '/../../../../'); // initialize database manager require_once $sf_root_dir . '/test/bootstrap/unit.php'; // start tests $t = new lime_test(31); // these tests check for the tags attachement consistency $t->diag('::cleanTagName'); $tag = TaggableToolkit::cleanTagName(''); $t->is($tag, '', 'empty string'); $tag = TaggableToolkit::cleanTagName('test'); $t->is($tag, 'test', 'single tag'); $tag = TaggableToolkit::cleanTagName('test1,test2'); $t->is($tag, 'test1 test2', 'double tag whitespace'); $tag = TaggableToolkit::cleanTagName('test1, test2'); $t->is($tag, 'test1 test2', 'double tag with whitespace'); $t->todo('test optional option parameter'); $t->diag('::explodeTagString'); $tag = TaggableToolkit::explodeTagString(''); $t->is($tag, '', 'empty string'); $tag = TaggableToolkit::explodeTagString('test1'); $t->is($tag, 'test1', 'single tag'); $tag = TaggableToolkit::explodeTagString('test1 test2'); $t->is($tag, 'test1 test2', 'single tag with whitespace'); $tag = TaggableToolkit::explodeTagString('test1,test2'); $t->is($tag, array('test1', 'test2'), 'double tag'); $tag = TaggableToolkit::explodeTagString(' test1 , test2'); $t->is($tag, array('test1', 'test2'), 'double dirty tag'); $tag = TaggableToolkit::explodeTagString(' test1 , test2'); $t->is($tag, array('test1', 'test2'), 'double extra dirty tag'); $tag = TaggableToolkit::explodeTagString(', test1 ,
//$res = $obj->remove( $Fields ); $t->todo ( "check why this sentence is not working : $res = $obj->remove( $Fields ); " ); //#32 $t->is ( $res, NULL, "remove() remove row $appUid" ); } catch ( Exception $e ) { //#14 // $t->isa_ok( $e, 'PropelException', 'remove() return error ' . $e->getMessage() ); $t->isa_ok( $e, 'Exception', 'remove() return error ' . $e->getMessage() ); } //remove with $appUid $obj = new Application (); $appUid = $obj->create( '1' ); try { $obj = new Application (); //$res = $obj->remove ($appUid ); //#33 //$t->is ( $res, NULL, "remove() remove row $appUid" ); } catch ( Exception $e ) { //#14 $t->isa_ok( $e, 'PropelException', 'remove() return error ' . $e->getMessage() ); } */ $t->todo('Test to verify if delete works correctly :p ...'); $t->todo('how can I change dynamically the Case Title based in a definition, right now the case title is the same as the process title. We need another field in process to have the case title definition'); ?>