本文整理汇总了PHP中lime_test::info方法的典型用法代码示例。如果您正苦于以下问题:PHP lime_test::info方法的具体用法?PHP lime_test::info怎么用?PHP lime_test::info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lime_test
的用法示例。
在下文中一共展示了lime_test::info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_test_tree
function check_test_tree(lime_test $t, ioMenuItem $menu)
{
$t->info('### Running checks on the integrity of the test tree.');
$t->is(count($menu), 2, 'count(rt) returns 2 children');
$t->is(count($menu['Parent 1']), 3, 'count(pt1) returns 3 children');
$t->is(count($menu['Parent 2']), 1, 'count(pt2) returns 1 child');
$t->is(count($menu['Parent 2']['Child 4']), 1, 'count(ch4) returns 1 child');
$t->is_deeply($menu['Parent 2']['Child 4']['Grandchild 1']->getName(), 'Grandchild 1', 'gc1 has the name "Grandchild 1"');
}
示例2: dirname
<?php
include dirname(__FILE__) . '/../../bootstrap/Doctrine.php';
$t = new lime_test(7, new lime_output_color());
$t->info("findLinked method");
$conn = Doctrine_Manager::connection();
$staging_ids = array();
$staging_ids_all = $conn->fetchAll("SELECT id FROM staging");
foreach ($staging_ids_all as $staging_id_val) {
$staging_ids[] = $staging_id_val['id'];
}
$s = Doctrine::getTable("Staging")->findLinked($staging_ids);
$t->is(count($s), 1, 'Number of distinct related template_table_record_ref records is well "1"');
$t->is(2, $s[0]['record_id'], 'Staging record referenced is well "2"...');
$t->is(1, $s[0]['cnt'], '... and is well counted "1" time');
$conn->execute("\n INSERT INTO staging_people (id, referenced_relation, record_id, formated_name, people_type)\n VALUES (2, 'staging', 2, 'Bricolux', 'preparator')\n ");
$conn->execute("\n INSERT INTO codes (id, referenced_relation, record_id, code)\n VALUES (1024, 'staging', 1, 'Codex-1')\n ");
$s = Doctrine::getTable("Staging")->findLinked($staging_ids);
$t->is(count($s), 2, 'Number of distinct related template_table_record_ref records is well "2" now');
$t->is(1, $s[0]['cnt'], 'The first one (record_id "1") is well counted "1" time...');
$t->is(2, $s[1]['cnt'], '... and the second one (record_id "2") is well counted "2" time (two staging_people entries)');
$t->is(2, $s[1]['record_id'], 'Second one is well record_id "2" :)');
$conn->close();
示例3: dirname
<?php
include dirname(__FILE__) . '/../../bootstrap/Doctrine.php';
$t = new lime_test(14, new lime_output_color());
$taxs = Doctrine::getTable('Taxonomy')->findOneByName('Falco Peregrinus eliticus');
$t->info('findWithParents($id)');
$taxa = Doctrine::getTable('Taxonomy')->findWithParents($taxs->getId());
$t->isnt($taxa, null, 'we got a taxa');
$t->is($taxa->count(), 9, 'we got all parent of the taxa');
$t->is($taxa[7]->getId(), $taxs->getParentRef(), 'Parent is correct');
$t->is($taxa[1]->Level->__toString(), 'kingdom', 'get Level');
$t->is($taxs->getNameWithFormat(), '<i>Falco Peregrinus eliticus</i>', 'get Name without extinct');
$taxs->setExtinct('true');
$t->is($taxs->getNameWithFormat(), '<i>Falco Peregrinus eliticus</i> †', 'get Name without extinct');
$t->is(DarwinTable::getFilterForTable('classification_syonymies'), "ClassificationSyonymiesFormFilter", 'Filter Form name');
$t->is(DarwinTable::getFormForTable('classification_syonymies'), "ClassificationSyonymiesForm", 'Form Name');
$t->is(DarwinTable::getModelForTable('classification_syonymies'), "ClassificationSyonymies", 'Model Name');
$t->is(Doctrine::getTable('Taxonomy')->find(4)->toArray(), true, 'We got the record with find');
$t->is(Doctrine::getTable('Taxonomy')->find(-1)->toArray(), true, 'Record bellow 0 are found with find');
$keywords = Doctrine::getTable('ClassificationKeywords')->findForTable('taxonomy', 4);
$t->is(count($keywords), 0, 'No KW per default');
$kw_full = ClassificationKeywords::getTags('taxonomy');
$avail_kw = array_keys($kw_full);
$kw = new ClassificationKeywords();
$kw->setReferencedRelation('taxonomy');
$kw->setRecordId(4);
$kw->setKeywordType($avail_kw[1]);
$kw->setKeyword('Falco Peregrinus');
$kw->save();
$keywords = Doctrine::getTable('ClassificationKeywords')->findForTable('taxonomy', 4);
$t->is(count($keywords), 1, 'The new Keyword');
示例4: dirname
<?php
require_once dirname(__FILE__) . '/../bootstrap/unit.php';
require_once dirname(__FILE__) . '/../../lib/sfDynamics.class.php';
$testCount = 1;
class ManagerMock extends sfDynamicsManager
{
}
$t = new lime_test($testCount, new lime_output_color());
$t->comment('::getManager()');
if (!sfContext::hasInstance()) {
require_once $_SERVER['SYMFONY'] . '/autoload/sfCoreAutoload.class.php';
sfCoreAutoload::register();
require_once dirname(__FILE__) . '/../fixtures/project/config/ProjectConfiguration.class.php';
sfContext::createInstance(ProjectConfiguration::getApplicationConfiguration('frontend', 'test', isset($debug) ? $debug : true));
if (!sfContext::hasInstance()) {
$t->error('A context instance is required');
die;
}
$t->info('A frontend context has been initialized for tests');
}
sfConfig::set('app_sfDynamicsPlugin_manager', 'ManagerMock');
$t->isa_ok(sfDynamics::getManager(), 'ManagerMock', '::getManager() the manager class can be customized in app.yml');
示例5: dirname
<?php
$app = 'sympal';
$refresh_assets = true;
require_once dirname(__FILE__) . '/../../../../bootstrap/unit.php';
$t = new lime_test(30);
// initialize some asset objects
$sync = new sfSympalAssetSynchronizer($configuration->getEventDispatcher());
$sync->run();
$asset = Doctrine_Core::getTable('sfSympalAsset')->findOneBySlug('sympal-info')->getAssetObject();
$asset2 = Doctrine_Core::getTable('sfSympalAsset')->findOneBySlug('screens-sympalphp')->getAssetObject();
$t->info('1 - Run some basic functions on the asset');
$t->is($asset->isImage(), false, '->isImage() returns false');
$t->is($asset->getType(), 'text', '->getType() returns "text"');
$t->is($asset->exists(), true, '->exists() returns true as the file does exist');
$t->is($asset->getTypeFromExtension(), 'text', '->getTypeFromExtension() returns text');
$t->is($asset->getIcon(), '/sfSympalAssetsPlugin/images/icons/txt.png', '->getIcon() returns the txt.png icon');
$t->is($asset->getExtension(), 'txt', '->getExtension() returns .txt');
$t->is($asset->getPath(), sfConfig::get('sf_upload_dir') . '/sympal info.txt', '->getPath() returns the correct path');
$t->is($asset->getRelativePath(), '/sympal info.txt', '->getRelativePath() returns the web url for the asset');
$t->is($asset->getRelativePathDirectory(), '', '->getRelativePathDirectory() returns a blank string');
$t->is($asset->getFilePath(), '/sympal info.txt', '->getFilePath() returns /sympal info.txt');
$t->is($asset2->getPath(), sfConfig::get('sf_upload_dir') . '/screens/sympalphp.png', '->getPath() returns the correct path');
$t->is($asset2->getRelativePath(), '/screens/sympalphp.png', '->getRelativePath() returns the web url for the asset');
$t->is($asset2->getRelativePathDirectory(), '/screens', '->getRelativePathDirectory() returns "/screens"');
$t->is($asset2->getFilePath(), '/screens/sympalphp.png', '->getFilePath() returns /sympal info.txt');
$t->like($asset2->getUrl(), '/uploads\\/screens\\/sympalphp\\.png/', '->getFilePath() contains /uploads/screens/sympalphp.png');
$t->like($asset2->getUrl(), '/http\\:\\/\\//', '->getFilePath() contains http://');
$t->is($asset->getName(), 'sympal info.txt', '->getName() return "sympal info.txt"');
$t->is($asset2->getSize(), '275', '->getSize() returns 275 for a 274.7kb file');
$original = $asset->getOriginal();
示例6: dirname
<?php
include dirname(__FILE__) . '/../../bootstrap/Doctrine.php';
$t = new lime_test(3, new lime_output_color());
$userEvil = Doctrine::getTable('Users')->findOneByFamilyName('Evil')->getId();
$ids_userEvil = Doctrine::getTable('Loans')->getMyLoans($userEvil)->execute();
$t->info('getFromLoans()');
$cat = Doctrine::getTable('LoanStatus')->getFromLoans(getIdsArrayFrom($ids_userEvil));
$t->is(count($cat), 5, '5 last loans status are returnes for evil');
$status = Doctrine::getTable('LoanStatus')->getDistinctStatus();
$t->is(count($status), 6, '6 status for loans are possible');
$allstatus = Doctrine::getTable('LoanStatus')->getallLoanStatus(1);
$t->is(count($allstatus), 3, '3 status exist for loans Dog of Goyet');
/*
little helper function to construct an array of ids
*/
function getIdsArrayFrom($ids)
{
$de_ids = array();
foreach ($ids as $id) {
$de_ids[] = $id->getId();
}
return $de_ids;
}
示例7: generateJsHtml
public function generateJsHtml()
{
return '<script type="text/javascript" src="/dynamics/foo.js"></script>';
}
}
$t = new lime_test(7, new lime_output_color());
if (!sfContext::hasInstance()) {
require_once $_SERVER['SYMFONY'] . '/autoload/sfCoreAutoload.class.php';
sfCoreAutoload::register();
require_once dirname(__FILE__) . '/../../fixtures/project/config/ProjectConfiguration.class.php';
sfContext::createInstance(ProjectConfiguration::getApplicationConfiguration('frontend', 'test', isset($debug) ? $debug : true));
if (!sfContext::hasInstance()) {
$t->error('A context instance is required');
die;
}
$t->info('A frontend context has been initialized for tests');
}
$t->comment('->addSfDynamicsTags()');
sfConfig::set('app_sfDynamicsPlugin_manager', 'ManagerMock');
$manager = sfDynamics::getManager();
$t->info('New placeholder system');
$content = <<<END
<html>
<head>
<!-- Include sfDynamics css tags -->
<link rel="stylesheet" type="text/css" media="screen" href="/bar.css" />
</head>
<body>
<p>Lorem ipsum</p>
<!-- Include sfDynamics js tags -->
示例8: dirname
<?php
// Bring in functional so we have an application configuration
// This will help us to find layouts etc that are in the application
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
require_once dirname(__FILE__) . '/../../bootstrap/functional.php';
$t = new lime_test(5);
// Setup a cache driver
$cachePath = '/tmp/theme_tookit';
sfToolkit::clearDirectory($cachePath);
$cacheDriver = new sfFileCache(array('cache_dir' => $cachePath));
$toolkit = new sfThemeToolkit($configuration);
$toolkit->setCacheDriver($cacheDriver);
$t->is($toolkit->getCacheDriver(), $cacheDriver, '->getCacheDriver() returns the correct object');
$t->info('1 - Test getLayouts()');
$layouts = array('plugins/sfThemeTestPlugin/templates/plugin_test_layout.php' => 'plugin_test_layout', 'apps/frontend/templates/app_test_layout.php' => 'app_test_layout', 'apps/frontend/templates/layout.php' => 'layout');
$t->is($toolkit->getLayouts(), $layouts, '->getLayouts() returns 2 layouts from the app and 1 from a plugin');
$t->info(' 1.1 - Mutate the cache, it should return the mutated version');
$cacheDriver->set('theme.configuration.layouts', serialize(array('/path/to/layout.php' => 'layout')));
// Need to create a new toolkit class, because the layous are "cached" as a property on the object
$toolkit = new sfThemeToolkit($configuration);
$toolkit->setCacheDriver($cacheDriver);
$t->is($toolkit->getLayouts(), array('/path/to/layout.php' => 'layout'), '->getLayouts() returns from cache');
$t->info('2 - Test the createInstance() static method');
$toolkit = sfThemeToolkit::createInstance($configuration);
$t->is(get_class($toolkit), 'sfThemeTestToolkit', 'The toolkit has the class defined in app.yml');
$t->is(get_class($toolkit->getCacheDriver()), 'sfFileCache', 'The cache driver is set correctly');
示例9: dirname
<?php
// bootstrap in the functional configuration since the theme manager is context-dependent
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
require_once dirname(__FILE__) . '/../../bootstrap/functional.php';
$t = new lime_test(31);
$t->info('1 - Test some basics of getting themes, theme objects');
// we'll use this to test the theme object
$themeConfig = array('layout' => 'testing');
$theme = new sfTheme($themeConfig);
$manager = new sfThemeManager($context);
$t->is($manager->getThemes(), array(), '->getThemes() returns an empty array to start.');
$manager = new sfThemeManager($context, array('test_theme' => $themeConfig));
$t->is($manager->getThemes(), array('test_theme' => $themeConfig), 'Themes can be set via the constructor.');
$manager = new sfThemeManager($context);
$manager->addTheme('test_theme', $themeConfig);
$t->is($manager->getThemes(), array('test_theme' => $themeConfig), 'Themes can be set via addTheme() passing in an array.');
$t->is($manager->getThemeObject('test_theme')->getConfig(), $theme->getConfig(), '->getThemeObject() returns the correct theme object');
$manager = new sfThemeManager($context);
$manager->addTheme('test_theme', $theme);
$t->is($manager->getThemes(), array('test_theme' => $themeConfig), 'Themes can be set via addTheme() passing in an sfTheme object.');
$t->is($manager->getThemeObject('test_theme'), $theme, '->getThemeObject() returns the correct theme object');
$t->info(' 1.1 - Trying to retrieve a non-existent theme object throws an exception');
try {
$manager->getThemeObject('fake');
$t->fail('No exception thrown');
} catch (sfException $e) {
$t->pass($e->getMessage());
}
$t->info(' 1.2 - Play with the current theme');
$t->is($manager->getCurrentTheme(), false, '->getCurrentTheme() returns false when there is no theme set');
示例10: resetIsCurrent
$timer = new sfTimer();
// stub class used for testing
class ioMenuItemTest extends ioMenuItem
{
// resets the isCurrent property so we can test for current repeatedly.
public function resetIsCurrent()
{
$this->_isCurrent = null;
}
// resets the userAccess property so we can test for current repeatedly.
public function resetUserAccess()
{
$this->_userAccess = null;
}
}
$t->info('1 - Test basic getters, setters and constructor');
$menu = new ioMenuItem('test menu', '@homepage', array('title' => 'my menu'));
$t->is($menu->getName(), 'test menu', '->getName() returns the given name.');
$menu->setName('new menu name');
$t->is($menu->getName(), 'new menu name', '->setName() sets the name correctly.');
$t->is($menu->getLabel(), 'new menu name', '->getLabel() returns the name if the label does not exist.');
$menu->setLabel('menu label');
$t->is($menu->getLabel(), 'menu label', 'Once set, ->getLabel() returns the actual label.');
$t->is($menu->getRoute(), '@homepage', '->getRoute() returns the given route.');
$menu->setRoute('http://www.sympalphp.org');
$t->is($menu->getRoute(), 'http://www.sympalphp.org', '->setRoute() sets the route correctly.');
$t->is($menu->getAttributes(), array('title' => 'my menu'), '->getAttributes() returns the attributes array.');
$menu->setAttributes(array('id' => 'unit_test'));
$t->is($menu->getAttributes(), array('id' => 'unit_test'), '->setAttributes() sets the attributes array.');
$t->is($menu->getAttribute('id', 'default'), 'unit_test', '->getAttribute() returns an existing attribute correctly.');
$t->is($menu->getAttribute('fake', 'default'), 'default', '->getAttribute() returns the default for a non-existent attribute.');
示例11: check_asset_values
<?php
$app = 'sympal';
$refresh_assets = true;
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
$t = new lime_test(6);
$assetNum = 3;
// the number of test assets
$sync = new sfSympalAssetSynchronizer($configuration->getEventDispatcher());
$t->info('1 - Test that the synchronizer loads in the assets');
$assets = Doctrine_Core::getTable('sfSympalAsset')->findAll();
$t->is(count($assets), 0, 'There are 0 assets before the synchronizer is run');
$sync->run();
$assets = Doctrine_Core::getTable('sfSympalAsset')->findAll();
$t->is(count($assets), $assetNum, sprintf('There are %s assets after the synchronizer is run', $assetNum));
$t->info('2 - Test that the assets were loaded with the correct data');
check_asset_values($t, $assets[0], array('name' => 'sympal info.txt', 'path' => '', 'slug' => 'sympal-info'));
check_asset_values($t, $assets[1], array('name' => 'sympalphp.png', 'path' => '/screens', 'slug' => 'screens-sympalphp'));
check_asset_values($t, $assets[2], array('name' => 'symfony-logo.gif', 'path' => '/logos', 'slug' => 'logos-symfony-logo'));
$t->info('3 - Delete a file and rerun the synchronizer');
unlink(sfConfig::get('sf_upload_dir') . '/logos/symfony-logo.gif');
$sync->run();
$assets = Doctrine_Core::getTable('sfSympalAsset')->findAll();
$t->is(count($assets), $assetNum - 1, sprintf('There are %s assets after the synchronizer is run', $assetNum - 1));
function check_asset_values(lime_test $t, sfSympalAsset $asset, $values)
{
$savedValues = $asset->toArray();
unset($savedValues['id']);
$t->is($savedValues, $values, sprintf('The asset "%s" has the correct values', $values['name']));
}
示例12: dirname
<?php
// Bringing in functional to have context for the createInstance() method
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
require_once dirname(__FILE__) . '/../../bootstrap/functional.php';
$t = new lime_test(4);
$t->info('1 - Test the basics, like getOptions()');
$controller = new sfThemeController(array('test' => 'foo'));
$t->is($controller->getOption('test', 'ignore'), 'foo', '->getOption() returns existent options');
$t->is($controller->getOption('fake', 'default'), 'default', '->getOption() returns the default for nonexistent options');
$t->info('2 - Test the createInstance() method');
$controller = sfThemeController::createInstance();
$t->is(get_class($controller), 'sfThemeTestController', 'Class is sfThemeTestController, as set in app.yml');
$t->is($controller->getOption('default_theme'), 'app_test', 'Controller options were loaded correctly');
示例13: dirname
<?php
include dirname(__FILE__) . '/../bootstrap/unit.php';
$conn = lyMediaFolderTable::getInstance()->getConnection();
$root = lyMediaFolderTable::getInstance()->createRoot('test_root');
$fs = new lyMediaFileSystem();
$t = new lime_test(30, new lime_output_color());
$t->info('Create first level folder');
$folder = new lyMediaFolder();
$folder->setName('test');
$folder->create($root);
$folder->refresh();
/*
* test_root
* -- test
*/
$t->is($folder->getName(), 'test', '->getName()');
$t->is($folder->getRelativePath(), 'test_root/test/', '->getRelativePath()');
$t->ok($folder->getNode()->isValidNode(), 'Folder is a valid node');
$t->is($folder->getNode()->getPath('/', true), 'test_root/test', 'Folder has right path');
$t->ok($fs->is_dir($folder->getRelativePath()), 'Folder exists in filesystem');
$t->info('Create sub-folder');
$sub = new lyMediaFolder();
$sub->setName('test-sub');
$sub->create($folder);
$sub->refresh();
/*
* test_root
* -- test
* -- -- test-sub
*/
示例14: dirname
<?php
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
$t = new lime_test(10);
// Default sympal theme
$t->info('1 - Test on the default sympal theme');
$theme = $themeManager->getThemeObject('sympal');
$t->is($theme->getLayoutPath(), $dir . '/templates/sympal.php', '->getLayoutPath() returns the correct path to sympal.php');
$t->is($theme->getStylesheets(), array('/sfSympalThemePlugin/css/sympal.css'), '->getStylesheets() returns the correct stylesheets');
$t->is($theme->getJavascripts(), array(), '->getJavascripts() returns no javascripts in this case');
$t->is($theme->getName(), 'sympal', '->getName() returns the correct name of the theme');
// Theme from another plugin
$t->info('2 - Test on a theme that lives inside a plugin');
$theme = $themeManager->getThemeObject('test_theme');
$t->is($theme->getLayoutPath(), $dir . '/test/fixtures/project/plugins/sfSympalThemeTestPlugin/templates/layout_for_testing.php', '->getLayoutPath() returns the custom layout name in the correct path');
$t->is($theme->getStylesheets(), array('/sfSympalThemeTestPlugin/css/test_theme.css'), '->getStylesheets() automatically finds a css file matching the name of the theme');
$t->is($theme->getJavascripts(), array('/sfSympalThemeTestPlugin/js/testing.js'), '->getJavascripts() returns the correct javascript');
// Theme from application
$t->info('3 - Test a plugin that lives inside the app');
$theme = $themeManager->getThemeObject('app_test');
$t->is($theme->getLayoutPath(), $dir . '/test/fixtures/project/apps/frontend/templates/app_test_layout.php', '->getLayoutPath() returns "app_test_layout" - the custom layout name given');
$t->is($theme->getStylesheets(), array('app_test'), '->getStylesheets() finds "app_test" by default as a css to include');
$t->is($theme->getJavascripts(), array(), '->getJavascripts() returns an empty array');
示例15: dirname
<?php
include dirname(__FILE__) . '/../../bootstrap/Doctrine.php';
$t = new lime_test(15, new lime_output_color());
$t->info('distinct SubGroup()');
$sgroups = Doctrine::getTable('TagGroups')->getDistinctSubGroups('administrative area');
$t->is(count($sgroups), 3, 'Get all administrative sub groups');
$t->is($sgroups['country'], 'country', 'Country is set');
$sgroups = Doctrine::getTable('TagGroups')->getDistinctSubGroups('brol');
$t->is(count($sgroups), 1, 'Get administrative sub groups for this unused');
$t->is($sgroups[''], '', 'thre is only the empty');
$t->info('getPropositions');
$props = Doctrine::getTable('TagGroups')->getPropositions('brussels');
$t->is(count($props), 4, 'We got 4 props');
$props = Doctrine::getTable('TagGroups')->getPropositions('Bruselo');
$t->is(count($props), 2, 'Got 2 prop');
$t->is($props[0]['tag'], 'Brussels', 'Brussels is showed');
$props = Doctrine::getTable('TagGroups')->getPropositions('brussels', 'administrative area', 'city');
$t->is(count($props), 3, 'We got 3 props');
$t->isnt($props[0]['tag'], 'Big White Mountain', 'Purpose from only 1 group');
$t->info('fetchTag');
$gtu = Doctrine::getTable('Gtu')->findOneByCode('irsnb');
$tags = Doctrine::getTable('TagGroups')->fetchTag(array($gtu->getId()));
$t->is(count($tags), 1, 'We got 1 gtu');
$t->is(count($tags[$gtu->getId()]), 2, 'We got 2 group');
$t->is($tags[$gtu->getId()][0]->getGroupName(), 'administrative area', 'administrative is the group');
$t->is($tags[$gtu->getId()][0]->getSubGroupName(), 'country', 'country is the sub group');
$t->is(count($tags[$gtu->getId()][0]->Tags), 4, 'We got 4 tags');
$t->is(TagGroups::getGroup('populated'), 'Populated Places', 'Get a Tag group');