From bb80fdb337bf5a3354410e5fc0f3723d57bc2b13 Mon Sep 17 00:00:00 2001 From: xisi Date: Fri, 17 Jan 2014 09:16:11 -0500 Subject: [PATCH] PHPUnit test harness & sample test --- .gitignore | 3 +++ tests/README.md | 17 +++++++++++++++++ tests/phpunit.xml | 5 +++++ tests/unit/config/SampleTest.php | 21 +++++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 tests/README.md create mode 100644 tests/phpunit.xml create mode 100644 tests/unit/config/SampleTest.php diff --git a/.gitignore b/.gitignore index 15e9bfc9..69d6343e 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ public/include/config/global.inc.sha.php .buildpath .project .settings + +# Unit testing +tests/phpunit/* diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 00000000..2f859a90 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,17 @@ +How to run these tests +====================== + + * Download and install phpunit (http://phpunit.de/manual/3.7/en/installation.html) + * `phpunit tests/unit` + + +How to add tests +================ + + * Add unit tests to the matching folder/file.php or create a new one + * Add any new suites to the phpunit.xml file + * Below is the suite entry for the sample test in unit/config/SampleTest.php + +` + unit/config +` diff --git a/tests/phpunit.xml b/tests/phpunit.xml new file mode 100644 index 00000000..6cafbdac --- /dev/null +++ b/tests/phpunit.xml @@ -0,0 +1,5 @@ + + + unit/config + + \ No newline at end of file diff --git a/tests/unit/config/SampleTest.php b/tests/unit/config/SampleTest.php new file mode 100644 index 00000000..8e45f3e8 --- /dev/null +++ b/tests/unit/config/SampleTest.php @@ -0,0 +1,21 @@ +assertNotEmpty(SALT); + $this->assertGreaterThan(1, strlen(SALT)); + } +} + +?> \ No newline at end of file