Example #1
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new JobeetTestFunctional(new sfBrowser());
$browser->loadData();
$browser->setTester('doctrine', 'sfTesterDoctrine');
$browser->info('1 - The homepage')->get('/en/')->with('request')->begin()->isParameter('module', 'job')->isParameter('action', 'index')->end()->with('response')->begin()->info('  1.1 - Expired jobs are not listed')->checkElement('.jobs td.position:contains("expired")', false)->end();
$max = sfConfig::get('app_max_jobs_on_homepage');
$browser->info('1 - The homepage')->get('/en/')->info(sprintf('  1.2 - Only %s jobs are listed for a category', $max))->with('response')->checkElement('.category_programming tr', $max);
$browser->info('1 - The homepage')->get('/en/')->info('  1.4 - Jobs are sorted by date')->with('response')->begin()->checkElement(sprintf('.category_programming tr:first a[href*="/%d/"]', $browser->getMostRecentProgrammingJob()->getId()))->end();
$job = $browser->getMostRecentProgrammingJob();
$browser->info('2 - The job page')->get('/en/')->info('  2.1 - Each job on the homepage is clickable and give detailed information')->click('Web Developer', array(), array('position' => 1))->with('request')->begin()->isParameter('module', 'job')->isParameter('action', 'show')->isParameter('company_slug', $job->getCompanySlug())->isParameter('location_slug', $job->getLocationSlug())->isParameter('position_slug', $job->getPositionSlug())->isParameter('id', $job->getId())->end()->info('  2.2 - A non-existent job forwards the user to a 404')->get('/en/job/foo-inc/milano-italy/0/painter')->with('response')->isStatusCode(404)->info('  2.3 - An expired job page forwards the user to a 404')->get(sprintf('/en/job/sensio-labs/paris-france/%d/web-developer', $browser->getExpiredJob()->getId()))->with('response')->isStatusCode(404);
$browser->info('3 - Post a Job page')->info('  3.1 - Submit a Job')->get('/en/job/new')->with('request')->begin()->isParameter('module', 'job')->isParameter('action', 'new')->end()->click('Preview your job', array('job' => array('type' => 'full-time', 'company' => 'Sensio Labs', 'url' => 'http://www.sensio.com/', 'logo' => sfConfig::get('sf_upload_dir') . '/jobs/sensio-labs.gif', 'position' => 'Developer', 'location' => 'Atlanta, USA', 'description' => 'You will work with symfony to develop websites for our customers.', 'how_to_apply' => 'Send me an email', 'email' => '*****@*****.**', 'is_public' => false)))->with('request')->begin()->isParameter('module', 'job')->isParameter('action', 'create')->end()->with('form')->begin()->hasErrors(false)->end()->with('response')->isRedirected()->followRedirect()->with('request')->begin()->isParameter('module', 'job')->isParameter('action', 'show')->end()->with('doctrine')->begin()->check('JobeetJob', array('location' => 'Atlanta, USA', 'is_activated' => false, 'is_public' => false))->end();
$browser->info('  3.2 - Submit a Job with invalid values')->get('/en/job/new')->click('Preview your job', array('job' => array('company' => 'Sensio Labs', 'position' => 'Developer', 'location' => 'Atlanta, USA', 'email' => 'not.an.email')))->with('form')->begin()->hasErrors(4)->isError('type', 'required')->isError('description', 'required')->isError('how_to_apply', 'required')->isError('email', 'invalid')->end();
$browser->info('  3.3 - On the preview page, you can publish the job')->createJob(array('position' => 'FOO1'))->click('Publish', array(), array('method' => 'put', '_with_csrf' => true))->with('doctrine')->begin()->check('JobeetJob', array('position' => 'FOO1', 'is_activated' => true))->end();
$browser->info('  3.4 - On the preview page, you can delete the job')->createJob(array('position' => 'FOO2'))->click('Delete', array(), array('method' => 'delete', '_with_csrf' => true))->with('doctrine')->begin()->check('JobeetJob', array('position' => 'FOO2'), false)->end();
$browser->info('  3.5 - When a job is published, it cannot be edited anymore')->createJob(array('position' => 'FOO3'), true)->get(sprintf('/en/job/%s/edit', $browser->getJobByPosition('FOO3')->getToken()))->with('response')->begin()->isStatusCode(404)->end();
$browser->info('  3.6 - A job validity cannot be extended before the job expires soon')->createJob(array('position' => 'FOO4'), true)->call(sprintf('/en/job/%s/extend', $browser->getJobByPosition('FOO4')->getToken()), 'put', array('_with_csrf' => true))->with('response')->begin()->isStatusCode(404)->end();
$browser->info('  3.7 - A job validity can be extended when the job expires soon')->createJob(array('position' => 'FOO5'), true);
$job = $browser->getJobByPosition('FOO5');
$job->setExpiresAt(date('Y-m-d'));
$job->save();
$browser->call(sprintf('/en/job/%s/extend', $job->getToken()), 'put', array('_with_csrf' => true))->with('response')->isRedirected();
$job->refresh();
$browser->test()->is($job->getDateTimeObject('expires_at')->format('y/m/d'), date('y/m/d', time() + 86400 * sfConfig::get('app_active_days')));
$browser->info('4 - User job history')->loadData()->restart()->info('  4.1 - When the user access a job, it is added to its history')->get('/en/')->click('Web Developer', array(), array('position' => 1))->get('/en/')->with('user')->begin()->isAttribute('job_history', array($browser->getMostRecentProgrammingJob()->getId()))->end()->info('  4.2 - A job is not added twice in the history')->click('Web Developer', array(), array('position' => 1))->get('/en/')->with('user')->begin()->isAttribute('job_history', array($browser->getMostRecentProgrammingJob()->getId()))->end();
$browser->setHttpHeader('X_REQUESTED_WITH', 'XMLHttpRequest');
$browser->info('5 - Live search')->get('/en/search?query=sens*')->with('response')->begin()->checkElement('table tr', 2)->end();
$browser->setHttpHeader('ACCEPT_LANGUAGE', 'fr_FR,fr,en;q=0.7');
$browser->info('6 - User culture')->restart()->info('  6.1 - For the first request, symfony guesses the best culture')->get('/')->with('response')->isRedirected()->followRedirect()->with('user')->isCulture('fr')->info('  6.2 - Available cultures are en and fr')->get('/it/')->with('response')->isStatusCode(404);
$browser->setHttpHeader('ACCEPT_LANGUAGE', 'en,fr;q=0.7');
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new JobeetTestFunctional(new sfBrowser());
$browser->loadData();
$browser->info('1 - The category page')->info('  1.1 - Categories on homepage are clickable')->get('/')->click('Programming')->with('request')->begin()->isParameter('module', 'category')->isParameter('action', 'show')->isParameter('slug', 'programming')->end()->info(sprintf('  1.2 - Categories with more than %s jobs also have a "more" link', sfConfig::get('app_max_jobs_on_homepage')))->get('/')->click('22')->with('request')->begin()->isParameter('module', 'category')->isParameter('action', 'show')->isParameter('slug', 'programming')->end()->info(sprintf('  1.3 - Only %s jobs are listed', sfConfig::get('app_max_jobs_on_category')))->with('response')->checkElement('.jobs tr', sfConfig::get('app_max_jobs_on_category'))->info('  1.4 - The job listed is paginated')->with('response')->begin()->checkElement('.pagination_desc', '/32 jobs/')->checkElement('.pagination_desc', '#page 1/2#')->end()->click('2')->with('request')->begin()->isParameter('page', 2)->end()->with('response')->checkElement('.pagination_desc', '#page 2/2#');
Example #3
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
ini_set('memory_limit', '-1');
$browser = new JobeetTestFunctional(new sfBrowser());
$browser->loadData();
$browser->setTester('doctrine', 'sfTesterDoctrine');
$browser->info('1 - The homepage')->get('/')->with('request')->begin()->isParameter('module', 'job')->isParameter('action', 'index')->end()->with('response')->begin()->info('  1.1 - Expired jobs are not listed')->checkElement('.jobs td.position:contains("expired")', false)->end();
$max = sfConfig::get('app_max_jobs_on_homepage');
$browser->info('1 - The homepage')->info(sprintf('  1.2 - Only %s jobs are listed for a category', $max))->with('response')->checkElement('.category_programming tr', $max);
$browser->info('1 - The homepage')->get('/')->info('  1.3 - A category has a link to the category page only if too many jobs')->with('response')->begin()->checkElement('.category_design .more_jobs', false)->checkElement('.category_programming .more_jobs')->end();
$browser->info('1 - The homepage')->info('  1.4 - Jobs are sorted by date')->with('response')->begin()->checkElement(sprintf('.category_programming tr:first a[href*="/%d/"]', $browser->getMostRecentProgrammingJob()->getId()))->end();
$job = $browser->getMostRecentProgrammingJob();
$browser->info('2 - The job page')->get('/')->info('  2.1 - Each job on the homepage is clickable and give detailed information')->click('Web Developer', array(), array('position' => 1))->with('request')->begin()->isParameter('module', 'job')->isParameter('action', 'show')->isParameter('company_slug', $job->getCompanySlug())->isParameter('location_slug', $job->getLocationSlug())->isParameter('position_slug', $job->getPositionSlug())->isParameter('id', $job->getId())->end()->info('  2.2 - A non-existent job forwards the user to a 404')->get('/job/foo-inc/milano-italy/0/painter')->with('response')->isStatusCode(404)->info('  2.3 - An expired job page forwards the user to a 404')->get(sprintf('/job/sensio-labs/paris-france/%d/web-developer', $browser->getExpiredJob()->getId()))->with('response')->isStatusCode(404);
/////////////////////////////////////////////////////////
$browser->info('3 - Post a Job page')->info('  3.1 - Submit a Job')->get('/job/new')->with('request')->begin()->isParameter('module', 'job')->isParameter('action', 'new')->end()->click('Preview your job', array('job' => array('company' => 'Sensio Labs', 'url' => 'http://www.sensio.com/', 'logo' => sfConfig::get('sf_upload_dir') . '/jobs/sensio-labs.gif', 'position' => 'Developer', 'location' => 'Atlanta, USA', 'description' => 'You will work with symfony to develop websites for our customers.', 'how_to_apply' => 'Send me an email', 'email' => '*****@*****.**', 'is_public' => false)))->with('request')->begin()->isParameter('module', 'job')->isParameter('action', 'create')->end()->with('form')->begin()->hasErrors(false)->end()->with('response')->isRedirected()->followRedirect()->with('request')->begin()->isParameter('module', 'job')->isParameter('action', 'show')->end();
$browser->info('  3.2 - Submit a Job with invalid values')->get('/job/new')->click('Preview your job', array('job' => array('company' => 'Sensio Labs', 'position' => 'Developer', 'location' => 'Atlanta, USA', 'email' => 'not.an.email')))->with('form')->begin()->hasErrors(3)->isError('description', 'required')->isError('how_to_apply', 'required')->isError('email', 'invalid')->end();
$browser->info('  3.3 - On the preview page, you can publish the job')->createJob(array('position' => 'FOO1'))->click('Publish', array(), array('method' => 'put', '_with_csrf' => true))->with('doctrine')->begin()->check('JobeetJob', array('position' => 'FOO1', 'is_activated' => true))->end();
$browser->info('  3.4 - On the preview page, you can delete the job')->createJob(array('position' => 'FOO2'))->click('Delete', array(), array('method' => 'delete', '_with_csrf' => true))->with('doctrine')->begin()->check('JobeetJob', array('position' => 'FOO2'), false)->end();
// $browser->info('  3.5 - When a job is published, it cannot be edited anymore')->
//   createJob(array('position' => 'FOO3'), true)->
//   get(sprintf('/job/%s/edit', $browser->getJobByPosition('FOO3')->getToken()))->
//   with('response')->begin()->
//     isStatusCode(404)->
//   end()
// ;
// $browser->info('  3.6 - A job validity cannot be extended before the job expires soon')->
//   createJob(array('position' => 'FOO4'), true)->
//   call(sprintf('/job/%s/extend', $browser->getJobByPosition('FOO4')->getToken()), 'put', array('_with_csrf' => true))->
//   with('response')->begin()->
//     isStatusCode(404)->
Example #4
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new JobeetTestFunctional(new sfBrowser());
$browser->loadData();
$browser->info('1 - Authentication')->get('/affiliate')->click('Signin', array('signin' => array('username' => 'admin', 'password' => 'admin'), array('_with_csrf' => true)))->with('response')->isRedirected()->followRedirect()->info('2 - When validating an affiliate, an email must be sent with its token')->click('Activate', array(), array('position' => 1))->with('mailer')->begin()->checkHeader('Subject', '/Jobeet affiliate token/')->checkBody('/Your token is symfony/')->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new JobeetTestFunctional(new sfBrowser());
$browser->loadData();
//VERIFICAMOS LA VISUALIZACIÓN DE LA ACCIÓN INDEX
$browser->info('1 - The homepage')->get('/')->with('request')->begin()->isParameter('module', 'job')->isParameter('action', 'index')->end()->with('response')->begin()->info('  1.1 - Expired jobs are not listed')->checkElement('.jobs td.position:contains("expired")', false)->end();
$max = sfConfig::get('app_max_jobs_on_homepage');
$browser->info('1 - The homepage')->get('/')->info(sprintf('  1.2 - Only %s jobs are listed for a category', $max))->with('response')->checkElement('.category_programming tr', $max);
$browser->info('1 - The homepage')->get('/')->info('  1.3 - A category has a link to the category page only if too many jobs')->with('response')->begin()->checkElement('.category_design .more_jobs', false)->checkElement('.category_programming .more_jobs')->end();
$browser->info('1 - The homepage')->get('/')->info('  1.4 - Jobs are sorted by date')->with('response')->begin()->checkElement(sprintf('.category_programming tr:first a[href*="/%d/"]', $browser->getMostRecentProgrammingJob()->getId()))->end();
$browser->info('2 - The job page')->get('/')->info('  2.1 - Each job on the homepage is clickable and give detailed information')->click('Web Developer', array(), array('position' => 1))->with('request')->begin()->isParameter('module', 'job')->isParameter('action', 'show')->isParameter('company_slug', 'sensio-labs')->isParameter('location_slug', 'paris-france')->isParameter('position_slug', 'web-developer')->isParameter('id', $browser->getMostRecentProgrammingJob()->getId())->end()->info('  2.2 - A non-existent job forwards the user to a 404')->get('/job/foo-inc/milano-italy/0/painter')->with('response')->isStatusCode(404)->info('  2.3 - An expired job page forwards the user to a 404')->get(sprintf('/job/sensio-labs/paris-france/%d/web-developer', $browser->getExpiredJob()->getId()))->with('response')->isStatusCode(404);
Example #6
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
//$browser = new sfTestFunctional(new sfBrowser());
$browser = new JobeetTestFunctional(new sfBrowser());
$browser->loadData();
$browser->get('/')->with('request')->begin()->isParameter('module', 'job')->isParameter('action', 'index')->end()->with('response')->begin()->info(' 1.1 - Expired jobs are not listed ')->checkElement('.jobs td.position:contains("expired")', false)->end();
$max = sfConfig::get('app_max_jobs');
$browser->info('1 - The homepage')->get('/')->info(sprintf(' 1.2 - Only %s jobs are listed for a category', $max))->with('response')->checkElement('.category_programming tr', $max);
$browser->info('1 - The homepage')->get('/')->info(' 1.3 - A category has a link to the category page only if too many jobs')->with('response')->begin()->checkElement('.category_design .more_jobs', true)->checkElement('.category_programming .more_jobs', true)->end();
$browser->info('1 - The homepage')->get('/')->info(' 1.4 - Jobs are sorted by date')->with('response')->begin()->checkElement(sprintf('.category_programming tr:first a[href*="/%d/"]', $browser->getMostRecentProgrammingJob()->getId()))->end();
// 2
$job = $browser->getMostRecentProgrammingJob();
$browser->info('2 - The job page')->get('/')->info(' 2.1 - Each job is clickable')->click('Web Developer', array(), array('position' => 1))->with('request')->begin()->isParameter('module', 'job')->isParameter('action', 'show')->isParameter('company_slug', $job->getCompanySlug())->isParameter('location_slug', $job->getLocationSlug())->isParameter('position_slug', $job->getPositionSlug())->isParameter('id', $job->getId())->end()->info('  2.2 - A non-existent job forwards the user to a 404')->get('/job/foo-inc/milano-italy/0/painter')->with('response')->isStatusCode(404);
//info('  2.3 - An expired job page forwards the user to a 404')->
//get(sprintf('/job/sensio-labs/paris-france/%d/web-developer', $browser->getExpiredJob()->getId()))->
//with('response')->isStatusCode(404)
//
// form
$browser->info(' 3.2 - Submit a Job with invalid values')->get('job/new')->click('Preview your job', array('job' => array('company' => 'Sensio Labs', 'position' => 'Developer', 'location' => 'Location', 'email' => 'not.an.email')))->with('form')->begin()->hasErrors(3)->isError('description', 'required')->isError('how_to_apply', 'required')->isError('email', 'invalid')->end();
?>

