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


PHP lime_test::cmp_ok方法代码示例

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


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

示例1: 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('Member::getProfiles()');
$member = MemberPeer::retrieveByPK(1);
$t->isa_ok($member->getProfiles(), 'array', 'getProfiles() returns array');
//------------------------------------------------------------
$t->diag('Member::getProfile()');
$t->cmp_ok($member->getProfile('sex'), '===', 1, 'getProfile() returns a value');
$t->cmp_ok($member->getProfile('self_intro'), '===', 'よろしくお願いします。', 'getProfile() returns a value');
$t->cmp_ok($member->getProfile('example'), '===', NULL, 'getProfile() returns NULL if profileName is not registerd by member');
$t->cmp_ok($member->getProfile('unknown'), '===', NULL, 'getProfile() returns NULL if profileName does not exist');
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:15,代码来源:MemberTest.php

示例2: dirname

<?php

include_once dirname(__FILE__) . '/../../../bootstrap/unit.php';
include_once dirname(__FILE__) . '/../../../bootstrap/database.php';
$t = new lime_test(2, new lime_output_color());
$banner1 = Doctrine::getTable('Banner')->findOneByName('banner1');
$banner2 = Doctrine::getTable('Banner')->findOneByName('banner2');
//------------------------------------------------------------
$t->diag('Banner');
$t->diag('Banner::getRandomImage()');
$result = $banner1->getRandomImage();
$t->isa_ok($result, 'BannerImage');
$result = $banner2->getRandomImage();
$t->cmp_ok($result, '===', false);
开发者ID:te-koyama,项目名称:openpne,代码行数:14,代码来源:BannerTest.php

示例3: count

$finder->where('Title', 'bar')->find();
$SQL1 = $finder->getLatestQuery();
$finder->where('Title', 'foo')->with('Category')->find();
$SQL2 = $finder->getLatestQuery();
$t->is($SQL1, $SQL2, 'Cached complex queries do not trigger SQL queries');

// Count queries

$cache->clear();

$finder = DbFinder::from('Article')->useCache($cache, 10);
$finder = $finder->where('Title', 'foo')->with('Category');
$key = $finder->getUniqueIdentifier();
$t->is($cache->get($key.'_count'), null, 'No cache is set until the query is executed');
$finder->count();
$t->cmp_ok($cache->get($key.'_count'), '!==', null, 'useCache() activates query caching on count() queries');
$finder->where('Title', 'bar')->find();
$SQL1 = $finder->getLatestQuery();
$finder->where('Title', 'foo')->with('Category')->count();
$SQL2 = $finder->getLatestQuery();
$t->is($SQL1, $SQL2, 'Cached count queries do not trigger SQL queries');

// select()

$finder = DbFinder::from('Article')->useCache($cache, 10);
$finder = $finder->where('Title', 'foo')->select('Title');
$key = $finder->getUniqueIdentifier();
$t->is($cache->get($key), null, 'No cache is set until the query is executed');
$finder->find();
$t->cmp_ok($cache->get($key), '!==', null, 'useCache() activates query caching on find() queries called after select()');
$finder->where('Title', 'bar')->find();
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:31,代码来源:sfPropelFinderCacheTest.php

示例4: array

