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


PHP sfTestFunctional::test方法代码示例

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


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

示例1: sfTestFunctional

$test_browser = new sfTestFunctional($browser);
$test_browser->setTester('json.response', 'sfTesterJsonResponse');
$test_browser->get('/subredditdeadline')->with('request')->begin()->isParameter('module', 'subredditdeadline')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->end()->with('json.response')->begin()->isJson()->end();
/**
 * Test the creation
 */
$entity = new Deadline();
$entity_array = $entity->exportTo('array');
$identifier = $entity->getTable()->getIdentifier();
/**
 * Please build a valid $entity_array here
 */
unset($entity_array[$identifier]);
//$entity_array['name'] = "pony";
//$entity_array['created_at'] = date('Y-m-d H:i:s');
//$entity_array['updated_at'] = date('Y-m-d H:i:s');
$test_browser->call('/subredditdeadline', 'post', array('content' => json_encode($entity_array)))->with('request')->begin()->isParameter('module', 'subredditdeadline')->isParameter('action', 'create')->end()->with('response')->begin()->isStatusCode(200)->end();
/**
 * If the new entity has been created
 */
$location = $browser->getResponse()->getHttpHeader('Location');
if ($location) {
    // Get ?
    $test_browser->get($location)->with('request')->begin()->isParameter('module', 'subredditdeadline')->isParameter('action', 'show')->end()->with('response')->begin()->isStatusCode(200)->end()->with('json.response')->begin()->isJson()->end();
    // Update ?
    $test_browser->call($location, 'put', array('content' => json_encode($entity_array)))->with('request')->begin()->isParameter('module', 'subredditdeadline')->isParameter('action', 'update')->end()->with('response')->begin()->isStatusCode(200)->end();
    // Delete ?
    $test_browser->call($location, 'delete')->with('request')->begin()->isParameter('module', 'subredditdeadline')->isParameter('action', 'delete')->end()->with('response')->begin()->isStatusCode(200)->end();
} else {
    $test_browser->test()->fail("The last response doesn't have any Location header!");
}
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:31,代码来源:subredditdeadlineActionsTest.php

示例2: dirname

<?php

// functional test for a few special things in the admin module
require_once dirname(__FILE__) . '/../bootstrap/functional.php';
require_once sfConfig::get('sf_lib_dir') . '/test/unitHelper.php';
$browser = new sfTestFunctional(new sfBrowser());
$browser->setTester('doctrine', 'sfTesterDoctrine');
$arr = create_doctrine_test_tree($browser->test());
$root = $arr['rt'];
$rootForm = new ioDoctrineMenuItemForm($root);
$browser->info('1 - Edit an existing, you cannot place it via parent_id')->get(sprintf('/test/menu/%d/edit', $root->id))->with('request')->begin()->isParameter('module', 'io_doctrine_menu')->isParameter('action', 'edit')->end()->with('response')->begin()->checkForm($rootForm)->info('  1.1 - The root menu has no parent_id field')->checkElement('#io_doctrine_menu_item_parent_id', 0)->end()->click('Save', array('io_doctrine_menu_item' => array('parent_id' => $root->id)))->with('form')->begin()->hasErrors(1)->hasGlobalError('extra_fields')->end();
$browser->info('2 - Create a new menu item, set it as a child of something')->get('/test/menu/new')->with('request')->begin()->isParameter('module', 'io_doctrine_menu')->isParameter('action', 'new')->end()->with('response')->begin()->checkForm('ioDoctrineMenuItemForm')->info('  2.1 - The root menu has a parent_id field')->checkElement('#io_doctrine_menu_item_parent_id', 1)->end()->click('Save', array('io_doctrine_menu_item' => array('parent_id' => $root->id, 'name' => 'new child')))->with('form')->begin()->hasErrors(0)->end()->with('doctrine')->begin()->check('ioDoctrineMenuItem', array('name' => 'new child', 'root_id' => $root->id, 'lft' => 16, 'rgt' => 17, 'level' => 1))->end();
die;
$browser->info('3 - Create a new menu item, make it root')->get('/test/menu/new')->with('request')->begin()->isParameter('module', 'io_doctrine_menu')->isParameter('action', 'new')->end()->click('Save', array('io_doctrine_menu_item' => array('name' => 'new root')))->with('form')->begin()->hasErrors(0)->end()->with('doctrine')->begin()->check('ioDoctrineMenuItem', array('name' => 'new root', 'lft' => 18, 'rgt' => 19, 'level' => 0))->end();
开发者ID:rafaelgou,项目名称:ioDoctrineMenuPlugin,代码行数:14,代码来源:menuAdminTest.php