Example #7
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new JobeetTestFunctional(new sfBrowser());
$browser->loadData();
$browser->info('1 - Web service security')->info('  1.1 - A token is needed to access the service')->get('/api/foo/jobs.xml')->with('response')->isStatusCode(404)->info('  1.2 - An inactive account cannot access the web service')->get('/api/symfony/jobs.xml')->with('response')->isStatusCode(404)->info('2 - The jobs returned are limited to the categories configured for the affiliate')->get('/api/sensio_labs/jobs.xml')->with('request')->isFormat('xml')->with('response')->begin()->isValid()->checkElement('job', 32)->end()->info('3 - The web service supports the JSON format')->get('/api/sensio_labs/jobs.json')->with('request')->isFormat('json')->with('response')->matches('/"category"\\: "Programming"/')->info('4 - The web service supports the YAML format')->get('/api/sensio_labs/jobs.yaml')->with('response')->begin()->isHeader('content-type', 'text/yaml; charset=utf-8')->matches('/category\\: Programming/')->end();
Example #8
0
<?php

$browser = new JobeetTestFunctional(new sfBrowser());
$browser->loadData();
$browser->info('1 - An affiliate can create an account')->get('/affiliate/new')->click('Submit', array('jobeet_affiliate' => array('url' => 'http://www.example.com/', 'email' => '*****@*****.**', 'jobeet_categories_list' => array(Doctrine_Core::getTable('JobeetCategory')->findOneBySlug('programming')->getId()))))->with('response')->isRedirected()->followRedirect()->with('response')->checkElement('#content h1', 'Your affiliate account has been created')->info('2 - An affiliate must at least select one category')->get('/affiliate/new')->click('Submit', array('jobeet_affiliate' => array('url' => 'http://www.example.com/', 'email' => '*****@*****.**')))->with('form')->isError('jobeet_categories_list');