aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStevan Radakovic <stevan.radakovic@linaro.org>2012-05-11 16:02:52 +0200
committerStevan Radakovic <stevan.radakovic@linaro.org>2012-05-11 16:02:52 +0200
commit6333a1518c26daadbfdfd38886089557ce27e353 (patch)
treeb552ab285daec30a5825a86903c5a56b8a9c0845
parent5c28bce1dc02c6021d3d10504d3347ec61694acd (diff)
Add tests to testrepository to run the PHP unit tests automatically additional file
-rw-r--r--testing/test_php_unit.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/testing/test_php_unit.py b/testing/test_php_unit.py
new file mode 100644
index 0000000..15da999
--- /dev/null
+++ b/testing/test_php_unit.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+import os
+import subprocess
+import xml.etree.ElementTree as etree
+
+from testtools import TestCase
+from testtools.matchers import Equals
+
+class PhpUnitTest(TestCase):
+ '''Tests for executing the PHP Unit tests'''
+
+ def setUp(self):
+ super(PhpUnitTest, self).setUp()
+ self.xml_path = "testing/php_unit_test_result.xml"
+ if subprocess.Popen(['phpunit', '--log-junit',
+ self.xml_path, 'testing/LicenseHelperTest'],
+ stdout=open('/dev/null', 'w'),
+ stderr=subprocess.STDOUT).wait():
+ raise CommandNotFoundException("phpunit command not found. Please "
+ "install phpunit package and rerun tests.")
+ self.xml_data = etree.parse(self.xml_path)
+
+ def tearDown(self):
+ super(PhpUnitTest, self).tearDown()
+ if os.path.exists(self.xml_path):
+ os.unlink(self.xml_path)
+
+ def test_run_php_unit_tests(self):
+ self.assertThat(self.xml_data.getroot()[0].attrib['failures'],
+ Equals("0"))
+ self.assertThat(self.xml_data.getroot()[0].attrib['errors'],
+ Equals("0"))