示例3: sfTestFunctional

<?php

include sfConfig::get('sf_test_dir') . '/bootstrap/functional.php';
$browser = new sfTestFunctional(new sfBrowser());
$config = sfConfig::get('app_cacophony');
$browser->info('Twitter Connect')->get('/oauth/connect/twitter')->with('request')->begin()->isParameter('module', 'sfCacophonyConsumer')->isParameter('action', 'connect')->isParameter('provider', 'twitter')->end()->with('response')->begin()->isStatusCode(302)->end();
$response = $browser->getResponse();
$browser->test()->like($response->getHttpHeader('Location'), '@' . $config['providers']['twitter']['authorize_url'] . '@', 'Connect redirects to correct URL');
//$browser->info(parse_url($response->getHttpHeader('Location'), PHP_URL_QUERY));
$browser->info('Twitter Callback')->get('/oauth/callback/twitter?oauth_token=1234&oauth_verifier=5678')->with('request')->begin()->isParameter('module', 'sfCacophonyConsumer')->isParameter('action', 'callback')->isParameter('provider', 'twitter')->isParameter('oauth_token', '1234')->isParameter('oauth_verifier', '5678')->end()->with('response')->begin()->isStatusCode(302)->end()->with('user')->begin()->isFlash('error', 'Failed to retrieve access token: Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect)')->end();
$browser->info('Vimeo Connect')->get('/oauth/connect/vimeo')->with('request')->begin()->isParameter('module', 'sfCacophonyConsumer')->isParameter('action', 'connect')->isParameter('provider', 'vimeo')->end()->with('response')->begin()->isStatusCode(302)->end();
$response = $browser->getResponse();
$browser->test()->like($response->getHttpHeader('Location'), '@' . $config['providers']['vimeo']['authorize_url'] . '@', 'Connect redirects to correct URL');
//$browser->info(parse_url($response->getHttpHeader('Location'), PHP_URL_QUERY));
$browser->info('Vimeo Callback')->get('/oauth/callback/vimeo?oauth_token=1234&oauth_verifier=5678')->with('request')->begin()->isParameter('module', 'sfCacophonyConsumer')->isParameter('action', 'callback')->isParameter('provider', 'vimeo')->isParameter('oauth_token', '1234')->isParameter('oauth_verifier', '5678')->end()->with('response')->begin()->isStatusCode(302)->end()->with('user')->begin()->isFlash('error', 'Failed to retrieve access token: Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect)')->end();
$browser->info('Facebook Connect')->get('/oauth/connect/facebook')->with('request')->begin()->isParameter('module', 'sfCacophonyConsumer')->isParameter('action', 'connect')->isParameter('provider', 'facebook')->end()->with('response')->begin()->isStatusCode(302)->end();
$response = $browser->getResponse();
$browser->test()->like($response->getHttpHeader('Location'), '@' . $config['providers']['facebook']['authorize_url'] . '@', 'Connect redirects to correct URL');
//$browser->info(parse_url($response->getHttpHeader('Location'), PHP_URL_QUERY));
parse_str(parse_url(urldecode($response->getHttpHeader('Location')), PHP_URL_QUERY), $query_string);
$browser->info('Facebook Callback')->get(sprintf('/oauth/callback/facebook?code=1234&state=%s', $query_string['state']))->with('request')->begin()->isParameter('module', 'sfCacophonyConsumer')->isParameter('action', 'callback')->isParameter('provider', 'facebook')->isParameter('code', '1234')->isParameter('state', $query_string['state'])->end()->with('response')->begin()->isStatusCode(302)->end()->with('user')->begin()->isFlash('error', 'Failed to retrieve access token: ')->end();
开发者ID:nixilla,项目名称:sfCacophonyPlugin,代码行数:21,代码来源:sfCacophonyConsumerActionsTest.php

