public function get($uri, $parameters = array(), $changeStack = true) { try { return parent::get($uri, $parameters, $changeStack); } catch (Exception $e) { //If the URI cannot be found, the page is a 404 and should be removed } return false; }
/** * Initializes the browser tester instance. * * @param string $hostname Hostname to browse * @param string $remote Remote address to spook * @param array $options Options for sfBrowser */ public function __construct($hostname = null, $remote = null, $options = array()) { if (is_object($hostname)) { // new signature parent::__construct($hostname, $remote); } else { $browser = new sfBrowser($hostname, $remote, $options); if (is_null(self::$test)) { $lime = new lime_test(null, isset($options['output']) ? $options['output'] : new lime_output_color()); } parent::__construct($browser, $lime); } }
<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; $browser = new sfTestFunctional(new sfBrowser()); $browser->get('/copisim_filiere/index')->with('request')->begin()->isParameter('module', 'copisim_filiere')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '!/This is a temporary page/')->end();
<?php include(dirname(__FILE__).'/../../bootstrap/functional.php'); $browser = new sfTestFunctional(new sfBrowser()); $browser-> get('/nonPsycho/index')-> with('request')->begin()-> isParameter('module', 'nonPsycho')-> isParameter('action', 'index')-> end()-> with('response')->begin()-> isStatusCode(200)-> checkElement('body', '!/This is a temporary page/')-> end() ;
<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; $browser = new sfTestFunctional(new sfBrowser()); $browser->get('/role_principal/index')->with('request')->begin()->isParameter('module', 'role_principal')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '!/This is a temporary page/')->end();
<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; $browser = new sfTestFunctional(new sfBrowser()); $browser->get('/##MODULE_NAME##/index')->with('request')->begin()->isParameter('module', '##MODULE_NAME##')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '!/This is a temporary page/')->end();
<?php /* * Kimkëlen - School Management Software * Copyright (C) 2013 CeSPI - UNLP <*****@*****.**> * * This file is part of Kimkëlen. * * Kimkëlen is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License v2.0 as published by * the Free Software Foundation. * * Kimkëlen is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kimkëlen. If not, see <http://www.gnu.org/licenses/gpl-2.0.html>. */ include dirname(__FILE__) . '/../../bootstrap/functional.php'; $browser = new sfTestFunctional(new sfBrowser()); $browser->get('/student_career_school_year_conduct/index')->with('request')->begin()->isParameter('module', 'student_career_school_year_conduct')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '!/This is a temporary page/')->end();
<?php include(dirname(__FILE__).'/../../bootstrap/functional.php'); $browser = new sfTestFunctional(new sfBrowser()); $browser-> get('/venue/index')-> with('request')->begin()-> isParameter('module', 'venue')-> isParameter('action', 'index')-> end()-> with('response')->begin()-> isStatusCode(200)-> checkElement('body', '!/This is a temporary page/')-> end() ;
/** * Override to always load in the doctrine tester */ public function __construct($hostname = null, $remote = null, $options = array()) { parent::__construct($hostname, $remote, $options); $this->setTester('doctrine', 'sfTesterDoctrine'); }
<?php /* * This file is part of the symfony package. * (c) Fabien Potencier <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ $app = 'frontend'; require_once dirname(__FILE__) . '/../bootstrap/functional.php'; $browser = new sfTestFunctional(new sfBrowser(), null, array('doctrine' => 'sfTesterDoctrine')); $browser->get('/attachment/index')->setField('attachment[file_path]', sfConfig::get('sf_config_dir') . '/databases.yml')->click('submit')->with('response')->begin()->checkElement('h1:contains("ok")')->end()->with('doctrine')->check('Attachment', array('file_path' => AttachmentForm::TEST_GENERATED_FILENAME), 1); $browser->test()->is(file_exists(sfConfig::get('sf_cache_dir') . '/' . AttachmentForm::TEST_GENERATED_FILENAME), true, 'uploaded file is named correctly'); $browser->get('/attachment/editable?id=1')->setField('attachment[file_path_delete]', 1)->click('submit')->with('response')->begin()->checkElement('h1', 'ok')->end()->with('doctrine')->check('Attachment', array('file_path' => AttachmentForm::TEST_GENERATED_FILENAME), false); $browser->test()->is(file_exists(sfConfig::get('sf_cache_dir') . '/' . AttachmentForm::TEST_GENERATED_FILENAME), false, 'uploaded file is removed');
<?php require dirname(__FILE__) . '/../bootstrap/functional.php'; // Test for all the different variables that can determine which theme should be set $browser = new sfTestFunctional(new sfBrowser()); $headers = array('app_test' => 'Application Test Layout', 'test_theme' => 'Plugin Test Layout'); $browser->info('1 - Test a few straightforward ways of setting themes')->info(' 1.1 - Do nothing special, end up with the default theme')->get('/controller/default_theme')->with('response')->begin()->isStatusCode(200)->checkElement('h1', '/' . $headers['app_test'] . '/')->end()->info(' 1.2 - Go to an action that explicitly request the test_theme')->get('/controller/explicit_test_theme')->with('response')->begin()->isStatusCode(200)->checkElement('h1', '/' . $headers['test_theme'] . '/')->end(); $browser->info('2 - Test forwarding')->info(' 2.1 Start at an action with test_theme route then forward to one using the default theme')->get('/controller/test_theme_forward_default_theme')->with('response')->begin()->isStatusCode(200)->info(' 2.1.1 - The default theme, the final spot, should win out')->checkElement('h1', '/' . $headers['app_test'] . '/')->end()->info(' 2.2 Start at an action with the default theme then forward to the test theme')->get('/controller/default_theme_forward_test_theme')->with('response')->begin()->isStatusCode(200)->info(' 2.2.1 - The test theme, the final spot, should win out')->checkElement('h1', '/' . $headers['test_theme'] . '/')->end(); $browser->info('3 - Test the event listening method of setting a theme')->info(' 3.1 - Goto a module/action that should use the default theme')->get('/controller/event_listener')->with('response')->begin()->isStatusCode(200)->info(' 3.1.1 - Listener in frontendConfiguration set the theme to test_theme')->checkElement('h1', '/' . $headers['test_theme'] . '/')->end(); $browser->info('4 - Change the theme via a request parameter')->info(' 4.1 - Goto the default theme but with a request parameter to set test_theme')->get('/controller/default_theme?sf_theme=test_theme')->with('response')->begin()->isStatusCode(200)->info(' 4.2 - See that the test_theme is used')->checkElement('h1', '/' . $headers['test_theme'] . '/')->end()->with('user')->begin()->info(' 4.3 - A user attribute is set for the theme')->isAttribute('current_theme', 'test_theme')->end()->info(' 4.4 - The theme should be sticky - goto another default theme, should be test theme still')->get('/controller/test_theme_forward_default_theme')->with('response')->begin()->isStatusCode(200)->checkElement('h1', '/' . $headers['test_theme'] . '/')->end()->info(' 4.5 - Set the theme back to app_test with a request parameter')->get('/controller/test_theme_forward_default_theme?sf_theme=app_test')->with('response')->begin()->isStatusCode(200)->checkElement('h1', '/' . $headers['app_test'] . '/')->end()->info(' 4.6 - The user theme is not used if overridden explicitly')->get('/controller/explicit_test_theme')->with('response')->begin()->isStatusCode(200)->info(' 4.6.1 - The theme is test_theme, since it was explicitly set')->checkElement('h1', '/' . $headers['test_theme'] . '/')->end()->info(' 4.7 - Using an invalid theme name does nothing, unsets user attribute')->get('/controller/default_theme?sf_theme=fake')->with('response')->begin()->isStatusCode(200)->checkElement('h1', '/' . $headers['app_test'] . '/')->end()->with('user')->begin()->info(' 4.8 - A user attribute is actually unset')->isAttribute('current_theme', false)->end(); // Restart the browser to clear the session $browser->restart(); $browser->info('5 - Test the modules and routes method of setting themes')->info(' 5.1 - Goto a module that is setup in app.yml to use test_theme')->get('/test_theme_module/index')->with('response')->begin()->isStatusCode(200)->checkElement('h1', '/' . $headers['test_theme'] . '/')->end()->info(' 5.2 - Goto a route that is setup in app.yml to use test_theme')->get('/controller/test_theme_route')->with('response')->begin()->isStatusCode(200)->checkElement('h1', '/' . $headers['test_theme'] . '/')->end();
<?php include(dirname(__FILE__).'/../../bootstrap/functional.php'); $browser = new sfTestFunctional(new sfBrowser()); $browser->info('no tests available'); /* $browser-> get('/newsletter/index')-> with('request')->begin()-> isParameter('module', 'newsletter')-> isParameter('action', 'index')-> end()-> with('response')->begin()-> isStatusCode(200)-> checkElement('body', '!/This is a temporary page/')-> end() ; */
<?php include(dirname(__FILE__).'/../../bootstrap/functional.php'); $browser = new sfTestFunctional(new sfBrowser()); $browser-> get('/pedido_proveedor/index')-> with('request')->begin()-> isParameter('module', 'pedido_proveedor')-> isParameter('action', 'index')-> end()-> with('response')->begin()-> isStatusCode(200)-> checkElement('body', '!/This is a temporary page/')-> end() ;
<?php include(dirname(__FILE__).'/../../bootstrap/functional.php'); $browser = new sfTestFunctional(new sfBrowser()); $browser-> get('/presta/index')-> with('request')->begin()-> isParameter('module', 'presta')-> isParameter('action', 'index')-> end()-> with('response')->begin()-> isStatusCode(200)-> checkElement('body', '!/This is a temporary page/')-> end() ;
<?php include(dirname(__FILE__).'/../../bootstrap/functional.php'); $browser = new sfTestFunctional(new sfBrowser()); $browser-> get('/usuario_centros/index')-> with('request')->begin()-> isParameter('module', 'usuario_centros')-> isParameter('action', 'index')-> end()-> with('response')->begin()-> isStatusCode(200)-> checkElement('body', '!/This is a temporary page/')-> end() ;
<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; Doctrine::loadData(sfConfig::get('sf_data_dir') . '/fixtures'); $browser = new sfTestFunctional(new sfBrowser()); $browser->setTester('doctrine', 'sfTesterDoctrine'); $browser->call('usermodel/1/concept/200.html', 'put', array('bloom_evaluation' => 0, 'concept_id' => 200, '_with_csrf' => true))->with('doctrine')->begin()->check('UserModel', array('bloom_evaluation' => 0, 'concept_id' => 200))->end();
<?php $app = 'frontend'; $fixtures = 'fixtures/fixtures.yml'; require_once dirname(__FILE__) . '/../../bootstrap/functional.php'; $browser = new sfTestFunctional(new sfBrowser(), null, array('propel' => 'sfTesterPropel')); $browser->info('Check that ARRAY columns are loaded'); $criteria = AuthorQuery::create()->filterByHobbies(array('foo', 'bar'), Criteria::CONTAINS_ALL); $browser->with('propel')->begin()->check('Author', $criteria)->end();
<?php require_once dirname(__FILE__) . '/../bootstrap/bootstrap.php'; $browser = new sfTestFunctional(new sfBrowser()); $browser->info('Testing my application homepage')->get('/')->with('response')->begin()->isStatusCode(200)->end();
<?php include(dirname(__FILE__).'/../../bootstrap/functional.php'); $browser = new sfTestFunctional(new sfBrowser()); $browser-> get('/level/index')-> with('request')->begin()-> isParameter('module', 'level')-> isParameter('action', 'index')-> end()-> with('response')->begin()-> isStatusCode(200)-> checkElement('body', '!/This is a temporary page/')-> end() ;
<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; /** * This is an example class of sfTestFunctional * It may require some attention to work with the default values (line 40). */ $browser = new sfBrowser(); $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 ?
<?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();
<?php include(dirname(__FILE__).'/../../bootstrap/functional.php'); $browser = new sfTestFunctional(new sfBrowser()); $browser-> get('/proveedor/index')-> with('request')->begin()-> isParameter('module', 'proveedor')-> isParameter('action', 'index')-> end()-> with('response')->begin()-> isStatusCode(200)-> checkElement('body', '!/This is a temporary page/')-> end() ;
<?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();
<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; $browser = new sfTestFunctional(new sfBrowser()); $browser->get('/subjectpriorityhistory/index')->with('request')->begin()->isParameter('module', 'subjectpriorityhistory')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '!/This is a temporary page/')->end();
<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; $browser = new sfTestFunctional(new sfBrowser()); $browser->get('/ticketsGroups/index')->with('request')->begin()->isParameter('module', 'ticketsGroups')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '!/This is a temporary page/')->end();
<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; $browser = new sfTestFunctional(new sfBrowser()); $browser->get('/infojob_signalement_type/index')->with('request')->begin()->isParameter('module', 'infojob_signalement_type')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '!/This is a temporary page/')->end();
<?php /* * This file is part of the symfony package. * (c) Fabien Potencier <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ $app = 'frontend'; require_once dirname(__FILE__).'/../bootstrap/functional.php'; $browser = new sfTestFunctional(new sfBrowser(), null, array( 'doctrine' => 'sfTesterDoctrine', )); $browser ->get('/attachment/index') ->setField('attachment[file_path]', sfConfig::get('sf_config_dir').'/databases.yml') ->click('submit') ->with('response')->begin() ->checkElement('h1:contains("ok")') ->end() ->with('doctrine')->check('Attachment', array( 'file_path' => AttachmentForm::TEST_GENERATED_FILENAME, ), 1) ;
<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; $browser = new sfTestFunctional(new sfBrowser()); $browser->get('/electcrical_transformers/index')->with('request')->begin()->isParameter('module', 'electrical_transformers')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '!/This is a temporary page/')->end();
<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; $browser = new sfTestFunctional(new sfBrowser()); $browser->get('/shipping_transaction/index')->with('request')->begin()->isParameter('module', 'shipping_transaction')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '!/This is a temporary page/')->end();
<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; $browser = new sfTestFunctional(new sfBrowser()); $browser->get('/leerlijn_sleutelinzicht/index')->with('request')->begin()->isParameter('module', 'leerlijn_sleutelinzicht')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '!/This is a temporary page/')->end();