当前位置: 首页>>代码示例>>PHP>>正文


PHP lime_test::ok方法代码示例

本文整理汇总了PHP中lime_test::ok方法的典型用法代码示例。如果您正苦于以下问题:PHP lime_test::ok方法的具体用法?PHP lime_test::ok怎么用?PHP lime_test::ok使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lime_test的用法示例。


在下文中一共展示了lime_test::ok方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dm_test_this_layout

function dm_test_this_layout(DmLayout $layout, lime_test $t)
{
    $layout->refresh(true);
    $areaTop = $layout->getArea('top');
    $areaLeft = $layout->getArea('left');
    $areaBottom = $layout->getArea('bottom');
    $areaOther = $layout->getArea('other');
    $areaTop->refresh(true);
    $t->is($layout->Areas->count(), 4, 'Layout has 4 Areas');
    $t->is($areaTop['Zones']->count(), 2, 'area top has 2 Zones');
    $t->is($areaTop['Zones'][0]->Widgets->count(), 2, 'area top Zones[0] has 2 Widgets');
    $t->is($areaTop['Zones'][1]->Widgets->count(), 1, 'area Zones[1] has 1 Widgets');
    $t->is($areaLeft->Zones->count(), 1, 'Layout->Areas[1] has 1 Zone');
    $t->is($areaLeft->Zones[0]->Widgets->count(), 0, 'Layout->Areas[1]->Zones[0] has 0 Widgets');
    $t->is($areaBottom->Zones->count(), 1, 'Layout->Areas[2] has 1 Zone');
    $t->is($areaBottom->Zones[0]->Widgets->count(), 0, 'Layout->Areas[2]->Zones[0] has 0 Widgets');
    $t->is($areaOther->Zones->count(), 1, 'Layout->Areas[3] has 1 Zone');
    $t->is($areaOther->Zones[0]->Widgets->count(), 0, 'Layout->Areas[3]->Zones[0] has 0 Widgets');
    $t->is($areaTop['Zones'][0]->Widgets[0]->getModuleAction(), 'dmWidgetContent/title', 'found first widget');
    $t->ok($areaTop['Zones'][0]->Widgets[0]->getCurrentTranslation()->exists(), 'first widget has a current translation');
    $t->is($areaTop['Zones'][0]->Widgets[0]->value, 'widget value 1', 'first widget value is "widget value 1"');
    $t->is($areaTop['Zones'][0]->Widgets[1]->getModuleAction(), 'dmWidgetContent/link', 'found second widget');
    $t->is($areaTop['Zones'][0]->Widgets[1]->value, 'widget value 2', 'second widget value is "widget value 2"');
    $t->is($areaTop['Zones'][1]->Widgets[0]->getModuleAction(), 'dmWidgetContent/image', 'found third widget');
    $t->is($areaTop['Zones'][1]->Widgets[0]->value, 'widget value 3', 'third widget value is "widget value 3"');
}
开发者ID:theolymp,项目名称:diem,代码行数:26,代码来源:dmLayoutTest.php

示例2: ok

 public function ok($exp, $msg = '')
 {
     if (!$this->report_passes && $exp) {
         ++$this->passed;
         return true;
     }
     return parent::ok($exp, $msg);
 }
开发者ID:palcoprincipal,项目名称:sfLucenePlugin,代码行数:8,代码来源:limeade_test.php