示例4: dirname

<?php

$app = 'frontend';
include dirname(__FILE__) . '/../bootstrap/functional.php';
new sfDatabaseManager($configuration);
$task = new sfDoctrineBuildTask($configuration->getEventDispatcher(), new sfFormatter());
$task->run(array(), array('sql', 'db', 'and-load', 'no-confirmation', 'application' => $app));
$conn = Doctrine::getConnectionByTableName('Author');
$conn->beginTransaction();
$browser = new sfTestFunctional(new sfBrowser());
$browser->test()->info('Updating first author');
$firstAuthor = Doctrine::getTable('Author')->findOneBySlug('niko');
$browser->get('/author/' . $firstAuthor->slug . '/view')->with('response')->begin()->checkElement('h1', '/niko/')->checkElement('ul#comments li', 1)->end()->with('view_cache')->begin()->isCached(true, false)->end();
$browser->getContext(true)->switchTo('backend');
$firstAuthor->name = 'n1k0';
$firstAuthor->save($conn);
$browser->get('/author/' . $firstAuthor->slug . '/view')->with('response')->begin()->checkElement('h1', '/n1k0/')->checkElement('ul#comments li', 1)->end()->with('view_cache')->begin()->isCached(true, false)->end();
$conn->rollback();
开发者ID:n1k0,项目名称:akDoctrineTemplateCacheInvaliderPlugin,代码行数:18,代码来源:Invalider2Test.php

示例5:

$browser->info('1 - Surf to a url with a complex menu and check several things.')->get('/big-menu');
$pretty = '<ul class="root">
  <li class="first">
    <a href="' . url_for('@homepage', true) . '">Parent 1</a>
    <ul class="menu_level_1">
      <li class="first">
        <a href="' . url_for('/parent1/ch1', true) . '?test=1">Child 1</a>
      </li>
      <li class="last">
        <a href="' . url_for('/parent1/ch2') . '">Child 2</a>
      </li>
    </ul>
  </li>
  <li class="current_ancestor last">
    Parent 2
    <ul class="menu_level_1">
      <li class="current first last">
        <a href="' . url_for('@test_menu') . '">Child 4</a>
        <ul class="menu_level_2">
          <li class="first last">
            Grandchild 1
          </li>
        </ul>
      </li>
    </ul>
  </li>
</ul>
';
$browser->info("Rendered Menu: \n" . $pretty);
$browser->test()->is($browser->getResponse()->getContent(), $pretty, 'The full rendered menu is correct with the uncompressed spacing.');
开发者ID:vicb,项目名称:ioMenuPlugin,代码行数:30,代码来源:MenuTest.php

示例6: dirname

<?php

