本文整理汇总了PHP中lime_test::isa_ok方法的典型用法代码示例。如果您正苦于以下问题:PHP lime_test::isa_ok方法的具体用法?PHP lime_test::isa_ok怎么用?PHP lime_test::isa_ok使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lime_test
的用法示例。
在下文中一共展示了lime_test::isa_ok方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _createTmpGitRepo
/**
*
* @param lime_test $t
* @return PHPGit_Repository the git repo
*/
function _createTmpGitRepo(lime_test $t, array $options = array())
{
$repoDir = sys_get_temp_dir() . '/php-git-repo/' . uniqid();
$t->ok(!is_dir($repoDir . '/.git'), $repoDir . ' is not a Git repo');
try {
new PHPGit_Repository($repoDir, true, $options);
$t->fail($repoDir . ' is not a valid git repository');
} catch (InvalidArgumentException $e) {
$t->pass($repoDir . ' is not a valid git repository');
}
$t->comment('Create Git repo');
exec('git init ' . escapeshellarg($repoDir));
$t->ok(is_dir($repoDir . '/.git'), $repoDir . ' is a Git repo');
$repo = new PHPGit_Repository($repoDir, true, $options);
$t->isa_ok($repo, 'PHPGit_Repository', $repoDir . ' is a valid git repo');
$originalRepoDir = dirname(__FILE__) . '/repo';
foreach (array('README.markdown', 'index.php') as $file) {
copy($originalRepoDir . '/' . $file, $repoDir . '/' . $file);
}
return $repo;
}
示例2: 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;
}
//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 ( );
示例3: dirname
require_once dirname(__FILE__) . '/helper/dmUnitTestHelper.php';
$helper = new dmUnitTestHelper();
$helper->boot('front');
clearstatcache(true);
$isSqlite = Doctrine_Manager::getInstance()->getConnection('doctrine') instanceof Doctrine_Connection_Sqlite;
$t = new lime_test(16 + ($isSqlite ? 0 : 1) + 3 * count($helper->get('i18n')->getCultures()));
$user = $helper->get('user');
try {
$index = $helper->get('search_index');
$t->fail('Can\'t create index without dir');
} catch (dmSearchIndexException $e) {
$t->pass('Can\'t create index without dir');
}
$engine = $helper->get('search_engine');
$t->isa_ok($engine, 'dmSearchEngine', 'Got a dmSearchEngine instance');
$expected = dmProject::rootify(dmArray::get($helper->get('service_container')->getParameter('search_engine.options'), 'dir'));
$t->is($engine->getFullPath(), $expected, 'Current engine full path is ' . $expected);
$t->ok(!file_exists(dmProject::rootify('segments.gen')), 'There is no segments.gen in project root dir');
$engine->setDir('cache/testIndex');
foreach ($helper->get('i18n')->getCultures() as $culture) {
$user->setCulture($culture);
$currentIndex = $engine->getCurrentIndex();
$t->is($currentIndex->getName(), 'dm_page_' . $culture, 'Current index name is ' . $currentIndex->getName());
$t->is($currentIndex->getCulture(), $culture, 'Current index culture is ' . $culture);
$t->is($currentIndex->getFullPath(), dmProject::rootify('cache/testIndex/' . $currentIndex->getName()), 'Current index full path is ' . $currentIndex->getFullPath());
}
$user->setCulture(sfConfig::get('sf_default_culture'));
$currentIndex = $engine->getCurrentIndex();
$t->isa_ok($currentIndex->getLuceneIndex(), 'Zend_Search_Lucene_Proxy', 'The current index is instanceof Zend_Search_Lucene_Proxy');
$t->ok(!file_exists(dmProject::rootify('segments.gen')), 'There is no segments.gen in project root dir');
示例4: dirname
* @package symfony.plugins
* @subpackage sfDoctrine
* @author Pavel Kunc
* @author Olivier Verdier <Olivier.Verdier@gmail.com>
* @version SVN: $Id: sfDoctrineColumnTest.php 3438 2007-02-10 15:31:31Z chtito $
*/
//We need bootStrap
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
//TODO: add planned tests
$t = new lime_test(null, new lime_output_color());
$colName = 'TestColumn';
$column = new sfDoctrineColumnSchema($colName);
// ->__construct(), special case without variable parameters
$t->diag('->__constuct()');
$t->is($column->getName(), $colName, '->__construct() takes first parameter as Column name');
$t->isa_ok($column->getColumnInfo(), 'sfParameterHolder', '->__construct() sets column infor to sfParameterHolder');
//Construct sets default values, nothing passed
$props = $column->getProperties();
$t->is($props['type'], 'string', "->__construct() default type is 'string'");
$t->is($props['name'], $colName, "->__construct() sets property name to column name");
$column = new sfDoctrineColumnSchema($colName, array('foreignClass' => 'other'));
$props = $column->getProperties();
$t->is($props['type'], 'integer', 'default foreign key type is integer');
$t->diag('constraints');
$column = new sfDoctrineColumnSchema($colName, array('enum' => true, 'noconstraint' => true));
$props = $column->getProperties();
$t->is($props['enum'], true, 'constraints are stored properly');
$t->ok(!isset($props['notaconstraint']), 'false constraints are not stored');
$t->diag('short syntax');
$type = 'string';
$size = 10;
示例5: dirname
<?php
require_once dirname(__FILE__) . '/../../vendor/lime/lime.php';
require_once dirname(__FILE__) . '/../../lib/TwitterBot.class.php';
$t = new lime_test(12, new lime_output_color());
// Sample data
$xmlTweet = DOMDocument::load(dirname(__FILE__) . '/xml/server/statuses/show/2043091669.xml');
// createFromXml()
$t->diag('createFromXML()');
try {
$tweet = Tweet::createFromXML($xmlTweet);
$t->pass('createFromXml() creates a Tweet instance from an XML element without throwing an exception');
} catch (Exception $e) {
$t->fail('createFromXml() creates a Tweet instance from an XML element without throwing an exception');
$t->diag(sprintf(' %s: %s', get_class($e), $e->getMessage()));
}
$t->isa_ok($tweet, 'Tweet', 'createFromXML() creates a Tweet instance');
$t->is($tweet->created_at, 'Fri Jun 05 14:21:23 +0000 2009', 'createFromXML() can retrieve created_at property');
$t->is($tweet->id, 2043091669, 'createFromXML() can retrieve id property');
$t->is($tweet->text, 'foo', 'createFromXML() can retrieve text property');
$t->is($tweet->source, '<a href="http://www.nambu.com">Nambu</a>', 'createFromXML() can retrieve source property');
$t->is($tweet->truncated, false, 'createFromXML() can retrieve truncated property');
$t->is($tweet->in_reply_to_status_id, 2043033723, 'createFromXML() can retrieve in_reply_to_status_id property');
$t->is($tweet->in_reply_to_user_id, 14587759, 'createFromXML() can retrieve in_reply_to_user_id property');
$t->is($tweet->favorited, false, 'createFromXML() can retrieve favorited property');
$t->is($tweet->in_reply_to_screen_name, 'fvsch', 'createFromXML() can retrieve in_reply_to_screen_name property');
$t->isa_ok($tweet->user, 'TwitterUser', 'createFromXML() imports TwitterUser');
示例6: dirname
<?php
include_once dirname(__FILE__) . '/../../../bootstrap/unit.php';
include_once dirname(__FILE__) . '/../../../bootstrap/database.php';
sfContext::createInstance($configuration);
sfDoctrineRecord::setDefaultCulture('ja_JP');
$t = new lime_test(5, new lime_output_color());
//------------------------------------------------------------
$t->diag('NotificationMailTable');
$t->diag('NotificationMailTable::getDisabledNotificationNames()');
$result = Doctrine::getTable('NotificationMail')->getDisabledNotificationNames();
$t->is($result, array('name2'));
$t->diag('NotificationMailTable::fetchTemplate()');
$result = Doctrine::getTable('NotificationMail')->fetchTemplate('name1');
$t->isa_ok($result, 'NotificationMail');
$result = Doctrine::getTable('NotificationMail')->fetchTemplate('pc_changeMailAddress');
$t->isa_ok($result, 'NotificationMail');
$result = Doctrine::getTable('NotificationMail')->fetchTemplate('aaaaa');
$t->cmp_ok(false, '===', $result);
$t->diag('NotificationMailTable::getConfigs()');
$result = Doctrine::getTable('NotificationMail')->getConfigs();
$t->isa_ok($result, 'array');
示例7: sfDatabaseManager
$databaseManager = new sfDatabaseManager($configuration);
$table = Doctrine_Core::getTable('sfGuardUser');
// ->retrieveByUsername()
$t->diag('->retrieveByUsername()');
$table->createQuery()->delete()->where('username = ? OR username = ?', array('inactive_user', 'active_user'))->execute();
$inactiveUser = new sfGuardUser();
$inactiveUser->email_address = 'email@test.com';
$inactiveUser->username = 'inactive_user';
$inactiveUser->password = 'password';
$inactiveUser->is_active = false;
$inactiveUser->save();
$activeUser = new sfGuardUser();
$activeUser->email_address = 'email2@test.com';
$activeUser->username = 'active_user';
$activeUser->password = 'password';
$activeUser->is_active = true;
$activeUser->save();
$t->is($table->retrieveByUsername('invalid'), null, '->retrieveByUsername() returns "null" if username is invalid');
$t->is($table->retrieveByUsername('inactive_user'), null, '->retrieveByUsername() returns "null" if user is inactive');
$t->isa_ok($table->retrieveByUsername('inactive_user', false), 'sfGuardUser', '->retrieveByUsername() returns an inactive user when second parameter is false');
$t->isa_ok($table->retrieveByUsername('active_user'), 'sfGuardUser', '->retrieveByUsername() returns an active user');
$t->is($table->retrieveByUsername('active_user', false), null, '->retrieveByUsername() returns "null" if user is active and second parameter is false');
$t->isa_ok($table->retrieveByUsername('active_user'), 'sfGuardUser', '->retrieveByUsername() can be called non-statically');
try {
$table->retrieveByUsername(null);
$t->pass('->retrieveByUsername() does not throw an exception if username is null');
} catch (Exception $e) {
$t->diag($e->getMessage());
$t->fail('->retrieveByUsername() does not throw an exception if username is null');
}
$t->isa_ok(@PluginsfGuardUserTable::retrieveByUsername('active_user'), 'sfGuardUser', '->retrieveByUsername() can be called statically (BC)');
示例8: find
$t->is($exceptionThrown, true, 'select() throws an exception if called with an empty parameter');
/**********************************************/
/* sfPropelFinder::select($string) and find() */
/**********************************************/
$t->diag('sfPropelFinder::select(string) and find()');
ArticlePeer::doDeleteAll();
CategoryPeer::doDeleteAll();
$finder = sfPropelFinder::from('Category')->select('Name');
$categories = $finder->find();
$t->is($finder->getLatestQuery(), propel_sql('SELECT [P12category.ID, ]category.NAME AS Name FROM category'), 'find() called after select(string) selects a single column');
$t->isa_ok($categories, 'array', 'find() called after select(string) returns an array');
$t->is(count($categories), 0, 'find() called after select(string) returns an empty array if no record is found');
$category1 = new Category();
$category1->setName('cat1');
$category1->save();
$category2 = new Category();
$category2->setName('cat2');
$category2->save();
$finder = sfPropelFinder::from('Category')->select('Name');
$categories = $finder->find();
$t->is(count($categories), 2, 'find() called after select(string) returns an array with one row for each record');
$t->is(array_shift($categories), 'cat1', 'find() called after select(string) returns an array of column values');
$t->is(array_shift($categories), 'cat2', 'find() called after select(string) returns an array of column values');
示例9: ReflectionClass
$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;
}
$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 ');
示例10: dirname
<?php
include_once dirname(__FILE__) . '/../../bootstrap/unit.php';
include_once dirname(__FILE__) . '/../../bootstrap/database.php';
$t = new lime_test(null, new lime_output_color());
//------------------------------------------------------------
$t->diag('MemberProfilePeer::getProfileListByMemberId()');
$MemberProfileList = MemberProfilePeer::getProfileListByMemberId(1);
$t->isa_ok($MemberProfileList, 'array', 'getProfileListByMemberId() returns an array');
foreach ($MemberProfileList as $profile) {
$t->isa_ok($profile, 'MemberProfile', 'each profile is a MemberProfile');
$t->cmp_ok($profile->getName(), '==', true, 'Profile::getName() returns value.');
}
$t->cmp_ok(MemberProfilePeer::getProfileListByMemberId(2), '===', array(), 'getProfileListByMemberId() returns an empty array if member does not have any profile');
$t->cmp_ok(MemberProfilePeer::getProfileListByMemberId(999), '===', array(), 'getProfileListByMemberId() returns an empty array if member is not exist');
//------------------------------------------------------------
$t->diag('MemberProfilePeer::retrieveByMemberIdAndProfileId()');
$memberProfile = MemberProfilePeer::retrieveByMemberIdAndProfileId(1, 2);
$t->isa_ok($memberProfile, 'MemberProfile', 'retrieveByMemberIdAndProfileId() returns a MemberProfile');
$t->is($memberProfile->getValue(), 'よろしくお願いします。', 'MemberProfile::getValue() returns a value');
$t->cmp_ok(MemberProfilePeer::retrieveByMemberIdAndProfileId(1, 999), '===', NULL, 'retrieveByMemberIdAndProfileId() returns NULL if profile does not exist');
$t->cmp_ok(MemberProfilePeer::retrieveByMemberIdAndProfileId(999, 1), '===', NULL, 'retrieveByNameAndMemberId() returns NULL if member does not exist');
//------------------------------------------------------------
$t->diag('MemberProfilePeer::retrieveByMemberIdAndProfileName()');
$memberProfile = MemberProfilePeer::retrieveByMemberIdAndProfileName(1, 'self_intro');
$t->isa_ok($memberProfile, 'MemberProfile', 'retrieveByMemberIdAndProfileName() returns a MemberProfile');
$t->is($memberProfile->getValue(), 'よろしくお願いします。', 'MemberProfile::getValue() returns a value');
$t->cmp_ok(MemberProfilePeer::retrieveByMemberIdAndProfileName(1, 'unknown'), '===', NULL, 'retrieveByMemberIdAndProfileName() returns NULL if profile does not exist');
$t->cmp_ok(MemberProfilePeer::retrieveByMemberIdAndProfileName(999, 'example'), '===', NULL, 'retrieveByNameAndMemberId() returns NULL if member does not exist');
示例11: dirname
<?php
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
require_once dirname(__FILE__) . '/../../../lib/config/sfDynamicsBaseDefinition.class.php';
require_once dirname(__FILE__) . '/../../../lib/config/sfDynamicsAssetCollectionDefinition.class.php';
$testCount = 4;
$jsArray = array('testjs');
$cssArray = array('testcss');
$t = new lime_test($testCount, new lime_output_color());
try {
$i = sfDynamicsAssetCollectionDefinition::__set_state(array('javascripts' => $jsArray, 'stylesheets' => $cssArray));
$t->isa_ok($i, 'sfDynamicsAssetCollectionDefinition', '__set_state works and returns an instance of right class');
} catch (Exception $e) {
$t->fail('__set_state failed');
}
$t->is($i->getJavascripts(), $jsArray, 'Javascripts getter');
$t->is($i->getStylesheets(), $cssArray, 'Stylesheets getter');
try {
$i = sfDynamicsAssetCollectionDefinition::__set_state(array('wrong' => $jsArray));
$t->fail('__set_state should fail if wrong initialization data is sen.');
} catch (sfConfigurationException $e) {
$t->ok(1, '__set_state failed because of wrong parameters given');
} catch (Exception $e) {
$t->fail('__set_state failed, but with wrong exception type');
}
示例12: DCategory
$category1 = new DCategory();
$category1->setName('cat1');
$category1->save();
$article1 = new DArticle();
$article1->setTitle('aaa');
$article1->setCategory($category1);
$article1->save();
$article2 = new DArticle();
$article2->setTitle('bbb');
$article2->save();
$article = sfDoctrineFinder::from('DArticle')->leftJoin('DCategory')->with('DCategory')->findLast();
$category = $article->getCategory();
if (is_object($category))
{
$t->isa_ok($article->getCategory(), 'Doctrine_Null', 'In a left join using with(), empty related objects are not hydrated');
}
else
{
$t->isa_ok($article->getCategory(), 'NULL', 'In a left join using with(), empty related objects are not hydrated');
}
Doctrine_Query::create()->delete()->from('DComment')->execute();
Doctrine_Query::create()->delete()->from('DArticle')->execute();
Doctrine_Query::create()->delete()->from('DCategory')->execute();
Doctrine_Query::create()->delete()->from('DAuthor')->execute();
$t->diag('sfDoctrineFinder::withColumn() on calculated columns with decimals');
$finder = sfDoctrineFinder::from('DArticle');
try
{
示例13: dirname
<?php
include dirname(__FILE__) . '/../bootstrap/unit.php';
$t = new lime_test(3, new lime_output_color());
$t->isa_ok($p = new Feed(), 'Feed', 'constructor works');
$p->setRssUrl(fixture_url('1upShow-rss2.xml'));
$t->isa_ok($p->fetch(), 'sfRssFeed', 'fetch() gives us a sfFeed object');
$t->diag("\$p->getLastFetched()\n\t" . $p->getLastFetched());
$t->isa_ok($p->getLastFetched(null), 'DateTime', 'getLastFetched() gives us a DateTime object');
示例14: dirname
<?php
include_once dirname(__FILE__) . '/../../../bootstrap/unit.php';
include_once dirname(__FILE__) . '/../../../bootstrap/database.php';
sfContext::createInstance($configuration);
$t = new lime_test(81, new lime_output_color());
$table = Doctrine::getTable('CommunityMember');
$member1 = Doctrine::getTable('Member')->findOneByName('A');
$member2 = Doctrine::getTable('Member')->findOneByName('B');
$member3 = Doctrine::getTable('Member')->findOneByName('C');
$community1 = Doctrine::getTable('Community')->findOneByName('CommunityA');
$community5 = Doctrine::getTable('Community')->findOneByName('CommunityE');
//------------------------------------------------------------
$t->diag('CommunityMemberTable');
$t->diag('CommunityMemberTable::retrieveByMemberIdAndCommunityId()');
$t->isa_ok($table->retrieveByMemberIdAndCommunityId(1, 1), 'CommunityMember', 'retrieveByMemberIdAndCommunityId() returns a CommunityMember if member joins community');
$t->cmp_ok($table->retrieveByMemberIdAndCommunityId(1, 2), '===', false, 'retrieveByMemberIdAndCommunityId() returns NULL if member does not join community');
$t->cmp_ok($table->retrieveByMemberIdAndCommunityId(1000, 1), '===', false, 'retrieveByMemberIdAndCommunityId() returns NULL if member does not exist');
$t->cmp_ok($table->retrieveByMemberIdAndCommunityId(1, 999), '===', false, 'retrieveByMemberIdAndCommunityId() returns NULL if community does not exist');
$t->cmp_ok($table->retrieveByMemberIdAndCommunityId(999, 999), '===', false, 'retrieveByMemberIdAndCommunityId() returns NULL if member and community do not exist');
//------------------------------------------------------------
$t->diag('CommunityMemberTable::isMember()');
$t->cmp_ok($table->isMember(1, 1), '===', true, 'isMember() returns true if member joins community');
$t->cmp_ok($table->isMember(1, 2), '===', false, 'isMember() returns false if member does not join community');
$t->cmp_ok($table->isMember(999, 1), '===', false, 'isMember() returns false if member does not exist');
$t->cmp_ok($table->isMember(1, 999), '===', false, 'isMember() returns false if community does not exist');
$t->cmp_ok($table->isMember(999, 999), '===', false, 'isMember() returns false if member and community do not exist');
//------------------------------------------------------------
$t->diag('CommunityMemberTable::isAdmin()');
$t->cmp_ok($table->isAdmin(1, 1), '===', true, 'isAdmin() returns true if member joins community and position is admin');
$t->cmp_ok($table->isAdmin(2, 1), '===', false, 'isAdmin() returns false if member joins community and position is not admin');
示例15: Container
<?php
require_once __DIR__ . '/../../bootstrap.php';
use greebo\conveniences\Container;
$t = new lime_test(13);
$container = new Container();
$t->diag('defaults');
$t->is_deeply($container->vendor, 'greebo', 'default vendor');
$t->is_deeply($container->app, 'conveniences', 'default app');
$t->is_deeply($container->charset, 'utf-8', 'default character set');
$t->is_deeply($container->debug, false, 'default debug mode');
$t->isa_ok($container->event, 'greebo\\essence\\Event', 'default event instance');
$t->isa_ok($container->request, 'greebo\\conveniences\\Request', 'default request instance');
$t->isa_ok($container->response, 'greebo\\conveniences\\Response', 'default response instance');
$t->is_deeply($container->action_name, 'index', 'default action name');
$t->diag('context related instances');
$_GET['action'] = 'assignments';
$container = new Container();
$container->app = 'test';
$t->is_deeply($container->action_name, 'assignments', 'correct action name');
$t->isa_ok($container->action, 'greebo\\test\\ActionSet', 'correct action set instance');
try {
$container->template;
$t->fail('template getter throws exception if template class not exists');
} catch (\greebo\conveniences\ContainerException $e) {
$t->pass('template getter throws exception if template class not exists');
}
try {
$container->action_name = 'index';
$template = $container->template;
$t->isa_ok($template, 'greebo\\test\\Template\\index', 'correct template instance');