示例3: launchTests

 /**
  * Test launcher
  *
  * @param string $schema Path to schema file
  */
 function launchTests($schema)
 {
     $this->t->diag('->load()');
     $this->load($schema);
     $this->t->diag('->getTables()');
     $tables = $this->tables;
     $this->t->is(count($tables), 2, "->getTables() should return 2 table from fixture.");
     $this->t->ok(in_array('testTable', array_keys($tables)), "->getTables() should return 'testTable' from fixture.");
     $this->t->diag('->classes');
     $this->t->is(count($this->classes), 2, "->classes should have 2 class from fixture");
     $this->t->ok($this->getClass('TestTable'), "->classes should have 'TestTable' from fixture.");
     $this->t->ok($this->getClass('TestTable')->getColumn('dummy_id')->hasRelation(), 'foreign relation is properly imported');
     #$this->t->diag('->asDoctrineYml()');
     #$yml = $this->asDoctrineYml();
     #$this->t->cmp_ok(strlen($yml['source']), '>', 0, "->asDoctrineYml() doctrine YAML shoudl not be empty.");
     $this->t->diag('->findClassByTableName()');
     $this->t->is($this->findClassByTableName('testTable')->getPhpName(), 'TestTable', "->findClassByTableName() returns 'TestTable' class for 'testTable' table.");
     $yml = $this->asDoctrineYml();
     $yml = $yml['source'];
     $this->t->like($yml, '@cascadeDelete: 1@', 'onDelete is generated');
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:26,代码来源:sfDoctrineSchemaPropelLoaderTest.php

示例4: _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;
}
开发者ID:ymnl007,项目名称:php-git-repo,代码行数:26,代码来源:PHPGit_RepoTestHelper.php

示例5: testNestedTree

 public function testNestedTree(lime_test $t)
 {
     $t->diag('Test nested tree');
     $table = dmDb::table('DmPage');
     $tree = $table->getTree();
     $root = $tree->fetchRoot();
     $b = $this->createPage('main', 'b');
     $b->getNode()->insertAsLastChildOf($root);
     $a = $this->createPage('main', 'a');
     $a->getNode()->insertAsLastChildOf($root);
     $a->refresh();
     $b->refresh();
     $t->is($a->rgt + 1, $b->lft, '$a->rgt+1 == $b->lft');
     $t->ok($a->getNode()->getParent() == $root, '$root parent of $a');
     $t->ok($b->getNode()->getParent() == $root, '$root parent of $b');
     $b->getNode()->moveAsLastChildOf($a);
     $a->refresh();
     $t->is($a->lft + 1, $b->lft, '$a->lft+1 == $b->lft');
     $t->is($a->rgt - 1, $b->rgt, '$a->rgt-1 == $b->rgt');
     $t->ok($a->getNode()->getParent() == $root, '$root parent of $a');
     $t->ok($b->getNode()->getParent() == $a, '$a parent of $b');
     $t->is($b->getNode()->getParent()->id, $a->id, '$b->getNode()->getParent()->id == $a->id');
     $t->is($b->getNodeParentId(), $a->id, '$b->getNodeParentId() == $a->id');
 }
开发者ID:theolymp,项目名称:diem,代码行数:24,代码来源:dmPageUnitTestHelper.php

示例6: dm_test_this_layout

function dm_test_this_layout(DmLayout $layout, lime_test $t)
{
    $layout->refresh(true);
    $layout->Areas[0]->refresh(true);
    $t->is($layout->Areas->count(), 4, 'Layout has 4 Areas');
    $t->is($layout->Areas[0]->Zones->count(), 2, 'Layout->Areas[0] has 2 Zones');
    $t->is($layout->Areas[0]->Zones[0]->Widgets->count(), 2, 'Layout->Areas[0]->Zones[0] has 2 Widgets');
    $t->is($layout->Areas[0]->Zones[1]->Widgets->count(), 1, 'Layout->Areas[0]->Zones[1] has 1 Widgets');
    $t->is($layout->Areas[1]->Zones->count(), 1, 'Layout->Areas[1] has 1 Zone');
    $t->is($layout->Areas[1]->Zones[0]->Widgets->count(), 0, 'Layout->Areas[1]->Zones[0] has 0 Widgets');
    $t->is($layout->Areas[2]->Zones->count(), 1, 'Layout->Areas[2] has 1 Zone');
    $t->is($layout->Areas[2]->Zones[0]->Widgets->count(), 0, 'Layout->Areas[2]->Zones[0] has 0 Widgets');
    $t->is($layout->Areas[3]->Zones->count(), 1, 'Layout->Areas[3] has 1 Zone');
    $t->is($layout->Areas[3]->Zones[0]->Widgets->count(), 0, 'Layout->Areas[3]->Zones[0] has 0 Widgets');
    $t->is($layout->Areas[0]->Zones[0]->Widgets[0]->getModuleAction(), 'dmWidgetContent/title', 'found first widget');
    $t->ok($layout->Areas[0]->Zones[0]->Widgets[0]->getCurrentTranslation()->exists(), 'first widget has a current translation');
    $t->is($layout->Areas[0]->Zones[0]->Widgets[0]->value, 'widget value 1', 'first widget value is "widget value 1"');
    $t->is($layout->Areas[0]->Zones[0]->Widgets[1]->getModuleAction(), 'dmWidgetContent/link', 'found second widget');
    $t->is($layout->Areas[0]->Zones[0]->Widgets[1]->value, 'widget value 2', 'second widget value is "widget value 2"');
    $t->is($layout->Areas[0]->Zones[1]->Widgets[0]->getModuleAction(), 'dmWidgetContent/image', 'found third widget');
    $t->is($layout->Areas[0]->Zones[1]->Widgets[0]->value, 'widget value 3', 'third widget value is "widget value 3"');
}
开发者ID:jdart,项目名称:diem,代码行数:22,代码来源:dmLayoutTest.php