// select_tag()
$t->diag('select_tag()');
$t->is(select_tag('name'), '<select name="name" id="name"></select>', 'select_tag() takes a name as its first argument');
$option_for_select = options_for_select(array('item1'));
$t->is(select_tag('name', $option_for_select), '<select name="name" id="name">' . $option_for_select . '</select>', 'select_tag() takes an HTML string of options as its second argument');
$t->is(select_tag('name', array('item1')), '<select name="name" id="name">' . $option_for_select . '</select>', 'select_tag() takes an array of options as its second argument');
// options
$t->is(select_tag('name', $option_for_select, array('class' => 'foo')), '<select name="name" id="name" class="foo">' . $option_for_select . '</select>', 'select_tag() takes an array of attribute options as its third argument');
$t->is(select_tag('name', $option_for_select, array('multiple' => true)), '<select name="name[]" id="name" multiple="multiple">' . $option_for_select . '</select>', 'select_tag() takes a "multiple" boolean option');
$t->is(select_tag('name[]', $option_for_select, array('multiple' => true)), '<select name="name[]" id="name" multiple="multiple">' . $option_for_select . '</select>', 'select_tag() takes a "multiple" boolean option');
$t->is(select_tag('name', $option_for_select, array('multiple' => false)), '<select name="name" id="name">' . $option_for_select . '</select>', 'select_tag() takes a "multiple" boolean option');
$t->is(select_tag('name', $option_for_select, array('id' => 'bar')), '<select name="name" id="bar">' . $option_for_select . '</select>', 'select_tag() can take a "id" option');
// select_country_tag()
$t->diag('select_country_tag()');
$t->like(select_country_tag('name'), '/' . preg_quote('<select name="name" id="name">') . '/', 'select_country_tag() takes a name as its first argument');
$t->cmp_ok(preg_match_all('/<option/', select_country_tag('name'), $matches), '>', 200, 'select_country_tag() takes a name as its first argument');
$t->like(select_country_tag('name', 'FR'), '/' . preg_quote('<option value="FR" selected="selected">') . '/', 'select_country_tag() takes an ISO code for the selected country as its second argument');
// options
$t->like(select_country_tag('name', null, array('class' => 'foo')), '/' . preg_quote('<select name="name" id="name" class="foo">') . '/', 'select_country_tag() takes an array of options as its third argument');
$t->is(preg_match_all('/<option/', select_country_tag('name', null, array('countries' => array('FR', 'GB'))), $matches), 2, 'select_country_tag() takes a "countries" option');
// select_language_tag()
$t->diag('select_language_tag()');
$t->like(select_language_tag('name'), '/' . preg_quote('<select name="name" id="name">') . '/', 'select_language_tag() takes a name as its first argument');
$t->cmp_ok(preg_match_all('/<option/', select_language_tag('name'), $matches), '>', 200, 'select_language_tag() takes a name as its first argument');
$t->like(select_language_tag('name', 'fr'), '/' . preg_quote('<option value="fr" selected="selected">') . '/', 'select_language_tag() takes an ISO code for the selected language as its second argument');
// option
$t->like(select_language_tag('name', null, array('class' => 'foo')), '/' . preg_quote('<select name="name" id="name" class="foo">') . '/', 'select_language_tag() takes an array of options as its third argument');
$t->is(preg_match_all('/<option/', select_language_tag('name', null, array('languages' => array('fr', 'en'))), $matches), 2, 'select_language_tag() takes a "languages" option');
// input_tag()
$t->diag('input_tag()');
$t->is(input_tag('name'), '<input type="text" name="name" id="name" value="" />', 'input_tag() takes a name as its first argument');
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:31,代码来源:FormHelperTest.php

示例5: 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');
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:29,代码来源:MemberProfilePeerTest.php

示例6: dirname

<?php

