Welcome to the Cookbook

loading...
Please login to continue

4.7.4 Creando los tests

En primer lugar, revisar una serie de normas y directrices para los tests:

  1. Los archivos de PHP que contiene los tests deben estar en : app/tests/cases/[algun_ archivo].
  2. Los nombres de estos archivos deben terminar con un .test.php en lugar de sólo .php.
  3. Las clases que contienen los tests debe extender o heredar de CakeTestCase o CakeWebTestCase.
  4. El nombre de cualquier método que contenga un test (por ejemplo, que contiene una afirmación) debería comenzar con test, como en testPublished().

Cuando se crea un caso test, puede ejecutarce por medio del navegador en la siguiente dirección http://tu.dominio.cake/carpeta_cake/test.php (dependiendo de cómo se ve específicamente tu configuración) y haciendo clic en App casos de test, y a continuación, haga clic en el enlace a su archivo.

4.7.4.1 CakeTestCase Callback Methods

Todavia no hay una traducion de este texto. Por favor ayudanos y traducirla.. Mas info sobre traduciones

If you want to sneak in some logic just before or after an individual CakeTestCase method, and/or before or after your entire CakeTestCase, the following callbacks are available:

start()
First method called in a test case.

end()
Last method called in a test case.

startCase()
called before a test case is started.

endCase()
called after a test case has run.

before($method)
Announces the start of a test method.

after($method)
Announces the end of a test method.

startTest($method)
Called just before a test method is executed.

endTest($method)
Called just after a test method has completed.