示例7: count

$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');
dmConfig::set('search_stop_words', 'un le  les de,du , da, di ,do   ou ');
$t->is($currentIndex->getStopWords(), array('un', 'le', 'les', 'de', 'du', 'da', 'di', 'do', 'ou'), 'stop words retrieved from site instance : ' . implode(', ', $currentIndex->getStopWords()));
$t->diag('Cleaning text');
开发者ID:theolymp,项目名称:diem,代码行数:31,代码来源:dmSearchTest.php

示例8: sfEventDispatcher

    {
    }
}
class fakeResponse
{
}
$t = new lime_test(7, new lime_output_color());
$dispatcher = new sfEventDispatcher();
// ->initialize()
$t->diag('->initialize()');
$response = new myResponse($dispatcher, array('foo' => 'bar'));
$options = $response->getOptions();
$t->is($options['foo'], 'bar', '->initialize() takes an array of options as its second argument');
// ->getContent() ->setContent()
$t->diag('->getContent() ->setContent()');
$t->is($response->getContent(), null, '->getContent() returns the current response content which is null by default');
$response->setContent('test');
$t->is($response->getContent(), 'test', '->setContent() sets the response content');
// ->sendContent()
$t->diag('->sendContent()');
ob_start();
$response->sendContent();
$content = ob_get_clean();
$t->is($content, 'test', '->sendContent() output the current response content');
// ->serialize() ->unserialize()
$t->diag('->serialize() ->unserialize()');
$t->ok(new myResponse($dispatcher) instanceof Serializable, 'sfResponse implements the Serializable interface');
// new methods via sfEventDispatcher
require_once $_test_dir . '/unit/sfEventDispatcherTest.class.php';
$dispatcherTest = new sfEventDispatcherTest($t);
$dispatcherTest->launchTests($dispatcher, $response, 'response');
开发者ID:mediasadc,项目名称:alba,代码行数:31,代码来源:sfResponseTest.php

示例9: sfDoctrineColumnSchema

// ->__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;
$shortTypeSize = "{$type}({$size})";
$column = new sfDoctrineColumnSchema($colName, array('type' => $shortTypeSize));
$t->is($column->getProperty('size'), $size, 'short array syntax for size');
$t->is($column->getProperty('type'), $type, 'short array syntax for type');
$column = new sfDoctrineColumnSchema($colName, $shortTypeSize);
$t->is($column->getProperty('size'), $size, 'short string syntax for size');
$t->is($column->getProperty('type'), $type, 'short string syntax for type');
$column = new sfDoctrineColumnSchema($column, 'boolean');
$t->is($column->getProperty('type'), 'boolean', 'short string syntax without size');
$t->diag('PHP output');
$type = 'integer';
$size = 456;
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:31,代码来源:sfDoctrineColumnTest.php