$app = 'frontend';
include dirname(__FILE__) . '/../bootstrap/functional.php';
new sfDatabaseManager($configuration);
$task = new sfDoctrineBuildTask($configuration->getEventDispatcher(), new sfFormatter());
$task->run(array(), array('sql', 'db', 'and-load', 'no-confirmation', 'application' => $app));
$conn = Doctrine::getConnectionByTableName('Article');
$conn->beginTransaction();
$browser = new sfTestFunctional(new sfBrowser());
$browser->get('/en/articles')->with('request')->begin()->isParameter('module', 'content')->isParameter('action', 'index')->isParameter('sf_culture', 'en')->end()->with('response')->begin()->checkElement('h1', '/Articles/')->checkElement('ul li', 2)->checkElement('ul li', '/My first article/')->checkElement('ul li', '/My second article/', array('position' => 1))->end()->with('view_cache')->begin()->isCached(true, false)->end()->click('My first article')->with('response')->begin()->checkElement('h1', '/My first article/')->checkElement('ul#comments li', 2)->end()->with('view_cache')->begin()->isCached(true, false)->end();
$browser->test()->info('Updating first article with php code - cache invalidation is disabled on frontend');
$firstArticle = Doctrine::getTable('Article')->doSelectForSlug(array('slug' => 'my-first-article'));
$firstArticle->title = 'My first article, cache invalidation is disabled';
$firstArticle->save($conn);
$browser->get('/en/articles')->with('response')->begin()->checkElement('h1', '/Articles/')->checkElement('ul li', 2)->checkElement('ul li', '/My first article/')->checkElement('ul li:contains("cache invalidation is disabled")', false)->end()->with('view_cache')->begin()->isCached(true, false)->end();
$browser->test()->info('Updating first article with php code - switch to backend');
sfContext::switchTo('backend');
$firstArticle = Doctrine::getTable('Article')->doSelectForSlug(array('slug' => 'my-first-article'));
$firstArticle->title = 'My first article, modified';
$firstArticle->save($conn);
sfContext::switchTo('frontend');
$browser->get('/en/articles')->with('response')->begin()->checkElement('h1', '/Articles/')->checkElement('ul li', 2)->checkElement('ul li', '/My first article, modified/')->checkElement('ul li', '/My second article/', array('position' => 1))->end()->with('view_cache')->begin()->isCached(true, false)->end()->click('My first article, modified')->with('response')->begin()->checkElement('h1', '/My first article, modified/')->checkElement('ul#comments li', 2)->end()->with('view_cache')->begin()->isCached(true, false)->end();
$browser->test()->info('Updating first article from another app (with caching system disabled) - switch to backend');
sfContext::switchTo('backend');
$configuration->loadHelpers('Partial');
$backendBrowser = new sfTestFunctional(new sfBrowser());
$backendBrowser->get('/article/1/edit')->with('request')->begin()->isParameter('module', 'article')->isParameter('action', 'edit')->end()->setField('article[en][title]', 'My first article, edited')->click('Save')->followRedirect()->with('response')->begin()->checkElement('div.notice', 1)->end();
$browser->get('/en/article/' . $firstArticle->slug . '/view')->with('response')->begin()->checkElement('h1', '/My first article, edited/')->checkElement('ul#comments li', 2)->end()->with('view_cache')->begin()->isCached(true, false)->end();
$conn->rollback();
开发者ID:n1k0,项目名称:akDoctrineTemplateCacheInvaliderPlugin,代码行数:30,代码来源:InvaliderTest.php

示例7: dirname

<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new sfTestFunctional(new sfBrowser());
$browser->get('es/politicos')->with('request')->begin()->isParameter('module', 'politico')->isParameter('action', 'ranking')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '/Ranking de pol/')->end();
$browser->get('es/politicos/PSOE')->with('request')->begin()->isParameter('module', 'politico')->isParameter('action', 'ranking')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '/Ranking de pol/')->checkElement('body', '/Todas las instituciones/')->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ticos, PSOE/');
$browser->get('es/politicos/all/Congreso')->with('request')->begin()->isParameter('module', 'politico')->isParameter('action', 'ranking')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '/Ranking de pol/')->end();
$browser->test()->like($browser->getResponse()->getContent(), '/<a class="flechita" href="\\/(.*)es\\/politicos\\/all\\/Congreso">Congreso<\\/a>/');
$browser->get('es/politicos/PSOE/Congreso')->with('request')->begin()->isParameter('module', 'politico')->isParameter('action', 'ranking')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '/Ranking de pol/')->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ticos, Congreso, PSOE/');
$browser->test()->like($browser->getResponse()->getContent(), '/<a class="flechita" href="\\/(.*)es\\/politicos\\/PSOE\\/Congreso">Congreso<\\/a>/');
$browser->get('es/politico/Campos-Arteseros')->with('request')->begin()->isParameter('module', 'politico')->isParameter('action', 'show')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '/Campos Arteseros/')->end();
开发者ID:voota,项目名称:voota,代码行数:13,代码来源:politicoActionsTest.php

示例8: sfTestFunctional

