Author: hugo.hamon
Date: 2010-02-14 01:47:11 +0100 (Sun, 14 Feb 2010)
New Revision: 28016
Modified:
doc/branches/1.4/jobeet/en/09.markdown
doc/branches/1.4/jobeet/es/09.markdown
doc/branches/1.4/jobeet/fr/09.markdown
doc/branches/1.4/jobeet/it/09.markdown
doc/branches/1.4/jobeet/ja/09.markdown
doc/branches/1.4/jobeet/ru/09.markdown
Log:
[doc] updated chapter 9 of the Jobeet tutorial
Modified: doc/branches/1.4/jobeet/en/09.markdown
===================================================================
--- doc/branches/1.4/jobeet/en/09.markdown 2010-02-13 21:18:06 UTC (rev
28015)
+++ doc/branches/1.4/jobeet/en/09.markdown 2010-02-14 00:47:11 UTC (rev
28016)
@@ -1,10 +1,9 @@
Day 9: The Functional Tests
===========================
-Yesterday, we saw how to unit test our Jobeet classes using the lime testing
-library packaged with symfony.
+In the previous chapter, we saw how to unit test our Jobeet classes using the
lime testing library packaged with symfony.
-Today, we will write functional tests for the features we have already
+In this chapter, we will write functional tests for the features we have
already
implemented in the `job` and `category` modules.
Functional Tests
@@ -14,10 +13,7 @@
from the request made by a browser to the response sent by the server. They
~test|Testing~ all the layers of an application: the routing, the model, the
actions, and the templates. They are very similar to what you probably already
-do manually: each time you add or modify an action, you need to go to the
browser
-and check that everything works as expected by clicking on links and checking
-elements on the rendered page. In other words, you run a scenario
-corresponding to the use case you have just implemented.
+do manually: each time you add or modify an action, you need to go to the
browser and check that everything works as expected by clicking on links and
checking elements on the rendered page. In other words, you run a scenario
corresponding to the use case you have just implemented.
As the process is manual, it is tedious and error prone. Each time you change
something in your code, you must step through all the scenarios to ensure that
@@ -96,7 +92,7 @@
class delegates the tests to **~tester|Testers~** objects. Several testers are
bundled with symfony, and you can also create your own.
-As we saw yesterday, functional tests are stored under the `test/functional/`
+As we saw in chapter 8, functional tests are stored under the
`test/functional/`
directory. For Jobeet, tests are to be found in the
`test/functional/frontend/` sub-directory as each application has its own
subdirectory. This directory already contains two files:
@@ -123,10 +119,10 @@
end()
;
-At first, the script above may look a bit strange to you. That's because
+At first sight, the script above may look a bit strange to you. That's because
methods of `sfBrowser` and `sfTestFunctional` implement a
[~fluent interface|Fluent
Interface~](http://en.wikipedia.org/wiki/Fluent_interface)
-by always returning `$this`. It allows you to chain the method calls for better
+by always returning `$this`. It allows you to chain method calls for better
readability. The above snippet is equivalent to:
[php]
@@ -186,10 +182,15 @@
| Method | Description
| ------------------ | -----------------------------------------------------
| `checkElement()` | Checks if a response CSS selector match some criteria
+ | `checkForm()` | Checks an `sfForm` form object
+ | `debug()` | Prints the response output to ease debug
+ | `matches()` | Tests a response against a regexp
| `isHeader()` | Checks the value of a header
| `isStatusCode()` | Checks the response status code
| `isRedirected()` | Checks if the current response is a redirect
- | `isValid()` | Checks if a response is well-formed XML (you also
validate the response again its document type be passing `true` as an argument)
+ | `isValid()` | Checks if a response is well-formed XML (you also
+ | | validate the response again its document type be
passing
+ | | `true` as an argument)
>**NOTE**
>We will describe more [testers](http://www.symfony-project.org/api/1_4/test)
@@ -224,7 +225,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
Loading data in a functional test is a bit easier than in unit tests as the
@@ -245,7 +246,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
return $this;
@@ -404,8 +405,9 @@
->from('JobeetJob j')
->leftJoin('j.JobeetCategory c')
->where('c.slug = ?', 'programming');
- $q = Doctrine::getTable('JobeetJob')->addActiveJobsQuery($q);
+ $q = Doctrine_Core::getTable('JobeetJob')->addActiveJobsQuery($q);
+
return $q->fetchOne();
</doctrine>
}
@@ -429,6 +431,8 @@
### Each job on the homepage is clickable
[php]
+ $job = $browser->getMostRecentProgrammingJob();
+
$browser->info('2 - The job page')->
get('/')->
@@ -437,10 +441,10 @@
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())->
+ isParameter('company_slug', $job->getCompanySlug())->
+ isParameter('location_slug', $job->getLocationSlug())->
+ isParameter('position_slug', $job->getPositionSlug())->
+ isParameter('id', $job->getId())->
end()
;
@@ -468,7 +472,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
return $this;
@@ -494,8 +498,9 @@
->from('JobeetJob j')
->leftJoin('j.JobeetCategory c')
->where('c.slug = ?', 'programming');
- $q = Doctrine::getTable('JobeetJob')->addActiveJobsQuery($q);
+ $q = Doctrine_Core::getTable('JobeetJob')->addActiveJobsQuery($q);
+
return $q->fetchOne();
</doctrine>
}
@@ -561,16 +566,20 @@
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', 'sensio-labs')->
- isParameter('location_slug', 'paris-france')->
- isParameter('position_slug', 'web-developer')->
- isParameter('id', $browser->getMostRecentProgrammingJob()->getId())->
+ 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')->
Modified: doc/branches/1.4/jobeet/es/09.markdown
===================================================================
--- doc/branches/1.4/jobeet/es/09.markdown 2010-02-13 21:18:06 UTC (rev
28015)
+++ doc/branches/1.4/jobeet/es/09.markdown 2010-02-14 00:47:11 UTC (rev
28016)
@@ -152,6 +152,9 @@
| Método | Descripción
| ------------------ |
-----------------------------------------------------------
| `checkElement()` | Comprueba si un selector CSS de la respuesta coincide
con algunos criterios
+ | `checkForm()` | Checks an `sfForm` form object
+ | `debug()` | Prints the response output to ease debug
+ | `matches()` | Tests a response against a regexp
| `isHeader()` | Verifica el valor de una cabecera
| `isStatusCode()` | Verifica el código de estado de la respuesta
| `isRedirected()` | Verifica si la respuesta actual es un
redireccionamiento
@@ -186,7 +189,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
Cargar datos en una prueba funcional es un poco más fácil que en pruebas
unitarias pues la base de datos ya ha sido inicializadas por el script
bootstrapping.
@@ -204,7 +207,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
return $this;
@@ -343,7 +346,7 @@
->from('JobeetJob j')
->leftJoin('j.JobeetCategory c')
->where('c.slug = ?', 'programming');
- $q = Doctrine::getTable('JobeetJob')->addActiveJobsQuery($q);
+ $q = Doctrine_Core::getTable('JobeetJob')->addActiveJobsQuery($q);
return $q->fetchOne();
</doctrine>
@@ -368,6 +371,8 @@
### Cada puesto de trabajo en la página principal es cliqueable
[php]
+ $job = $browser->getMostRecentProgrammingJob();
+
$browser->info('2 - The job page')->
get('/')->
@@ -376,10 +381,10 @@
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())->
+ isParameter('company_slug', $job->getCompanySlug())->
+ isParameter('location_slug', $job->getLocationSlug())->
+ isParameter('position_slug', $job->getPositionSlug())->
+ isParameter('id', $job->getId())->
end()
;
@@ -403,7 +408,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
return $this;
@@ -429,7 +434,7 @@
->from('JobeetJob j')
->leftJoin('j.JobeetCategory c')
->where('c.slug = ?', 'programming');
- $q = Doctrine::getTable('JobeetJob')->addActiveJobsQuery($q);
+ $q = Doctrine_Core::getTable('JobeetJob')->addActiveJobsQuery($q);
return $q->fetchOne();
</doctrine>
@@ -496,16 +501,20 @@
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', 'sensio-labs')->
- isParameter('location_slug', 'paris-france')->
- isParameter('position_slug', 'web-developer')->
- isParameter('id', $browser->getMostRecentProgrammingJob()->getId())->
+ 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')->
Modified: doc/branches/1.4/jobeet/fr/09.markdown
===================================================================
--- doc/branches/1.4/jobeet/fr/09.markdown 2010-02-13 21:18:06 UTC (rev
28015)
+++ doc/branches/1.4/jobeet/fr/09.markdown 2010-02-14 00:47:11 UTC (rev
28016)
@@ -185,7 +185,12 @@
| Method | Description
| ------------------ | -----------------------------------------------------
- | `checkElement()` | Vérifie si le sélecteur CSS d'une réponse correspond à
certains critères
+ | `checkElement()` | Vérifie si le sélecteur CSS d'une réponse correspond à
+ | | certains critères
+ | `checkForm()` | Vérifie un objet de formulaire `sfForm`
+ | `debug()` | Affiche le contenu de la réponse afin de faciliter le
+ | | débogage
+ | `matches()` | Teste une réponse avec une expression régulière
| `isHeader()` | Vérifie la valeur de l'entête
| `isStatusCode()` | Vérifie le code du statut de la réponse
| `isRedirected()` | Vérifie si la réponse actuelle est une redirection
@@ -224,7 +229,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
Le chargement des données dans un test fonctionnel est un peu plus facile que
pour les tests
@@ -245,7 +250,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
return $this;
@@ -404,7 +409,7 @@
->from('JobeetJob j')
->leftJoin('j.JobeetCategory c')
->where('c.slug = ?', 'programming');
- $q = Doctrine::getTable('JobeetJob')->addActiveJobsQuery($q);
+ $q = Doctrine_Core::getTable('JobeetJob')->addActiveJobsQuery($q);
return $q->fetchOne();
</doctrine>
@@ -429,6 +434,8 @@
### Chaque emploi sur la page d'accueil est cliquable
[php]
+ $job = $browser->getMostRecentProgrammingJob();
+
$browser->info('2 - The job page')->
get('/')->
@@ -437,10 +444,10 @@
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())->
+ isParameter('company_slug', $job->getCompanySlug())->
+ isParameter('location_slug', $job->getLocationSlug())->
+ isParameter('position_slug', $job->getPositionSlug())->
+ isParameter('id', $job->getId())->
end()
;
@@ -468,7 +475,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
return $this;
@@ -494,7 +501,7 @@
->from('JobeetJob j')
->leftJoin('j.JobeetCategory c')
->where('c.slug = ?', 'programming');
- $q = Doctrine::getTable('JobeetJob')->addActiveJobsQuery($q);
+ $q = Doctrine_Core::getTable('JobeetJob')->addActiveJobsQuery($q);
return $q->fetchOne();
</doctrine>
@@ -561,16 +568,20 @@
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', 'sensio-labs')->
- isParameter('location_slug', 'paris-france')->
- isParameter('position_slug', 'web-developer')->
- isParameter('id', $browser->getMostRecentProgrammingJob()->getId())->
+ 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')->
Modified: doc/branches/1.4/jobeet/it/09.markdown
===================================================================
--- doc/branches/1.4/jobeet/it/09.markdown 2010-02-13 21:18:06 UTC (rev
28015)
+++ doc/branches/1.4/jobeet/it/09.markdown 2010-02-14 00:47:11 UTC (rev
28016)
@@ -189,6 +189,9 @@
| Metodo | Descrizione
| ------------------ | -----------------------------------------------------
| `checkElement()` | Verifica se un selettore CSS di risposta corrisponda
ad un criterio
+ | `checkForm()` | Checks an `sfForm` form object
+ | `debug()` | Prints the response output to ease debug
+ | `matches()` | Tests a response against a regexp
| `isHeader()` | Controlla il valore dell'header
| `isStatusCode()` | Controlla il codice di stato della risposta
| `isRedirected()` | Controlla se la risposta corrente è un rinvio
@@ -228,7 +231,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
Caricare dati in un test funzionale è più facile rispetto ad un test unitario,
@@ -248,7 +251,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
return $this;
@@ -437,6 +440,8 @@
### Ogni lavoro nella homepage è cliccabile
[php]
+ $job = $browser->getMostRecentProgrammingJob();
+
$browser->info('2 - The job page')->
get('/')->
@@ -445,10 +450,10 @@
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())->
+ isParameter('company_slug', $job->getCompanySlug())->
+ isParameter('location_slug', $job->getLocationSlug())->
+ isParameter('position_slug', $job->getPositionSlug())->
+ isParameter('id', $job->getId())->
end()
;
@@ -478,7 +483,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
return $this;
@@ -572,16 +577,20 @@
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', 'sensio-labs')->
- isParameter('location_slug', 'paris-france')->
- isParameter('position_slug', 'web-developer')->
- isParameter('id', $browser->getMostRecentProgrammingJob()->getId())->
+ 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')->
Modified: doc/branches/1.4/jobeet/ja/09.markdown
===================================================================
--- doc/branches/1.4/jobeet/ja/09.markdown 2010-02-13 21:18:06 UTC (rev
28015)
+++ doc/branches/1.4/jobeet/ja/09.markdown 2010-02-14 00:47:11 UTC (rev
28016)
@@ -143,6 +143,9 @@
| メソッド | 説明
| ------------------ | ------------------------------------------------------
| `checkElement()` | レスポンスの CSS セレクターが基準を満たすかチェックする
+ | `checkForm()` | Checks an `sfForm` form object
+ | `debug()` | Prints the response output to ease debug
+ | `matches()` | Tests a response against a regexp
| `isHeader()` | ヘッダーの値をチェックする
| `isStatusCode()` | レスポンスステータスコードをチェックする
| `isRedirected()` | 現在のレスポンスがリダイレクトであるかをチェックする
@@ -178,7 +181,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
すでにデータベースがブートストラップスクリプトで初期化されているので、機能テストでのデータのロードはユニットテストよりも少し簡単です。
@@ -196,7 +199,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
return $this;
@@ -334,7 +337,7 @@
->from('JobeetJob j')
->leftJoin('j.JobeetCategory c')
->where('c.slug = ?', 'programming');
- $q = Doctrine::getTable('JobeetJob')->addActiveJobsQuery($q);
+ $q = Doctrine_Core::getTable('JobeetJob')->addActiveJobsQuery($q);
return $q->fetchOne();
</doctrine>
@@ -359,6 +362,8 @@
### ホームページのそれぞれの求人はクリックできる
[php]
+ $job = $browser->getMostRecentProgrammingJob();
+
$browser->info('2 - The job page')->
get('/')->
@@ -367,10 +372,10 @@
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())->
+ isParameter('company_slug', $job->getCompanySlug())->
+ isParameter('location_slug', $job->getLocationSlug())->
+ isParameter('position_slug', $job->getPositionSlug())->
+ isParameter('id', $job->getId())->
end()
;
@@ -394,7 +399,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
return $this;
@@ -420,8 +425,9 @@
->from('JobeetJob j')
->leftJoin('j.JobeetCategory c')
->where('c.slug = ?', 'programming');
- $q = Doctrine::getTable('JobeetJob')->addActiveJobsQuery($q);
+ $q = Doctrine_Core::getTable('JobeetJob')->addActiveJobsQuery($q);
+
return $q->fetchOne();
</doctrine>
}
@@ -487,16 +493,20 @@
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', 'sensio-labs')->
- isParameter('location_slug', 'paris-france')->
- isParameter('position_slug', 'web-developer')->
- isParameter('id', $browser->getMostRecentProgrammingJob()->getId())->
+ 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')->
Modified: doc/branches/1.4/jobeet/ru/09.markdown
===================================================================
--- doc/branches/1.4/jobeet/ru/09.markdown 2010-02-13 21:18:06 UTC (rev
28015)
+++ doc/branches/1.4/jobeet/ru/09.markdown 2010-02-14 00:47:11 UTC (rev
28016)
@@ -190,6 +190,9 @@
| ------------------ | -------------------------------------------------------
| `checkElement()` | Проверяет в ответном HTML наличие элементов
| | соответствующих CSS селектору
+ | `checkForm()` | Checks an `sfForm` form object
+ | `debug()` | Prints the response output to ease debug
+ | `matches()` | Tests a response against a regexp
| `isHeader()` | Проверяет значение заголовка (header)
| `isStatusCode()` | Проверяет код статуса ответа
| `isRedirected()` | Проверяет является ли ответ перенаправлением
@@ -231,7 +234,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
Загрузка данных для функциональных тестов чуть проще, чем для модульных, так
как
@@ -252,7 +255,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
return $this;
@@ -409,7 +412,7 @@
->from('JobeetJob j')
->leftJoin('j.JobeetCategory c')
->where('c.slug = ?', 'programming');
- $q = Doctrine::getTable('JobeetJob')->addActiveJobsQuery($q);
+ $q = Doctrine_Core::getTable('JobeetJob')->addActiveJobsQuery($q);
return $q->fetchOne();
</doctrine>
@@ -434,6 +437,8 @@
### Каждая вакансия на главной странице кликабельна
[php]
+ $job = $browser->getMostRecentProgrammingJob();
+
$browser->info('2 - The job page')->
get('/')->
@@ -442,10 +447,10 @@
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())->
+ isParameter('company_slug', $job->getCompanySlug())->
+ isParameter('location_slug', $job->getLocationSlug())->
+ isParameter('position_slug', $job->getPositionSlug())->
+ isParameter('id', $job->getId())->
end()
;
@@ -474,7 +479,7 @@
$loader->loadData(sfConfig::get('sf_test_dir').'/fixtures');
</propel>
<doctrine>
- Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures');
+ Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
</doctrine>
return $this;
@@ -500,7 +505,7 @@
->from('JobeetJob j')
->leftJoin('j.JobeetCategory c')
->where('c.slug = ?', 'programming');
- $q = Doctrine::getTable('JobeetJob')->addActiveJobsQuery($q);
+ $q = Doctrine_Core::getTable('JobeetJob')->addActiveJobsQuery($q);
return $q->fetchOne();
</doctrine>
@@ -567,16 +572,20 @@
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', 'sensio-labs')->
- isParameter('location_slug', 'paris-france')->
- isParameter('position_slug', 'web-developer')->
- isParameter('id', $browser->getMostRecentProgrammingJob()->getId())->
+ 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')->
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.