當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sfTestFunctional::getAndCheck方法代碼示例

本文整理匯總了PHP中sfTestFunctional::getAndCheck方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfTestFunctional::getAndCheck方法的具體用法?PHP sfTestFunctional::getAndCheck怎麽用?PHP sfTestFunctional::getAndCheck使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sfTestFunctional的用法示例。


在下文中一共展示了sfTestFunctional::getAndCheck方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dirname

<?php

require_once dirname(__FILE__) . '/../../bootstrap/functional.php';
# load fixtures of this plugin
$propelData->loadData(sfConfig::get('sf_plugins_dir') . '/sfNewsletterPlugin/data/fixtures');
$browser = new sfTestFunctional(new sfBrowser());
$limeTest = $browser->test();
$browser->getAndCheck('sfSubscription', 'subscribe', '/newsletter/subscription', 200);
$browser->responseContains(sfSubscribeForm::PARAMETER_NAME);
$name = 'A valid username';
$email = 'valid-email@example.com';
$postData = array('name' => $name, 'email' => $email);
$browser->post('/newsletter/subscription', array(sfSubscribeForm::PARAMETER_NAME => $postData));
$browser->isStatusCode(200);
$browser->responseContains('An email has been sent to you, in order to verify your address.');
$limeTest->plan += 3;
$subscriber = SubscriberPeer::retrieveByEmail($email);
$limeTest->isa_ok($subscriber, 'Subscriber', 'Subscriber found.');
$limeTest->is($subscriber->getName(), $name, 'Name matches.');
$limeTest->is($subscriber->getEmail(), $email, 'Email matches.');
$limeTest->plan += 3;
$activationHash = $subscriber->getActivateHash();
$unsubscribeHash = $subscriber->getUnsubscribeHash();
$limeTest->isnt(empty($activationHash), true, 'Activation Hash set.');
$limeTest->isnt(empty($unsubscribeHash), true, 'Unsubscribe Hash set.');
$limeTest->isnt($subscriber->isSubscribed(), true, 'Subscriber is not activated, yet.');
# test activation and unsubscribe with fixtures
$limeTest->plan += 1;
$subscriber = SubscriberPeer::retrieveByEmail('subscriber-two@example.com');
$limeTest->ok(!$subscriber->isSubscribed(), 'Subscriber not activated, yet.');
$browser->getAndCheck('sfSubscription', 'activate', '/newsletter/subscription/activate/' . $subscriber->getId() * 42 . '?' . activateAction::PARAMETER_NAME . '=invalid', 404);
開發者ID:havvg,項目名稱:sfNewsletterPlugin,代碼行數:31,代碼來源:sfNewsletterPlugin-SubscriptionTest.php

示例2: dirname

<?php

require_once dirname(__FILE__) . '/../../bootstrap/functional.php';
# load fixtures of this plugin
$propelData->loadData(sfConfig::get('sf_plugins_dir') . '/sfNewsletterPlugin/data/fixtures');
$browser = new sfTestFunctional(new sfBrowser());
$limeTest = $browser->test();
$limeTest->plan += 1;
$newsletter = NewsletterPeer::retrieveByName('second newsletter');
$limeTest->isa_ok($newsletter, 'Newsletter', 'Newsletter found.');
$browser->getAndCheck('sfNewsletter', 'read', '/newsletter/read/' . 0, 404);
$browser->getAndCheck('sfNewsletter', 'read', '/newsletter/read/' . $newsletter->getId(), 200);
$browser->responseContains($newsletter->getContent());
開發者ID:havvg,項目名稱:sfNewsletterPlugin,代碼行數:13,代碼來源:sfNewsletterPlugin-NewsletterTest.php

示例3: sfTestFunctional

$app = 'frontend';
$fixtures = 'fixtures/fixtures.yml';
if (!include(dirname(__FILE__).'/../bootstrap/functional.php'))
{
  return;
}

$browser = new sfTestFunctional(new sfBrowser());

ArticlePeer::doDeleteAll();
$category = CategoryPeer::doSelectOne(new Criteria());

foreach (range(1, 20) as $n)
{
  $article = new Article();
  $article->setTitle(sprintf('Article #%s', $n));
  $article->setCategory($category);
  $article->save();
}

$browser
  ->getAndCheck('pager', 'interfaces')

  ->with('response')->begin()
    ->checkElement('#pagerResults li', 10)

    ->checkElement('#pagerCount:contains(20)')
  ->end()
;
開發者ID:nurhidayatullah,項目名稱:inventory,代碼行數:29,代碼來源:pagerTest.php

示例4: dirname

<?php

require_once dirname(__FILE__) . '/../../bootstrap/functional.php';
// set up test env correctly
sfConfig::set('app_xcssplugin_path_to_css_dir', sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . 'sfXCSSPlugin' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR);
sfConfig::set('app_xcssplugin_saveforweb', 'xcss');
$browser = new sfTestFunctional(new sfBrowser());
$limeTest = $browser->test();
$limeTest->plan++;
$limeTest->ok(!file_exists($filename), 'File does not exist.');
$limeTest->plan++;
$limeTest->is(sfConfig::get('app_xcssplugin_saveforweb'), 'xcss', 'Save For Web enabled.');
$browser->getAndCheck('xcss', 'process', '/xcss/stylesheet.css', 200);
$browser->responseContains('h1 {border: #F00 1px solid;}');
$browser->isResponseHeader('Content-Type', 'text/css; charset=utf-8');
$limeTest->plan++;
$filename = sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . 'xcss' . DIRECTORY_SEPARATOR . 'stylesheet.css';
$limeTest->ok(file_exists($filename), 'File has been saved for web access.');
// cleanup
$limeTest->plan++;
$limeTest->ok(unlink($filename), 'File has been removed.');
開發者ID:havvg,項目名稱:sfXCSSPlugin,代碼行數:21,代碼來源:sfXCSSPlugin-SaveFileAfterFirstCallTest.php

示例5: sfTestFunctional

<?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.
 */
$app = 'frontend';
$fixtures = 'fixtures/fixtures.yml';
if (!(include dirname(__FILE__) . '/../bootstrap/functional.php')) {
    return;
}
$browser = new sfTestFunctional(new sfBrowser());
ArticlePeer::doDeleteAll();
$category = CategoryPeer::doSelectOne(new Criteria());
foreach (range(1, 20) as $n) {
    $article = new Article();
    $article->setTitle(sprintf('Article #%s', $n));
    $article->setCategory($category);
    $article->save();
}
$browser->getAndCheck('pager', 'interfaces')->with('response')->begin()->checkElement('#pagerResults li', 10)->checkElement('#pagerCount:contains(20)')->end();
開發者ID:cuongnv540,項目名稱:jobeet,代碼行數:24,代碼來源:pagerTest.php


注:本文中的sfTestFunctional::getAndCheck方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。