$browser = new sfTestFunctional(new sfBrowser());
$email = rand() . '@example.com';
$password = rand();
$user = new QubitUser();
$user->email = $email;
$user->setPassword($password);
$user->save();
$relation = new QubitUserRoleRelation();
$relation->userId = $user->id;
$relation->roleId = QubitRole::ADMINISTRATOR_ID;
$relation->save();
$browser->post(';user/login', array('login' => array('email' => $email, 'password' => $password)));
$scopeAndContent = rand();
$identifier = rand();
$title = rand();
$informationObject = new QubitInformationObject();
$informationObject->parentId = QubitInformationObject::ROOT_ID;
$informationObject->scopeAndContent = $scopeAndContent;
$informationObject->identifier = $identifier;
$informationObject->title = $title;
$informationObject->save();
$browser->get('/' . $informationObject->id . ';dc?sf_format=xml');
$user->delete();
$informationObject->delete();
$doc = new DOMDocument();
$doc->loadXML($browser->getResponse()->getContent());
$xpath = new DOMXPath($doc);
$xpath->registerNamespace('dc', 'http://purl.org/dc/elements/1.1/');
$browser->test()->is($xpath->evaluate('string(/*/dc:description)', $doc->documentElement), $scopeAndContent, 'description');
$browser->test()->is($xpath->evaluate('string(/*/dc:identifier)', $doc->documentElement), $identifier, 'identifier');
$browser->test()->is($xpath->evaluate('string(/*/dc:title)', $doc->documentElement), $title, 'title');
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:31,代码来源:dcTest.php

示例9: dirname

<?php

include dirname(__FILE__) . '/../bootstrap/functional.php';
$browser = new sfTestFunctional(new sfBrowser());
// remove the uploaded files when the tests are over
function cleanFiles()
{
    $files = sfFinder::type('file')->name('*.gif')->in(sfConfig::get('sf_upload_dir'));
    foreach ($files as $file) {
        unlink($file);
    }
}
register_shutdown_function('cleanFiles');
// start the tests
$browser->get('/uploadForm/index')->with('request')->begin()->isParameter('module', 'uploadForm')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->isValid()->checkElement('h1', 'Upload Form')->checkForm(new UploadForm())->end()->click('Upload!', array('upload' => array('file' => sfConfig::get('sf_data_dir') . '/fixtures/lawl.gif')))->with('response')->begin()->isRedirected()->followRedirect()->end()->with('request')->begin()->isParameter('module', 'uploadForm')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->isValid()->checkElement('h1', 'Upload Form')->checkForm(new UploadForm())->end();
$files = sfFinder::type('file')->name('*.gif')->in(sfConfig::get('sf_upload_dir'));
$browser->test()->is(count($files), 1, 'The file has been uploaded to the uploads dir');
开发者ID:hbsresearch,项目名称:sfGaufrettePlugin,代码行数:17,代码来源:uploadFormTest.php

示例10: BlogForm

