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


PHP lime_test::diag方法代码示例

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


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

示例1: fail

 /**
  * Tests that this input fails
  *
  * @param string $input 
  * @param string $message 
  */
 public function fail($input, $message = null, $encoding = 'utf-8')
 {
     $this->lime->diag($input);
     try {
         $this->lexer->tokenize($input, $encoding);
         $this->lime->fail('exception not thrown');
         if ($message) {
             $this->lime->skip('');
         }
     } catch (Exception $e) {
         $this->lime->pass('exception caught: ' . $e->getMessage());
         if ($message) {
             $this->lime->is($e->getMessage(), $message, 'exception message matches');
         }
     }
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:22,代码来源:xfLexerTester.class.php

示例2: 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

示例3: checkEachFolder

 protected function checkEachFolder(lime_test $t)
 {
     $errors = 0;
     if (!($root = $this->folderTable->getTree()->fetchRoot())) {
         $t->diag('Tree has no root !');
         $errors++;
     } elseif ($root->relPath != '') {
         $t->diag(sprintf('Root relPath != "" (%s)', $root->relPath));
         $errors++;
     } elseif ($root->getNodeParentId() !== null) {
         $t->diag(sprintf('Root->getNodeParentId() = %d', $root->getNodeParentId()));
         $errors++;
     }
     $folders = $this->folderTable->findAll();
     foreach ($folders as $folder) {
         $folder->refresh();
         if ($folder->getNode()->isRoot()) {
             continue;
         }
         if (!($parent = $folder->getNode()->getParent())) {
             $t->diag(sprintf('$folder->getNode()->getParent() == NULL (folder : %s)', $folder));
             $errors++;
         } elseif ($parent->id != $folder->getNodeParentId()) {
             $t->diag(sprintf('$folder->getNode()->getParent()->id != $folder->getNodeParentId() (%d, %d) (folder : %s)', $folder->getNode()->getParent()->id, $folder->getNodeParentId(), $folder));
             $errors++;
             if ($parent->lft >= $folder->lft || $parent->rgt <= $folder->rgt) {
                 $t->diag(sprintf('bad folder / parent lft|rgt (folder %d : %d, %d) (parent %d : %d, %d)', $folder->id, $folder->lft, $folder->rgt, $parent->id, $parent->lft, $parent->rgt));
                 $errors++;
             }
         }
         if ($folder->lft >= $folder->rgt) {
             $t->diag(sprintf('$folder->lft >= $folder->rgt (%d, %d) (folder : %s)', $folder->lft, $folder->rgt, $folder));
             $errors++;
         }
         if (!$folder->lft || !$folder->rgt) {
             $t->diag(sprintf('!$folder->lft || !$folder->rgt (%d, %d) (folder : %s)', $folder->lft, $folder->rgt, $folder));
             $errors++;
         }
     }
     $t->is($errors, 0, "All folders are sane ({$errors} errors)");
 }
开发者ID:theolymp,项目名称:diem,代码行数:41,代码来源:dmMediaUnitTestHelper.php

示例4: launchTests

 /**
  * Test launcher
  *
  * @param string $schema Path to schema file
  */
 function launchTests($schema)
 {
     $this->t->diag('->load()');
     $this->load($schema);
     $this->process();
     $yml = $this->asDoctrineYml();
     $this->t->diag('->getClasses()');
     $classes = $this->getClasses();
     $nbClasses = 12;
     $this->t->is(count($classes), $nbClasses, "->getClasses() should return {$nbClasses} classes from fixture.");
     $this->t->diag('->getClass()');
     $class = $this->getClass('TestClass');
     #$this->t->ok($class->isTable(),"->getClass() should return return class instance.");
     $this->t->diag('->parentTable()');
     $table = $this->parentTable($class);
     $this->t->is(get_class($table), 'sfDoctrineTableSchema', "->parentTable() should return table instance.");
     $this->t->is($this->getClass('ColAggregation')->getTableName(), 'parent_table', 'inheritance gets the right parent table');
     #$this->t->ok($this->getClass('SeparateTable')->isTable(), '"SeparateTable" is a table-class');
     $this->t->is($this->getClass('BookI18n')->getColumn('culture')->getProperty('type'), 'string', 'culture field is defined (as a string)');
     $rel = $this->getClass('BookI18n')->getRelation('id');
     $this->t->is($rel->get('localName'), 'BookI18n', 'i18n relation name is not a plural');
     $this->t->is($this->getClass('ColAggregation')->getTable()->getColumn('class_key')->getProperty('type'), 'integer', 'inheritance field is defined (as an integer)');
     $c = $this->getClass('SeparateTable');
     $SeparateTablePhp = $c->asPhp();
     $SeparateTableSource = $SeparateTablePhp[0]['source'];
     $this->t->like($SeparateTableSource, '/extends Parent/', 'The class "SeparateTable" extends Parent without having any class key field');
     $this->t->like($SeparateTableSource, '@setTableName\\(\'separate_table\'\\)@', 'class "SeparateTable" has both a table and inheritance');
     $this->t->like($SeparateTableSource, '@parent::setTableDefinition\\(\\);@', 'class "SeparateTable" calls parent::setTableDefinition');
     $colAggregationPhp = $this->getClass('ColAggregation')->asPhp();
     $this->t->like($colAggregationPhp[0]['source'], "@setInheritanceMap\\(array\\('class_key'=>1\\)\\)@", 'setInheritanceMap is properly set');
     $this->t->diag('relationships');
     $yangPhp = $this->getClass('Yin')->asPhp();
     $this->t->like($yangPhp[0]['source'], "#hasOne\\('Yang as Yang', 'Yin.yang_id', 'id'\\)#", 'one to one relationships is properly declared');
     $userPhp = $this->getClass('User')->asPhp();
     $this->t->like($userPhp[0]['source'], "#hasMany\\('Book as Books', 'Book.author_id'\\)#", 'hasMany is properly declared');
     $this->t->like($userPhp[0]['source'], "#hasMany\\('Group as Groups', 'User2Group.group_id'\\)#", 'has many to many properly declared');
     $userGroupPhp = $this->getClass('User2Group')->asPhp();
     $this->t->like($userGroupPhp[0]['source'], "#ownsOne\\('User as User', 'User2Group.group_id', 'id'\\)#", 'has many to many with cascade properly defined');
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:44,代码来源:sfDoctrineSchemaDoctrineLoaderTest.php

示例5: dirname

<?php

require dirname(__FILE__) . '/setup.php';
require dirname(__FILE__) . '/db_init.php';
$pdo = new PDO('mysql:host=localhost; dbname=hermit_test', 'root', 'password');
db_init($pdo);
$test = new lime_test();
$test->diag(basename(__FILE__));
$dbmeta = new HermitMySQLDatabaseMeta($pdo);
$test->diag(basename(__FILE__) . '::parameter[in:out]');
$procedureInfo = $dbmeta->getProcedureInfo('PROC_IN_OUT');
$test->ok($procedureInfo !== null);
$parameters = array_map('strtolower', $procedureInfo->getParamNames());
$expect = array('sales', 'tax');
$test->is(count(array_diff($parameters, $expect)), 0);
$test->is($procedureInfo->typeofIn('sales'), true);
$test->is($procedureInfo->typeofOut('sales'), false);
$test->is($procedureInfo->typeofInOut('sales'), false);
$test->is($procedureInfo->typeofIn('tax'), false);
$test->is($procedureInfo->typeofOut('tax'), true);
$test->is($procedureInfo->typeofInOut('tax'), false);
$procedureInfo2 = $dbmeta->getProcedureInfo('PROC_IN_OUT');
$test->ok($procedureInfo === $procedureInfo2, 'same instance');
$test->diag(basename(__FILE__) . '::parameter[in:out:out]');
$procedureInfo = $dbmeta->getProcedureInfo('PROC_IN_OUT_OUT');
$parameters = array_map('strtolower', $procedureInfo->getParamNames());
$expect = array('sales', 'tax', 'total');
$test->is(count(array_diff($parameters, $expect)), 0);
$test->is($procedureInfo->typeofIn('sales'), true);
$test->is($procedureInfo->typeofOut('sales'), false);
$test->is($procedureInfo->typeofInOut('sales'), false);
开发者ID:nowelium,项目名称:Hermit,代码行数:31,代码来源:HermitProcedureInfo_mysqlTest.php

示例6: array

$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');
$html = '<ol><li><a class="link dm_parent" href="symfony">Accueil</a></li><li>></li><li><a class="link dm_parent" href="symfony/domaines">Domaines</a></li><li>></li><li><a class="link dm_parent" href="symfony/domaines/77-cursus-proin1i471j0u">cursus. Proin1i471j0u</a></li><li>></li><li><a class="link dm_parent" href="symfony/domaines/77-cursus-proin1i471j0u/104-trices-interdum-risus-duisgpcinqn1">trices interdum risus. Duisgpcinqn1</a></li><li>></li><li><span class="link dm_current">Info : t, auctor ornare, risus. Donec lo</span></li></ol><span class="link dm_current">Info : t, auctor ornare, risus. Donec lo</span><div class="info_tag list_by_info"><ul class="elements"><li class="element clearfix"><a class="link" href="symfony/domaines/77-cursus-proin1i471j0u/104-trices-interdum-risus-duisgpcinqn1/t-auctor-ornare-risus-donec-lo-79/t-donec">t. Donec</a></li><li class="element clearfix"><a class="link" href="symfony/domaines/77-cursus-proin1i471j0u/104-trices-interdum-risus-duisgpcinqn1/t-auctor-ornare-risus-donec-lo-79/em-ipsu">em ipsu</a></li></ul></div>';
$expected = 'accueil domaines cursus proin1i471j0u trices interdum risus duisgpcinqn1 info t auctor ornare risus donec lo info t auctor ornare risus donec lo t donec em ipsu';
$t->is($currentIndex->cleanText($html), $expected, 'cleaned text : ' . $expected);
$html = '<div>some content<a href="url">a link text  é àî</a>... end</div>';
$expected = 'some content a link text e ai end';
$t->is($currentIndex->cleanText($html), $expected, 'cleaned text : ' . $expected);
// for now this doesn't work on windows
if ('/' !== DIRECTORY_SEPARATOR) {
    return;
}
$t->diag('Populate all indices');
$t->ok($engine->populate(), 'Indices populated');
$t->is($user->getCulture(), sfConfig::get('sf_default_culture'), 'User\'s culture has not been changed');
$t->ok(!file_exists(dmProject::rootify('segments.gen')), 'There is no segments.gen in project root dir');
$t->diag('Optimize all indices');
开发者ID:theolymp,项目名称:diem,代码行数:31,代码来源:dmSearchTest.php

示例7: dirname

<?php

// test/unit/renderer/sympal/mySympalMarkdownRendererTest.php
//  あらかじめパーサー定数を変更しておく
define('MARKDOWN_PARSER_CLASS', 'myMarkdownExtra_Parser');
require_once dirname(__FILE__) . '/../../../bootstrap/unit.php';
$t = new lime_test(3);
// markdownテスト
$t->diag('markdown機能自体をテスト');
$data = "test";
$t->is(mySympalMarkdownRenderer::enhanceHtml(Markdown($data), $data), "<p>test</p>\n", 'markdownレンダリング');
$data = "# test\n## test2";
$t->is(mySympalMarkdownRenderer::enhanceHtml(Markdown($data), $data), "<h1 id=\"" . md5('test') . "\">test</h1>\n\n<h2 id=\"" . md5('test2') . "\">test2</h2>\n", 'markdownレンダリング');
$data = <<<EOT
    [php]
    echo "Hello, World!";
EOT;
$t->is(mySympalMarkdownRenderer::enhanceHtml(Markdown($data), $data), "<pre class=\"php\"><span class=\"kw3\">echo</span> <span class=\"st0\">&quot;Hello, World!&quot;</span>;\n&nbsp;</pre>\n", 'markdownレンダリング(php)');
开发者ID:hidenorigoto,项目名称:sfjp-cms2,代码行数:18,代码来源:mySympalMarkdownRendererTest.php

示例8: dirname

<?php

$app = 'frontend';
include dirname(__FILE__) . '/../../bootstrap/functional.php';
$t = new lime_test(13);
// ->__construct()
$t->diag('->__construct()');
class NumericFieldForm extends ArticleForm
{
    public function configure()
    {
        $this->widgetSchema[1] = new sfWidgetFormInputText();
        $this->validatorSchema[1] = new sfValidatorPass();
        $this->setDefault(1, '==DEFAULT_VALUE==');
    }
}
$form = new NumericFieldForm();
$defaults = $form->getDefaults();
$t->is($defaults[1], '==DEFAULT_VALUE==', '->__construct() allows ->configure() to set defaults on numeric fields');
class DefaultValuesForm extends AuthorForm
{
    public function configure()
    {
        $this->setDefault('name', 'John Doe');
    }
}
$author = new Author();
$form = new DefaultValuesForm($author);
$t->is($form->getDefault('name'), 'John Doe', '->__construct() uses form defaults for new objects');
$author = new Author();
$author->name = 'Jacques Doe';
开发者ID:jaspertomas,项目名称:tmcprogram_tacloban,代码行数:31,代码来源:sfFormDoctrineTest.php

示例9: serialize

class myResponse extends sfResponse
{
    function serialize()
    {
    }
    function unserialize($serialized)
    {
    }
}
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()
开发者ID:mediasadc,项目名称:alba,代码行数:31,代码来源:sfResponseTest.php

示例10: dirname

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../lib/lime/lime.php';
require_once dirname(__FILE__) . '/../../lib/sfServiceContainerAutoloader.php';
sfServiceContainerAutoloader::register();
require_once dirname(__FILE__) . '/../lib/yaml/sfYaml.php';
$t = new lime_test(4);
$dir = dirname(__FILE__) . '/fixtures/yaml';
// ->dump()
$t->diag('->dump()');
$dumper = new sfServiceContainerDumperYaml($container = new sfServiceContainerBuilder());
$t->is($dumper->dump(), file_get_contents($dir . '/services1.yml'), '->dump() dumps an empty container as an empty YAML file');
$container = new sfServiceContainerBuilder();
$dumper = new sfServiceContainerDumperYaml($container);
// ->addParameters()
$t->diag('->addParameters()');
$container = (include dirname(__FILE__) . '/fixtures/containers/container8.php');
$dumper = new sfServiceContainerDumperYaml($container);
$t->is($dumper->dump(), file_get_contents($dir . '/services8.yml'), '->dump() dumps parameters');
// ->addService()
$t->diag('->addService()');
$container = (include dirname(__FILE__) . '/fixtures/containers/container9.php');
$dumper = new sfServiceContainerDumperYaml($container);
$t->is($dumper->dump(), str_replace('%path%', dirname(__FILE__) . '/fixtures/includes', file_get_contents($dir . '/services9.yml')), '->dump() dumps services');
$dumper = new sfServiceContainerDumperYaml($container = new sfServiceContainerBuilder());
开发者ID:BGCX067,项目名称:fajr-svn-to-git,代码行数:30,代码来源:sfServiceContainerDumperYamlTest.php

示例11: DomDocument

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../bootstrap/unit.php';
$t = new lime_test(8);
$dom = new DomDocument('1.0', 'utf-8');
$dom->validateOnParse = true;
// ->configure()
$t->diag('->configure()');
try {
    new sfWidgetFormI18nChoiceCountry(array('culture' => 'en', 'countries' => array('EN')));
    $t->fail('->configure() throws an InvalidArgumentException if a country does not exist');
} catch (InvalidArgumentException $e) {
    $t->pass('->configure() throws an InvalidArgumentException if a country does not exist');
}
$v = new sfWidgetFormI18nChoiceCountry(array('culture' => 'en', 'countries' => array('FR', 'GB')));
$t->is(array_keys($v->getOption('choices')), array('FR', 'GB'), '->configure() can restrict the number of countries with the countries option');
// ->render()
$t->diag('->render()');
$w = new sfWidgetFormI18nChoiceCountry(array('culture' => 'fr'));
$dom->loadHTML($w->render('country', 'FR'));
$css = new sfDomCssSelector($dom);
$t->is($css->matchSingle('#country option[value="FR"]')->getValue(), 'France', '->render() renders all countries as option tags');
$t->is(count($css->matchAll('#country option[value="FR"][selected="selected"]')->getNodes()), 1, '->render() renders all countries as option tags');
// Test for ICU Upgrade and Ticket #7988
开发者ID:Phennim,项目名称:symfony1,代码行数:31,代码来源:sfWidgetFormI18nChoiceCountryTest.php

示例12: dirname

<?php

include dirname(__FILE__) . '/../../bootstrap/unit.php';
include dirname(__FILE__) . '/../../bootstrap/database.php';
sfContext::createInstance($configuration);
sfContext::getInstance()->getUser()->setMemberId(1);
$t = new lime_test(13, new lime_output_color());
$conn = Doctrine::getTable('Application')->getConnection();
$conn->beginTransaction();
$application1 = Doctrine::getTable('Application')->findOneByUrl("http://example.com/dummy.xml");
$application2 = Doctrine::getTable('Application')->findOneByUrl("http://gist.github.com/raw/183505/a7f3d824cdcbbcf14c06f287537d0acb0b3e5468/gistfile1.xsl");
$member = Doctrine::getTable('Member')->find(1);
// ->addToMember()
$t->diag('->addToMember()');
$memberApplication1 = $application2->addToMember($member);
$t->isa_ok($memberApplication1, 'MemberApplication', '->addToMember() return MemberApplication object');
$memberApplication2 = $application2->addToMember($member, array('is_view_home' => true));
$applicationSettings = $memberApplication2->getApplicationSettings();
$t->ok(is_array($applicationSettings) && count($applicationSettings) === 1, '->addToMember() save member Application Settings');
// ->isHadByMember()
$t->diag('->isHadByMember()');
$t->ok($application1->isHadByMember(), '->isHadByMember() return true when the member has the application');
$t->ok($application1->isHadByMember(1), '->isHadByMember() return true when the member has the application');
$t->ok(!$application1->isHadByMember(999), '->isHadByMember() return false when the member has not the application');
// ->getMemberListPager()
$t->diag('->getMemberListPager()');
$t->isa_ok($application1->getMemberListPager(), 'sfDoctrinePager', '->getMemberListPager() return sfDoctrinePager object');
// ->getPersistentData()
$t->diag('->getPersistentData()');
$t->isa_ok($application1->getPersistentData(1, 'test_key'), 'ApplicationPersistentData', '->getPersistentData() return ApplicationPersisetentData object');
// ->getPersistentDatas()
开发者ID:rysk92,项目名称:opOpenSocialPlugin,代码行数:31,代码来源:ApplicationTest.php

示例13: 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');
开发者ID:te-koyama,项目名称:openpne,代码行数:22,代码来源:NotificationMailTableTest.php

示例14: dirname

        id:          ~
        name:        varchar(255)
      comment:
        id:          ~
        content:     varchar(255)
        article_id:  ~
        author_id:   ~

Beware that the tables for these models will be emptied by the tests, so use a test database connection.
*/

include dirname(__FILE__).'/../../bootstrap.php';

$t = new lime_test(34, new lime_output_color());

$t->diag('getUniqueIdentifier()');

$id1 = DbFinder::from('Article')->where('Title', 'foo')->getUniqueIdentifier();
$id2 = DbFinder::from('Article')->where('Title', 'foo')->getUniqueIdentifier();
$t->is($id1, $id2, 'Similar queries get the same unique identifier');

$id1 = DbFinder::from('Article')->where('Title', 'foo')->getUniqueIdentifier();
$id2 = DbFinder::from('Article')->where('Title', 'bar')->getUniqueIdentifier();
$t->isnt($id1, $id2, 'Different queries get a different unique identifier');

$id1 = DbFinder::from('Article')->getUniqueIdentifier();
$id2 = DbFinder::from('Comment')->getUniqueIdentifier();
$t->isnt($id1, $id2, 'unique identifier takes main model class into account');

$id1 = DbFinder::from('Article')->where('Title', 'foo')->with('Category')->getUniqueIdentifier();
$id2 = DbFinder::from('Article')->where('Title', 'foo')->getUniqueIdentifier();
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:31,代码来源:sfPropelFinderCacheTest.php

示例15: dirname

<?php

$app = 'frontend';
$fixtures = 'fixtures/fixtures.yml';
include dirname(__FILE__) . '/../../bootstrap/functional.php';
$t = new lime_test(4);
// ->getChoices()
$t->diag('->getChoices()');
$validator = new sfWidgetFormDoctrineChoice(array('model' => 'Author'));
$author = Doctrine_Core::getTable('Author')->createQuery()->limit(1)->fetchOne();
$t->is_deeply($validator->getChoices(), array(1 => 'Jonathan H. Wage', 2 => 'Fabien POTENCIER'), '->getChoices() returns choices');
$validator->setOption('order_by', array('name', 'asc'));
$t->cmp_ok($validator->getChoices(), '===', array(2 => 'Fabien POTENCIER', 1 => 'Jonathan H. Wage'), '->getChoices() returns ordered choices');
$validator->setOption('table_method', 'testTableMethod');
$t->is_deeply($validator->getChoices(), array(1 => 'Jonathan H. Wage', 2 => 'Fabien POTENCIER'), '->getChoices() returns choices for given "table_method" option');
$validator = new sfWidgetFormDoctrineChoice(array('model' => 'Author', 'query' => Doctrine_Core::getTable('Author')->createQuery()->limit(1)));
$t->is_deeply($validator->getChoices(), array(1 => 'Jonathan H. Wage'), '->getChoices() returns choices for given "query" option');
开发者ID:Phennim,项目名称:symfony1,代码行数:17,代码来源:sfWidgetFormDoctrineChoiceTest.php


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