Classes of Barton Phillips | > | PHP Site Class | > | docs/testing.md | > | Download |
|
|
![]() TestingphpunitYou will need to insure that 'phpunit' is installed. 'phpunit' is on GitHub checkout the README for instalation instruction. Once you have 'phpunit' installed you can run the following test:
From 'tests' directory enter:
Where 'path_to_autoload.php' is the path to the location of 'vendor/autoload.php', and 'filename' is one of the three file that follow: Using MySqlTo use the 'withMysql.php' test you will need to setup the MySql database. First you will need to create a database 'siteclass'. Then you will need to grand priveleges.
Now you can run the 'withMysql.php' with:
Using Sqlite3There is already a Sqlite3 database in the 'tests' directory. It is called just 'siteclass'. You can run the 'withSqlite3.php' with:
Top Bottom TestThe final test 'topBottom.php' does not need a database and only test the 'getPageHead', 'getPageFooter' and 'getPageTopBottom' methods and the 'includes/' files.
Feel free to extend the test if you like. Examples dbTables SiteClass Methods Additional Files Analysis and Tracking Testing Index Contact MeBarton Phillips : bartonphillips@gmail.com Copyright © 2017 Barton Phillips Project maintained by bartonlp |