$browser->info('1 - Visit page, but not logged in')->info('  1.1 - Start by being logged out.')->get('/blog')->with('request')->begin()->isParameter('module', 'test')->isParameter('action', 'blog')->end()->with('response')->begin()->info('  1.2 - The title should be empty - we are not logged in, so no default text for the empty title field.')->checkElement('.test_title h1', '')->info('  1.3 - The title tag should not have the editable class, or any extra markup')->checkElement('.test_title h1[class="test_editable_class_name"]', false)->end();
$context = $browser->getContext(true);
$context->getUser()->setAuthenticated(true);
$context->getUser()->addCredential('test_credential');
$context->getUser()->shutdown();
$context->getStorage()->shutdown();
$browser->info('2 - Goto a page, now logged in with the correct credential')->get('/blog')->with('response')->begin()->isStatusCode(200)->info('  2.1 - The title has the configured placeholder text')->checkElement('.test_title h1', '[Test edit]')->info('  2.2 - Check for the markup for the editor - should be present now')->checkElement('.test_title h1.test_editable_class_name', 1)->checkElement('.test_body div div:last', 'Lorem ipsum')->end();
$blog->title = 'test blog';
$blog->save();
$form = new BlogForm($blog);
$form->useFields(array('title'));
$browser->info('3 - Display and submit a simple form')->get('/service/content/form?model=Blog&pk=2&fields[]=title')->with('request')->begin()->isParameter('module', 'ioEditableContent')->isParameter('action', 'form')->end()->with('response')->begin()->isStatusCode(200)->checkForm($form)->checkElement('input[type=hidden][name=model][value=Blog]', 1)->checkElement('input[type=hidden][name=pk][value=' . $blog->id . ']', 1)->checkElement('input[type=hidden][name=form][value="BlogForm"]', 1)->checkElement('input[type=hidden][name=form_partial][value=ioEditableContent/formFields]', 1)->checkElement('input[type=hidden][name=partial][value=]', 1)->checkElement('input[type=hidden][name="method"][value=]', 1)->checkElement('input[type=hidden][name="fields[]"][value=title]', 1)->end()->info('  3.1 - Submit with errors')->click('save', array('blog' => array('fake_field' => 'val')))->with('request')->begin()->isParameter('module', 'ioEditableContent')->isParameter('action', 'update')->end()->with('response')->begin()->isStatusCode(200)->end();
$browser->info('  3.2 - check the json response');
$response = $browser->getResponse()->getContent();
$json = json_decode($response);
$browser->test()->is($json->error, 'There were 1 errors when submitting the form.', 'The ->error key comes back correctly');
$browser->test()->like($json->response, '/id\\=\\"blog_title\\"/', 'The ->respones key contains the re-rendered form fields');
$browser->test()->like($json->response, '/Unexpected extra form field named \\"fake_field\\"/', '->respones contains the global errors');
$browser->get('/service/content/form?model=Blog&pk=2&fields[]=title')->info('  3.3 - Submit a valid form')->click('save', array('blog' => array('title' => 'new title')))->with('doctrine')->begin()->check('Blog', array('title' => 'new title'), 1)->end();
$browser->info('  3.4 - check the json response');
$response = $browser->getResponse()->getContent();
$json = json_decode($response);
$browser->test()->is($json->error, '', '->error is blank because the form submitted successfully');
$browser->test()->like($json->response, '/id\\=\\"blog_title\\"/', 'The ->respones key contains the re-rendered form fields');
$browser->info('  3.5 - Goto the show page for this content area')->get('/service/content/show?model=Blog&pk=2&fields%5B%5D=title')->with('request')->begin()->isParameter('module', 'ioEditableContent')->isParameter('action', 'show')->end()->with('response')->begin()->isStatusCode(200)->matches('/new title/')->end();
$form = new BlogBodyForm($blog);
$browser->info('4 - Display and submit a complex form')->get('/service/content/form?model=Blog&pk=2&form=BlogBodyForm&form_partial=test%2FbodyForm&partial=test%2Fbody&method=getTestValue')->with('request')->begin()->isParameter('module', 'ioEditableContent')->isParameter('action', 'form')->end()->with('response')->begin()->isStatusCode(200)->checkForm($form)->checkElement('input[type=hidden][name=model][value=Blog]', 1)->checkElement('input[type=hidden][name=pk][value=' . $blog->id . ']', 1)->checkElement('input[type=hidden][name=form][value="BlogBodyForm"]', 1)->checkElement('input[type=hidden][name=form_partial][value=test/bodyForm]', 1)->checkElement('input[type=hidden][name="method"][value=getTestValue]', 1)->checkElement('input[type=hidden][name=partial][value=test/body]', 1)->end()->info('  4.1 - Submit a valid form')->click('save', array('blog' => array('body' => 'new body')))->with('response')->begin()->isStatusCode('200')->end()->with('doctrine')->begin()->check('Blog', array('body' => 'new body'), 1)->end();
$browser->info('  4.2 - check the json response');
$response = $browser->getResponse()->getContent();
$json = json_decode($response);
$browser->test()->is($json->error, '', '->error is blank because the form submitted successfully');
开发者ID:kimbrelas,项目名称:ioEditableContentPlugin,代码行数:31,代码来源:EditableContentTest.php

示例11: dirname

<?php