示例10: dirname

<?php

require_once dirname(__FILE__) . '/../bootstrap/unit.php';
$mode = '644';
$folder = nbConfig::get('nb_sandbox_dir') . '/folder';
$fs = nbFileSystem::getInstance();
if (php_uname('s') == 'Linux') {
    $fs->mkdir($folder);
    $t = new lime_test(1);
    $cmd = new nbChangeModeCommand();
    $commandLine = sprintf('%s %s', $folder, $mode);
    $t->ok($cmd->run(new nbCommandLineParser(), $commandLine), 'Folder mode changed successfully');
    $fs->rmdir($folder);
} else {
    $t = new lime_test(0);
    $t->comment('No tests under Windows');
}
开发者ID:nubee,项目名称:bee,代码行数:17,代码来源:nbChangeModeCommandTest.php

示例11: testValidatorFile

$t->is($v->getMimeType($tmpDir . '/foo.txt', 'text/plain'), 'text/plain', '->getMimeType() returns the default type if the file type is not guessable');
$v->setOption('mime_type_guessers', array_merge(array(array($v, 'guessFromNothing')), $v->getOption('mime_type_guessers')));
$t->is($v->getMimeType($tmpDir . '/test.txt', 'image/png'), 'nothing/plain', '->getMimeType() takes all guessers from the mime_type_guessers option');
// ->clean()
$t->diag('->clean()');
$v = new testValidatorFile();
try {
    $v->clean(array('test' => true));
    $t->fail('->clean() throws an sfValidatorError if the given value is not well formatted');
    $t->skip('', 1);
} catch (sfValidatorError $e) {
    $t->pass('->clean() throws an sfValidatorError if the given value is not well formatted');
    $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError');
}
$f = $v->clean(array('tmp_name' => $tmpDir . '/test.txt'));
$t->ok($f instanceof sfValidatedFile, '->clean() returns a sfValidatedFile instance');
$t->is($f->getOriginalName(), '', '->clean() returns a sfValidatedFile with an empty original name if the name is not passed in the initial value');
$t->is($f->getSize(), strlen($content), '->clean() returns a sfValidatedFile with a computed file size if the size is not passed in the initial value');
$t->is($f->getType(), 'text/plain', '->clean() returns a sfValidatedFile with a guessed content type');
class myValidatedFile extends sfValidatedFile
{
}
$v->setOption('validated_file_class', 'myValidatedFile');
$f = $v->clean(array('tmp_name' => $tmpDir . '/test.txt'));
$t->ok($f instanceof myValidatedFile, '->clean() can take a "validated_file_class" option');
foreach (array(UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_EXTENSION) as $error) {
    try {
        $v->clean(array('tmp_name' => $tmpDir . '/test.txt', 'error' => $error));
        $t->fail('->clean() throws an sfValidatorError if the error code is not UPLOAD_ERR_OK (0)');
        $t->skip('', 1);
    } catch (sfValidatorError $e) {
开发者ID:sensorsix,项目名称:app,代码行数:31,代码来源:sfValidatorFileTest.php

示例12: sfPDODatabase

require_once __DIR__ . '/../../bootstrap/unit.php';
ob_start();
$plan = 14;
$t = new lime_test($plan);
if (!extension_loaded('SQLite') && !extension_loaded('pdo_SQLite')) {
    $t->skip('SQLite needed to run these tests', $plan);
    return;
}
// initialize the storage
$database = new sfPDODatabase(array('dsn' => 'sqlite::memory:'));
$connection = $database->getConnection();
$connection->exec('CREATE TABLE session (sess_id, sess_data, sess_time)');
ini_set('session.use_cookies', 0);
$session_id = "1";
$storage = new sfPDOSessionStorage(array('db_table' => 'session', 'session_id' => $session_id, 'database' => $database));
$t->ok($storage instanceof sfStorage, 'sfPDOSessionStorage is an instance of sfStorage');
$t->ok($storage instanceof sfDatabaseSessionStorage, 'sfPDOSessionStorage is an instance of sfDatabaseSessionStorage');
// regenerate()
$oldSessionData = 'foo:bar';
$storage->sessionWrite($session_id, $oldSessionData);
$storage->regenerate(false);
$newSessionData = 'foo:bar:baz';
$storage->sessionWrite(session_id(), $newSessionData);
$t->isnt(session_id(), $session_id, 'regenerate() regenerated the session with a different session id');
// checking if the old session record still exists
$result = $connection->query(sprintf('SELECT sess_id, sess_data FROM session WHERE sess_id = "%s"', $session_id));
$data = $result->fetchAll();
$t->is(count($data), 1, 'regenerate() has kept destroyed old session');
// checking if the new session record has been created
$result = $connection->query(sprintf('SELECT sess_id, sess_data FROM session WHERE sess_id = "%s"', session_id()));
$data = $result->fetchAll();
开发者ID:marekk,项目名称:symfony1,代码行数:31,代码来源:sfPDOSessionStorageTest.php

示例13: sfCommandOption

$t->is($option->isParameterRequired(), true, '__construct() can take "sfCommandOption::PARAMETER_REQUIRED" as its mode');
$t->is($option->isParameterOptional(), false, '__construct() can take "sfCommandOption::PARAMETER_REQUIRED" as its mode');
$option = new sfCommandOption('foo', 'f', sfCommandOption::PARAMETER_OPTIONAL);
$t->is($option->acceptParameter(), true, '__construct() can take "sfCommandOption::PARAMETER_OPTIONAL" as its mode');
$t->is($option->isParameterRequired(), false, '__construct() can take "sfCommandOption::PARAMETER_OPTIONAL" as its mode');
$t->is($option->isParameterOptional(), true, '__construct() can take "sfCommandOption::PARAMETER_OPTIONAL" as its mode');
try {
    $option = new sfCommandOption('foo', 'f', 'ANOTHER_ONE');
    $t->fail('__construct() throws an sfCommandException if the mode is not valid');
} catch (sfCommandException $e) {
    $t->pass('__construct() throws an sfCommandException if the mode is not valid');
}
// ->isArray()
$t->diag('->isArray()');
$option = new sfCommandOption('foo', null, sfCommandOption::IS_ARRAY);
$t->ok($option->isArray(), '->isArray() returns true if the option can be an array');
$option = new sfCommandOption('foo', null, sfCommandOption::PARAMETER_NONE | sfCommandOption::IS_ARRAY);
$t->ok($option->isArray(), '->isArray() returns true if the option can be an array');
$option = new sfCommandOption('foo', null, sfCommandOption::PARAMETER_NONE);
$t->ok(!$option->isArray(), '->isArray() returns false if the option can not be an array');
// ->getHelp()
$t->diag('->getHelp()');
$option = new sfCommandOption('foo', 'f', null, 'Some help');
$t->is($option->getHelp(), 'Some help', '->getHelp() returns the help message');
// ->getDefault()
$t->diag('->getDefault()');
$option = new sfCommandOption('foo', null, sfCommandOption::PARAMETER_OPTIONAL, '', 'default');
$t->is($option->getDefault(), 'default', '->getDefault() returns the default value');
$option = new sfCommandOption('foo', null, sfCommandOption::PARAMETER_REQUIRED, '', 'default');
$t->is($option->getDefault(), 'default', '->getDefault() returns the default value');
$option = new sfCommandOption('foo', null, sfCommandOption::PARAMETER_REQUIRED);
开发者ID:Phennim,项目名称:symfony1,代码行数:31,代码来源:sfCommandOptionTest.php

示例14: count

if (class_exists('SimpleXMLElement')) {
    $element = new SimpleXMLElement('<foo>bar</foo>');
    $escaped = sfOutputEscaper::escape('esc_entities', $element);
    $t->is((string) $escaped, (string) $element, '->__toString() is compatible with SimpleXMLElement');
} else {
    $t->skip('->__toString() is compatible with SimpleXMLElement');
}
class Foo
{
}
class FooCountable implements Countable
{
    public function count()
    {
        return 2;
    }
}
// implements Countable
$t->diag('implements Countable');
$foo = sfOutputEscaper::escape('esc_entities', new Foo());
$fooc = sfOutputEscaper::escape('esc_entities', new FooCountable());
$t->is(count($foo), 1, '->count() returns 1 if the embedded object does not implement the Countable interface');
$t->is(count($fooc), 2, '->count() returns the count() for the embedded object');
// ->__isset()
$t->diag('->__isset()');
$raw = new stdClass();
$raw->foo = 'bar';
$esc = sfOutputEscaper::escape('esc_entities', $raw);
$t->ok(isset($esc->foo), '->__isset() asks the wrapped object whether a property is set');
unset($raw->foo);
$t->ok(!isset($esc->foo), '->__isset() asks the wrapped object whether a property is set');
开发者ID:Phennim,项目名称:symfony1,代码行数:31,代码来源:sfOutputEscaperObjectDecoratorTest.php

示例15: setName

$t->isa_ok($context['foo'], 'sfContext', '->offsetGet() returns attribute by name');
$context['foo2'] = $i18n_context;
$t->isa_ok($context['foo2'], 'sfContext', '->offsetSet() sets object by name');
unset($context['foo2']);
$t->is(isset($context['foo2']), false, '->offsetUnset() unsets object by name');
$t->diag('->__call()');
$context->setFoo4($i18n_context);
$t->is($context->has('foo4'), true, '->__call() sets context objects by name using setName()');
$t->isa_ok($context->getFoo4(), 'sfContext', '->__call() returns context objects by name using getName()');
try {
    $context->unknown();
    $t->fail('->__call() throws an sfException if factory / method does not exist');
} catch (sfException $e) {
    $t->pass('->__call() throws an sfException if factory / method does not exist');
}
$t->diag('->getServiceContainer() test');
$sc = $frontend_context->getServiceContainer();
$t->ok(file_exists(sfConfig::get('sf_cache_dir') . '/frontend/test/config/config_services.yml.php'), '->getServiceContainer() creates a cache file in /cache/frontend/test/config');
$t->ok(class_exists('frontend_testServiceContainer'), '->getServiceContainer() creates and loads the frontend_testServiceContainer class');
$t->ok($sc instanceof frontend_testServiceContainer, '->getServiceContainer() returns an instance of frontend_testServiceContainer');
$t->ok($sc->hasService('my_app_service'), '->getServiceContainer() contains app/config/service.yml services');
$t->ok($sc->hasService('my_project_service'), '->getServiceContainer() contains /config/service.yml services');
$t->ok($sc->hasService('my_plugin_service'), '->getServiceContainer() contains plugin/config/service.yml services');
$t->ok($sc->getParameter('sf_root_dir'), '->getServiceContainer() sfConfig parameters are accessibles');
$t->ok($sc->hasParameter('my_app_test_param'), '->getServiceContainer() contains env specifiv parameters');
$t->diag('->getServiceContainer() prod');
$sc = $frontend_context_prod->getServiceContainer();
$t->ok(file_exists(sfConfig::get('sf_cache_dir') . '/frontend/prod/config/config_services.yml.php'), '->getServiceContainer() creates a cache file in /cache/frontend/prod/config');
$t->ok(class_exists('frontend_prodServiceContainer'), '->getServiceContainer() creates and loads the frontend_prodServiceContainer class');
$t->ok($sc instanceof frontend_prodServiceContainer, '->getServiceContainer() returns an instance of frontend_prodServiceContainer');
$t->ok(false === $sc->hasParameter('my_app_test_param'), '->getServiceContainer() does not contain other env specifiv parameters');
开发者ID:Phennim,项目名称:symfony1,代码行数:31,代码来源:sfContextTest.php


注:本文中的lime_test::ok方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。