[Kde-bindings] KDE/kdebindings/php/phpqt

Thomas Moenicke tm at php-qt.org
Fri Oct 31 22:31:40 UTC 2008


SVN commit 878326 by moenicke:

* added unittests to the buildsystem, tests can be invoked typing "make test" in case phpunit is installed
* updated build instructions in the README file

CCMAIL: kde-bindings at kde.org



 M  +22 -0     CMakeLists.txt.php-qt  
 M  +7 -1      README  
 M  +2 -1      tests/QtBasicTestCase.php  
 A             tests/config.php  
 A             tests/config.php.conf  


--- trunk/KDE/kdebindings/php/phpqt/CMakeLists.txt.php-qt #878325:878326
@@ -45,3 +45,25 @@
 add_subdirectory(tests)
 add_subdirectory(tools)
 
+if(PHPUNIT_EXECUTABLE)
+  MESSAGE(STATUS "phpunit found: configuring for tests")
+  ENABLE_TESTING()
+  SET(RUNTIME_OUTPUT_DIRECTORY_ORIG)
+  SET(RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}"/tests/")
+
+  SET(PHPQT_TEST_FILES
+    QtLoadModuleTestCase.php
+    QtBasicTestCase.php
+    )
+
+  CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/tests/config.php.conf ${CMAKE_BUILD_DIR}config.php @ONLY )
+  FOREACH(TEST_CASE ${PHPQT_TEST_FILES} )
+    CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/tests/${TEST_CASE} ${CMAKE_BUILD_DIR}${TEST_CASE} COPYONLY )
+    ADD_TEST( ${TEST_CASE} ${PHPUNIT_EXECUTABLE} --log-tap ${TEST_CASE}.log ${TEST_CASE} )
+    MESSAGE(STATUS "added "${TEST_CASE} )
+  ENDFOREACH(TEST_CASE)
+
+  SET(RUNTIME_OUTPUT_DIRECTORY ${RUNTIME_OUTPUT_DIRECTORY_ORIG})
+elseif(PHPUNIT_EXECUTABLE)
+  MESSAGE(STATUS "no tests configured (needs phpunit)")
+endif(PHPUNIT_EXECUTABLE)
--- trunk/KDE/kdebindings/php/phpqt/README #878325:878326
@@ -35,8 +35,8 @@
 5) run 'make install'
 6) run 'ldconfig'
 7) add the line 'extension=php_qt.so' to your php.ini
+8) run make test (if phpunit was found)
 
-
 The more detailed way:
 
 First make sure CMake, your PHP header files, and your Qt header files are
@@ -92,6 +92,12 @@
 PHP-Qt support => enabled
 qt.codec => UTF8 => UTF8
 
+To run tests go into your build dir and invoke:
+
+make test
+
+Alternatively you can run 'phpunit QtBasicTestCase.php' or other tests in the tests folder.
+
 To remove old objectfiles run:
 
 make clean
--- trunk/KDE/kdebindings/php/phpqt/tests/QtBasicTestCase.php #878325:878326
@@ -11,7 +11,8 @@
      *  - test returning references
      */
 
-    require_once('testHelper.php');
+    require_once('config.php');
+    require_once($tests_path.'/testHelper.php');
 
     require_once('PHPUnit/Framework/TestCase.php');
     require_once('PHPUnit/Framework/TestSuite.php');



More information about the Kde-bindings mailing list