require_once dirname(__FILE__) . '/../bootstrap/functional.php';
require_once sfConfig::get('sf_lib_dir') . '/test/unitHelper.php';
$browser = new sfTestFunctional(new sfBrowser());
$arr = create_doctrine_test_tree($browser->test());
$rt = $arr['rt'];
$browser->info('1 - Goto the reorder page and look around')->info('  1.1 - Goto the reorder page with a fake name sends to a 404')->get('/test/menu/reorder/fake')->with('request')->begin()->isParameter('module', 'io_doctrine_menu')->isParameter('action', 'reorder')->end()->with('response')->begin()->isStatusCode(404)->end()->info('  1.2 - Goto a real menu reordering page')->get('/test/menu/reorder/' . $rt->id)->with('request')->begin()->isParameter('module', 'io_doctrine_menu')->isParameter('action', 'reorder')->end()->with('response')->begin()->isStatusCode(200)->checkElement('h1', '/Reorder Menu "Root li"/')->info('  1.3 - check for the correct nested set javascript urls')->matches('/loadUrl:\\ \'\\/index\\.php\\/test\\/menu\\/reorder\\/json\\/' . $rt->id . '/')->matches('/saveUrl:\\ \'\\/index\\.php\\/test\\/menu\\/reorder\\/save\\/' . $rt->id . '/')->end();
$browser->info('2 - Check out the json response for the menu')->get('/test/menu/reorder/json/' . $rt->id)->with('request')->begin()->isParameter('module', 'io_doctrine_menu')->isParameter('action', 'json')->isParameter('sf_format', 'json')->end()->with('response')->begin()->isStatusCode(200)->end();
$response = $browser->getResponse()->getContent();
$json = json_decode($response);
$browser->test()->isnt($json, null, 'The response returns a valid json object');
$browser->info('3 - Test the save method')->call('/test/menu/reorder/save/' . $rt->id, 'post', array('nested-sortable-widget' => get_nested_set_save_array($arr)))->with('request')->begin()->isParameter('module', 'io_doctrine_menu')->isParameter('action', 'saveJson')->end()->with('response')->begin()->isStatusCode(200)->end();
$browser->info('  3.1 - Check the menu to see that it was updated');
root_sanity_check($browser->test(), $rt);
check_child_ordering($browser->test(), $rt, array(), array('Parent 2', 'Parent 1'));
check_child_ordering($browser->test(), $rt, array(0), array('Child 4'));
check_child_ordering($browser->test(), $rt, array(1), array('Child 3', 'Child 1', 'Child 2'));
开发者ID:joericochuyt,项目名称:ioDoctrineMenuPlugin,代码行数:18,代码来源:reorderingTest.php

示例12: dirname

<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new sfTestFunctional(new sfBrowser());
$browser->get('/bugs/index')->with('request')->begin()->isParameter('module', 'bugs')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '!/This is a temporary page/')->end()->get('account/login')->end();
$browser->get('account/login')->setField('username', 'admin')->setField('password', 'admin')->click('login')->isRedirected()->followRedirect();
$browser->test()->like($browser->getResponse(), 'defualt/index');
开发者ID:rsanders16,项目名称:NexusPlus,代码行数:7,代码来源:bugsActionsTest.php

示例13: dirname

<?php

require_once dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new sfTestFunctional(new sfBrowser());
$user = new QubitUser();
$user->username = 'Test McTester';
$user->email = 'test@example.com';
$user->setPassword('test1234');
$user->save();
$browser->info('Log in')->post(';user/login', array('email' => 'test@example.com', 'password' => 'test1234'))->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'login')->end();
$browser->test()->ok($browser->getUser()->isAuthenticated(), 'User is authenticated');
$browser->test()->isa_ok($browser->getUser()->user, 'QubitUser', 'myUser->user is QubitUser');
$browser->info('Log out')->get('/')->with('request')->begin()->isParameter('module', 'staticpage')->isParameter('action', 'static')->end()->click('Log out')->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'logout')->end();
$browser->test()->ok(!$browser->getUser()->isAuthenticated(), 'User isn\'t authenticated');
$browser = new sfTestFunctional(new sfBrowser());
$browser->info('Incorrect log in')->post(';user/login', array('email' => 'test@example.com', 'password' => 'wrongpass'))->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'login')->end();
$browser->test()->ok(!$browser->getUser()->isAuthenticated(), 'User isn\'t authenticated');
$browser->test()->is($browser->getUser()->user, null, 'myUser->user is null');
$browser = new sfTestFunctional(new sfBrowser());
$browser->info('"localhost" "next" parameter, issue 1342')->post(';user/login', array('email' => 'test@example.com', 'password' => 'test1234', 'next' => 'http://localhost/example'))->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'login')->end();
$browser->test()->ok($browser->getUser()->isAuthenticated(), 'User is authenticated');
$browser->test()->isa_ok($browser->getUser()->user, 'QubitUser', 'myUser->user is QubitUser');
$browser = new sfTestFunctional(new sfBrowser());
$browser->info('Empty "next" parameter')->post(';user/login', array('email' => 'test@example.com', 'password' => 'test1234', 'next' => ''))->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'login')->end();
$browser->test()->ok($browser->getUser()->isAuthenticated(), 'User is authenticated');
$browser->test()->isa_ok($browser->getUser()->user, 'QubitUser', 'myUser->user is QubitUser');
$user->delete();
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:27,代码来源:loginTest.php