include_once dirname(__FILE__) . '/../../../bootstrap/unit.php';
include_once dirname(__FILE__) . '/../../../bootstrap/database.php';
$t = new lime_test(11, new lime_output_color());
$table = Doctrine::getTable('SnsTerm');
//------------------------------------------------------------
$t->diag('SnsTermTable');
$t->diag('SnsTermTable::set()');
$table->configure(null, null);
$t->cmp_ok($table->set('foo', 'bar'), '===', false);
$table->configure('en', 'pc_frontend');
$table->set('foo', 'foo', 'en', 'pc_frontend');
$t->ok($table->findOneByName('foo'));
$table->set('bar', 'bar', 'en', 'pc_frontend');
$t->ok($table->findOneByName('bar'));
//------------------------------------------------------------
$t->diag('SnsTermTable::offsetGet()');
$t->is((string) $table['friend'], 'friend');
$t->is((string) $table['Friend'], 'Friend');
$t->is((string) $table['xxxxxxxxxx'], '');
//------------------------------------------------------------
$t->diag('SnsTermTable::offsetExists()');
$t->ok(isset($table['friend']));
$t->ok(isset($table['Friend']));
$t->ok(!isset($table['xxxxxxxxxx']));
//------------------------------------------------------------
$t->diag('SnsTermTable::offsetSet()');
try {
    $table['foo'] = 'bar';
    $t->fail();
开发者ID:te-koyama,项目名称:openpne,代码行数:31,代码来源:SnsTermTableTest.php

示例7: dirname

<?php

include dirname(__FILE__) . '/../../../bootstrap/unit.php';
$t = new lime_test(14, new lime_output_color());
$baseAssetsDir = realpath($np_plugin_dir . '/test/data');
// optimizeFile()
$t->diag('optimizeFile()');
$o = new npOptimizerJavascript(new sfEventDispatcher(), array('driver' => 'JSMin', 'destination' => 'blah', 'files' => array()), $baseAssetsDir);
$jsFile = $np_plugin_dir . '/test/data/js/foo.js';
$result = $o->optimizeFile($jsFile);
$t->isa_ok($result, 'array', 'optimizeFile() returns an array');
$t->ok(array_key_exists('optimizedSize', $result), 'optimizeFile() returns an array containing "optimizedSize" key');
$t->ok(array_key_exists('originalSize', $result), 'optimizeFile() returns an array containing "originalSize" key');
$t->ok(array_key_exists('ratio', $result), 'optimizeFile() returns an array containing "ratio" key');
$t->is($result['originalSize'], filesize($jsFile), 'optimizeFile() has coherent results');
$t->cmp_ok($result['optimizedSize'], '<', $result['originalSize'], 'optimizeFile() optimizes js contents');
$t->diag('optimize()');
// Natural order
$o = new npOptimizerJavascript(new sfEventDispatcher(), array('driver' => 'JSMinPlus', 'destination' => '/js/my_combined.js', 'files' => array('1.js', '2.js', '3.js')), $baseAssetsDir);
$result = $o->optimize($jsFile);
$t->isa_ok($result, 'array', 'optimize() returns an array');
$t->is(count($result), 2, 'optimize() returns two keys');
$t->ok(array_key_exists('generatedFile', $result), 'optimize() returns an "generatedFile" key');
$t->is($result['generatedFile'], $baseAssetsDir . '/js/my_combined.js', 'optimize() returns the expected "generatedFile" result');
$t->ok(array_key_exists('statistics', $result), 'optimize() returns a "statistics" key');
$t->is(file_get_contents($baseAssetsDir . '/js/my_combined.js'), 'var run1=function(){alert(1)}var run2=function(){alert(2)}var run3=function(){alert(3)}', 'optimize() generated the correct optimized file contents');
$t->is(array_keys($result['statistics']), array($baseAssetsDir . '/js/1.js', $baseAssetsDir . '/js/2.js', $baseAssetsDir . '/js/3.js'), 'optimize() returns correct "statistics" keys');
// Different order
$o = new npOptimizerJavascript(new sfEventDispatcher(), array('driver' => 'JSMinPlus', 'destination' => '/js/my_combined.js', 'files' => array('3.js', '2.js', '1.js')), $baseAssetsDir);
$result = $o->optimize($jsFile);
$t->is(file_get_contents($baseAssetsDir . '/js/my_combined.js'), 'var run3=function(){alert(3)}var run2=function(){alert(2)}var run1=function(){alert(1)}', 'optimize() generated the correct optimized file contents, in the specified order');
开发者ID:n1k0,项目名称:npAssetsOptimizerPlugin,代码行数:31,代码来源:npOptimizerJavascriptTest.php

示例8: array

//------------------------------------------------------------
$t->diag('MemberRelationshipTable::retrievesByMemberIdFrom()');
$result = $table->retrievesByMemberIdFrom(1);
$t->isa_ok($result, 'Doctrine_Collection');
$t->is($result->count(), 6);
//------------------------------------------------------------
$t->diag('MemberRelationshipTable::getFriendListPager()');
$t->isa_ok($table->getFriendListPager(1), 'sfDoctrinePager');
//------------------------------------------------------------
$t->diag('MemberRelationshipTable::getFriendMemberIds()');
$t->is($table->getFriendMemberIds(1), array(2, 4, 7, 8));
//------------------------------------------------------------
$t->diag('MemberRelationship::getFriends()');
$t->isa_ok($table->getFriends(1, 1, false), 'Doctrine_Collection', 'getFriends() returns Doctrine_Collection');
$randomFriend = $table->getFriends(1, 3, true)->toArray();
$t->cmp_ok(count($randomFriend), '<=', 3, 'getFriends() returns 3 records at most');
if (1 < count($randomFriend)) {
    $isRandom = false;
    for ($i = 0; $i < 10; $i++) {
        $current = $table->getFriends(1, 3, true)->toArray();
        if ($current !== $randomFriend) {
            $isRandom = true;
            break;
        }
    }
    $t->is($isRandom, true, 'getFriends() returns random order');
} else {
    $t->skip('getFriends() returns random order (too few friends)');
}
if (3 < count($randomFriend)) {
    $randomFriend = $table->getFriends(1, 3, true)->toArray();
开发者ID:te-koyama,项目名称:openpne,代码行数:31,代码来源:MemberRelationshipTableTest.php

示例9:

// getAlbumImagePager()
$result = $table->getAlbumImagePager();
$t->isa_ok($result, 'sfDoctrinePager', "->getAlbumImagePager() returns sfDoctrinePager's instance.");
$t->is($result->getNbResults(), 4, '->getAlbumImagePager() returns 4 items.');
$result = $table->getAlbumImagePager($album1);
$t->isa_ok($result, 'sfDoctrinePager', "->getAlbumImagePager() returns sfDoctrinePager's instance.");
$t->is($result->getNbResults(), 2, '->getAlbumImagePager() returns 2 items.');
$result = $table->getAlbumImagePager($album3);
$t->isa_ok($result, 'sfDoctrinePager', "->getAlbumImagePager() returns sfDoctrinePager's instance.");
$t->is($result->getNbResults(), 0, '->getAlbumImagePager() returns empty result.');
// getAlbumImagePagerForAlbum()
$result = $table->getAlbumImagePagerForAlbum($album1->id);
$t->isa_ok($result, 'sfDoctrinePager', "->getAlbumImagePagerForAlbum() returns sfDoctrinePager's instance.");
$t->is($result->getNbResults(), 2, '->getAlbumImagePagerForAlbum() returns 2 items.');
// getAlbumImageSearchPager()
$result = $table->getAlbumImageSearchPager(array('foo'));
$t->isa_ok($result, 'sfDoctrinePager', "->getAlbumImageSearchPager() returns sfDoctrinePager's instance.");
$t->is($result->getNbResults(), 3, '->getAlbumImageSearchPager() returns 3 items.');
$result = $table->getAlbumImageSearchPager(array("Nobody", "expects", "the", "Spanish", "Inquisition"));
$t->isa_ok($result, 'sfDoctrinePager', "->getAlbumImageSearchPager() returns sfDoctrinePager's instance.");
$t->is($result->getNbResults(), 0, '->getAlbumImageSearchPager() returns empty.');
// getPreviousAlbumImage()
$t->cmp_ok($table->getPreviousAlbumImage($albumImage1, 1), '===', false, '->getPreviousAlbumImage() returns false.');
$result = $table->getPreviousAlbumImage($albumImage2, 1);
$t->isa_ok($result, 'AlbumImage', "->getPreviousAlbumImage() returns AlbumImage's instance.");
$t->is($result->id, $albumImage1->id, '->getPreviousAlbumImage() returns previous AlbumImage corectlly.');
// getNextAlbumImage()
$result = $table->getNextAlbumImage($albumImage1, 1);
$t->isa_ok($result, 'AlbumImage', "->getNextAlbumImage() returns AlbumImage's instance.");
$t->is($result->id, $albumImage2->id, '->getNextAlbumImage() returns next AlbumImage corectlly.');
$t->cmp_ok($table->getNextAlbumImage($albumImage2, 1), '===', false, '->getNextAlbumImage() returns false.');
开发者ID:kawahara,项目名称:opAlbumPlugin,代码行数:31,代码来源:AlbumImageTableTest.php

示例10: dirname

include_once dirname(__FILE__) . '/fixtures/TestActivityTemplateConfigHandler.php';
$user = sfContext::getInstance()->getUser();
$user->setAuthenticated(true);
$user->setMemberId(1);
$t = new lime_test(40, new lime_output_color());
$table = Doctrine::getTable('ActivityData');
//------------------------------------------------------------
$t->diag('ActivityDataTable');
$t->diag('ActivityDataTable::updateActivity()');
$result = $table->updateActivity(1, 'test1');
$t->isa_ok($result, 'ActivityData', '->updateActivity() returns instance of ActivityData');
$result = $table->updateActivity(1, 'test2', array('public_flag' => 2, 'in_reply_to_activity_id' => 1, 'is_pc' => false, 'is_mobile' => false, 'source' => 'API', 'source_uri' => 'http://sns.example.com', 'images' => array(array('uri' => 'http://sns.example.com/test.png', 'mime_type' => 'image/png')), 'uri' => 'http://sns.example.com'));
$t->isa_ok($result, 'ActivityData', '->updateActivity() returns instance of ActivityData');
$t->is($result->getPublicFlag(), 2, 'public_flag of ActivityData that created by ->updateActivity() is 2');
$t->is($result->getInReplyToActivityId(), 1, 'in_reply_to_activity_id of ActivityData that creatd by ->updateActivity() is 1');
$t->cmp_ok($result->getIsPc(), '===', false, 'is_pc of ActivityData that creatd by ->updateActivity() is false');
$t->cmp_ok($result->getIsMobile(), '===', false, 'is_mobile of ActivityData that creatd by ->updateActivity() is false');
$t->is($result->getSource(), 'API', 'source of ActivityData that creatd by ->updateActivity() is "API"');
$t->is($result->getSourceUri(), 'http://sns.example.com', 'source_uri of ActivityData that creatd by ->updateActivity() is "http://sns.example.com"');
$t->is(count($result->getImages()), 1, 'images of ActivityData that created by ->updateActivity() has 1 item');
$msg = '->updateActivity() throw LogicException when public_flag option is bad';
try {
    $result = $table->updateActivity(1, 'test3', array('public_flag' => 999));
    $t->fail($msg);
} catch (LogicException $e) {
    $t->pass($msg);
}
$msg = '->updateActivity() throw LogicException when images option is bad';
try {
    $result = $table->updateActivity(1, 'test4', array('images' => array(array('uri' => 'http://sns.example.com/image.png'))));
    $t->fail($msg);
开发者ID:te-koyama,项目名称:openpne,代码行数:31,代码来源:ActivityDataTableTest.php

示例11: 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('ProfilePeer::retrieveByIsDispRegist()');
$profiles = ProfilePeer::retrieveByIsDispRegist();
$t->isa_ok($profiles, 'array', 'retrieveByIsDispRegist() returns an array');
foreach ($profiles as $profile) {
    $t->isa_ok($profile, 'Profile', 'each profile is a Profile');
    $t->cmp_ok($profile->getIsDispRegist(), '===', true, 'Profile::getIsDispRegist() returns true');
}
//------------------------------------------------------------
$t->diag('ProfilePeer::retrieveByIsDispConfig()');
$profiles = ProfilePeer::retrieveByIsDispConfig();
$t->isa_ok($profiles, 'array', 'retrieveByIsDispConfig() returns an array');
foreach ($profiles as $profile) {
    $t->isa_ok($profile, 'Profile', 'each profile is a Profile');
    $t->cmp_ok($profile->getIsDispConfig(), '===', true, 'Profile::getIsDispConfig() returns true');
}
//------------------------------------------------------------
$t->diag('ProfilePeer::retrieveByIsDispSearch()');
$profiles = ProfilePeer::retrieveByIsDispSearch();
$t->isa_ok($profiles, 'array', 'retrieveByIsDispSearch() returns an array');
foreach ($profiles as $profile) {
    $t->isa_ok($profile, 'Profile', 'each profile is a Profile');
    $t->cmp_ok($profile->getIsDispSearch(), '===', true, 'Profile::getIsDispSearch() returns true');
}
//------------------------------------------------------------
$t->diag('ProfilePeer::retrieveByName()');
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:31,代码来源:ProfilePeerTest.php

示例12: Exception

{
	$t->fail('failed to convert xml to yml, error was: '.$e->getMessage());
}*/
// this test the converter from yml to xml and regenerate the yml to match
// the original. this way, no need to do a comparison on the xml (which can
// slightly differ)
try {
    $xml = sfSqlDesignerLib::loadFromSchema(dirname(__FILE__) . '/books.yml');
    if (!$xml) {
        throw new Exception('empty xml in return');
    }
} catch (Exception $e) {
    $t->fail('failed to convert xml to yml, error was: ' . $e->getMessage());
}
$xmlHeader = '/^<\\?xml version="1.0" encoding="utf-8" \\?>\\n<sql>\\n<datatypes db="symfony-doctrine">/';
$t->like($xml, $xmlHeader, 'xml as a proper header');
$xmlFooter = '/<\\/table>\\n<\\/sql>/';
$t->like($xml, $xmlFooter, 'xml as a proper footer');
try {
    sfSqlDesignerLib::saveToSchema($xml, '/tmp/test.yml');
    if (!file_exists('/tmp/test.yml')) {
        throw new Exception('yml file as not been saved to disk');
    }
} catch (Exception $e) {
    $t->fail('failed to convert xml to yml, error was: ' . $e->getMessage());
}
$result = file_get_contents('/tmp/test.yml');
unlink('/tmp/test.yml');
$books = file_get_contents(dirname(__FILE__) . '/books.yml');
$t->cmp_ok($result, '===', $books, 'generated xml was as expected and yml generated as original');
开发者ID:jphpsf,项目名称:sfSqlDesignerPlugin,代码行数:30,代码来源:sfSqlDesignerPluginUnit.php

示例13: 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('SnsConfigPeer::retrieveByName()');
$config = SnsConfigPeer::retrieveByName('SNS_NAME');
$t->isa_ok($config, 'SnsConfig', 'retrieveByName() returns a SnsConfig');
$t->is($config->getValue(), 'MySNS', 'SnsConfig::getValue() returns a value');
$t->cmp_ok(SnsConfigPeer::retrieveByName('unknown'), '===', NULL, 'retrieveByName() returns NULL if name does not exist');
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:11,代码来源:SnsConfigPeerTest.php

示例14: dirname

include dirname(__FILE__) . '/../../../bootstrap/database.php';
sfContext::createInstance($configuration);
sfContext::getInstance()->getUser()->setMemberId(1);
$t = new lime_test(10, new lime_output_color());
$member1 = Doctrine::getTable('Member')->find(1);
$member2 = Doctrine::getTable('Member')->find(2);
$member3 = Doctrine::getTable('Member')->find(3);
$album1 = Doctrine::getTable('Album')->find(1);
$album2 = Doctrine::getTable('Album')->find(2);
$album3 = Doctrine::getTable('Album')->find(3);
$albumImage1 = Doctrine::getTable('AlbumImage')->find(1);
$albumImage2 = Doctrine::getTable('AlbumImage')->find(2);
$albumImage3 = Doctrine::getTable('AlbumImage')->find(3);
$conn = Doctrine::getTable('AlbumImage')->getConnection();
// isAuthor()
$t->cmp_ok($albumImage1->isAuthor(1), '===', true, '->isAuthor() returns true.');
$t->cmp_ok($albumImage1->isAuthor(2), '===', false, '->isAuthor() returns false.');
// getPrevious()
$t->cmp_ok($albumImage1->getPrevious(), '===', false, '->getPrevious() returns false.');
$result = $albumImage2->getPrevious();
$t->isa_ok($result, 'AlbumImage', "->getPrevious() returns AlbumImage's instance.");
$t->is($result->id, $albumImage1->id, '->getPrevious() returns previous AlbumImage corectlly.');
// getNext()
$result = $albumImage1->getNext();
$t->isa_ok($result, 'AlbumImage', "->getNext() returns AlbumImage's instance.");
$t->is($result->id, $albumImage2->id, '->getNext() returns next AlbumImage corectlly.');
$t->cmp_ok($albumImage2->getNext(), '===', false, '->getNext() returns false.');
// save()
$conn->beginTransaction();
$file_new = new File();
$data = array('tmp_name' => dirname(__FILE__) . '/../../../images/OpenPNE.jpg', 'type' => 'image/jpeg', 'size' => 8327, 'name' => 'OpenPNE.jpg');
开发者ID:kawahara,项目名称:opAlbumPlugin,代码行数:31,代码来源:AlbumImageTest.php

示例15:

$t->diag('Community::isPrivilegeBelong()');
$t->is($community1->isPrivilegeBelong(1), true, 'isPrivilegeBelong() checks the member belonged');
$t->is($community2->isPrivilegeBelong(2), true, 'isPrivilegeBelong() checks the member belonged');
$t->is($community1->isPrivilegeBelong(3), false, 'isPrivilegeBelong() checks the member not belonged');
$t->is($community2->isPrivilegeBelong(1), false, 'isPrivilegeBelong() checks the member not belonged');
//------------------------------------------------------------
$t->diag('Community::isAdmin()');
$t->is($community1->isAdmin(1), true, 'isAdmin() returns true for admin');
$t->is($community1->isAdmin(2), false, 'isAdmin() returns false for not admin');
//------------------------------------------------------------
$t->diag('Community::countCommunityMembers()');
$t->is($community1->countCommunityMembers(), 2, 'countCommunityMembers() returns 2');
//------------------------------------------------------------
$t->diag('Community::getNameAndCount()');
$t->is($community1->getNameAndCount(), 'CommunityA (2)', 'getNameAndCount() returns a string formated "%s (%d)"');
$t->is($community1->getNameAndCount('[%s] - %d'), '[CommunityA] - 2', 'getNameAndCount() returns a string formated "[%s] - %d"');
//------------------------------------------------------------
$t->diag('Community::getRegisterPoricy()');
$t->is($community1->getRegisterPoricy(), 'Everyone can join', 'getRegisterPoricy() returns "Everyone can join" for opened community');
$t->is($community2->getRegisterPoricy(), '%Community%\'s admin authorization needed', 'getRegisterPoricy() returns "Community\'s admin authorization needed" for closed community');
//------------------------------------------------------------
$t->diag('Community::getChangeAdminRequestMember()');
$object = $community4->getChangeAdminRequestMember();
$t->ok($object instanceof Member && $object->getId() == 2, 'getChangeAdminRequestMember() returns an instance of Member 2');
$t->cmp_ok($community1->getChangeAdminRequestMember(), '===', null, 'getChangeAdminRequestMember() returns null');
//------------------------------------------------------------
$t->diag('Community::generateRoleId()');
$t->is($community1->generateRoleId(Doctrine::getTable('Member')->find(1)), 'admin', 'generateRoleId() returns "admin"');
$t->is($community1->generateRoleId(Doctrine::getTable('Member')->find(2)), 'member', 'generateRoleId() returns "member"');
$t->is($community1->generateRoleId(Doctrine::getTable('Member')->find(3)), 'everyone', 'generateRoleId() returns "everyone"');
$t->is($community5->generateRoleId(Doctrine::getTable('Member')->find(2)), 'sub_admin', 'generateRoleId() returns "sub_admin"');
开发者ID:phenom,项目名称:OpenPNE3,代码行数:31,代码来源:CommunityTest.php


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