oelmekki / typolight_testing
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
README
This is the testing module for Typolight. It was exported from the framework module, ( http://github.com/oelmekki/typolight_framework/tree/master ) as it probably concerns much fewer people ( since it uses a lot of ruby). Its components are : - Scripts : interactive php and mysql shells. - Cucumber : the famous ruby user-acceptance-driven-development framework. While you have to know ruby to use it, it will be a great benefit for doing tdd with Typolight. It uses Webrat and Nokogiri to simulate the browser, and so can be used with php. - PHPSpec : let you do some unit testing through this Rspec clone. It can also let you doing functional testing of RoutedModule through the RoutedModuleTest class. - Fixtures : fixtures used by cucumber and phpspec. - Dumper : A dumper backend module to dump part of the database in yaml files. ------ Config ------ put the informations about your databases in config/config.yml. dev = the normal database test = the database where to switch when launching tests You have to setup a test database to use testing. You can use rake to duplicate your normal database and load fixtures. ------ Set up ------ In the tests/fixtures directory, you must provide a fixtures.sql file that will be loaded in the test database. You can dump the current dev db as a fixture file with the rake task db:prepare ( this also load the fixture files in the test database ). Then, each .yml file in this directory is loaded in this database. It must map some database rows. All tables for which a fixture file is found is truncated. An example file is provided. You can use the ERB templating system in YAML files. ------- Scripts ------- "console" provides a php shell that can access typolight classes. "dbconsole" launch a mysql shell connected to a db specified in config.yml Each one can be passed an argument, the environment from where to run ( dev or test ) "autospec" automatically launch specs when save a file ( watched directories are specified in config/config.yml ) ------ Dumper ------ A huge part of a typolight website is contained in the database. In the development period, this can be a big problem if you work with a team. The dumper has been created to solve the database versionning problem. You can dump each record from each table in a yaml file, so it can be versionned. Then, you can load the records into your database. Cache tables are ignored. ----- Tests ----- Run phpspec with : rake specs Run cucumber with : rake features The rakefile provide several tasks. To list them, launch : rake --tasks ---------------- Third party libs ---------------- The framework module include a copy of : - phpspec, by Pádraic Brady and Travis Swicegood - sfYaml, from symfony components - sfConsolePlugin, by Geoffrey Bachelet