示例14: dirname

<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new sfTestFunctional(new sfBrowser());
$test = $browser->test();
$conn = Doctrine::getConnectionByTableName('location');
$conn->beginTransaction();
$browser->get('/')->info('1 - homepage')->with('request')->begin()->isParameter('module', 'collector')->isParameter('action', 'locations')->end()->with('response')->begin()->isStatusCode(200)->end();
$browser->get('/data')->info('1.1 - locations data')->with('request')->begin()->isParameter('module', 'collector')->isParameter('action', 'data')->end()->with('response')->begin()->isStatusCode(200)->end();
$browser->info('2 - main links')->get('/')->info('2.1 - profits')->click("Отчёты")->with('request')->begin()->isParameter('module', 'profit')->isParameter('action', 'list')->end()->with('response')->begin()->isStatusCode(200)->end();
$browser->info('2 - main linkчёs')->get('/')->info('2.2 - talks')->click("Обсуждения")->with('request')->begin()->isParameter('module', 'talk')->isParameter('action', 'list')->end()->with('response')->begin()->isStatusCode(200)->end();
$browser->info('2 - main links')->get('/')->info('2.3 - events')->click("События")->with('request')->begin()->isParameter('module', 'event')->isParameter('action', 'list')->end()->with('response')->begin()->isStatusCode(200)->end();
//@todo: make submit check
//$browser->
//        info('2 - main links')->
//        get('/')->
//        info('2.4 - search')->
//        click("Поиск")->
//        with('request')->begin()->
//        isParameter('module', 'location')->
//        isParameter('action', 'search')->
//        end()->
//        with('response')->begin()->
//        isStatusCode(200)->
//        end()
//;
$browser->info('2 - main links')->get('/')->info('2.5 - signin')->click("Вход")->with('request')->begin()->isParameter('module', 'sfGuardAuth')->isParameter('action', 'signin')->end()->with('response')->begin()->isStatusCode(401)->end();
$browser->info('2 - main links')->get('/')->info('2.6 - signup')->click("Регистрация")->with('request')->begin()->isParameter('module', 'sfApply')->isParameter('action', 'apply')->end()->with('response')->begin()->isStatusCode(200)->end();
$browser->info('3 -footer links')->get('/')->info('3.1- Top')->click("По рейтингу")->with('request')->begin()->isParameter('module', 'collector')->isParameter('action', 'top')->end()->with('response')->begin()->isStatusCode(200)->end();
$browser->info('3 -footer links')->get('/')->info('3.2- Regions')->click("По регионам")->with('request')->begin()->isParameter('module', 'collector')->isParameter('action', 'regions')->end()->with('response')->begin()->isStatusCode(200)->end();
$browser->info('3 -footer links')->get('/')->info('3.3 - Free')->click("Бесплатная рыбалка")->with('request')->begin()->isParameter('module', 'collector')->isParameter('action', 'listFree')->end()->with('response')->begin()->isStatusCode(200)->end();
开发者ID:limitium,项目名称:uberlov,代码行数:31,代码来源:mainTest.php

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


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