17.diff (2914B)
1 diff --git a/.travis.yml b/.travis.yml 2 index 4a28809..ff2f9e9 100644 3 --- a/.travis.yml 4 +++ b/.travis.yml 5 @@ -5,13 +5,15 @@ php: 6 - 7.0 7 #RequireDB 8 env: 9 - - DB=mysql 10 + - DB=mysqli 11 #Allow errors in php7 12 matrix: 13 allow_failures: 14 - php: 7.0 15 #Create Database 16 before_script: 17 + - wget https://phar.phpunit.de/phpunit.phar 18 + - chmod +x phpunit.phar 19 - mysql -e 'create database RPICMS;' 20 #RunTests 21 -script: phpunit --configuration phpunit_$DB.xml --coverage-text 22 +script: php phpunit.phar --configuration phpunit_$DB.xml --verbose 23 diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php 24 new file mode 100644 25 index 0000000..c080079 26 --- /dev/null 27 +++ b/Tests/bootstrap.php 28 @@ -0,0 +1,10 @@ 29 + 30 +<?php 31 +function loader($class) 32 +{ 33 + $file = $class . '.php'; 34 + if (file_exists($file)) { 35 + require $file; 36 + } 37 +} 38 +spl_autoload_register('loader'); 39 diff --git a/Tests/index.php b/Tests/index.php 40 new file mode 100644 41 index 0000000..c7f154b 42 --- /dev/null 43 +++ b/Tests/index.php 44 @@ -0,0 +1,6 @@ 45 +<?php 46 +class mysqlTest extends PHPUnit_Framework_TestCase 47 +{ 48 + $this->markTestIncomplete('This test is not a test xD'); 49 +} 50 +?> 51 diff --git a/Tests/indexTest.php b/Tests/indexTest.php 52 deleted file mode 100644 53 index 8b13789..0000000 54 --- a/Tests/indexTest.php 55 +++ /dev/null 56 @@ -1 +0,0 @@ 57 - 58 diff --git a/Tests/mysqliLoadedTest.php b/Tests/mysqliLoadedTest.php 59 new file mode 100644 60 index 0000000..3dd9e5f 61 --- /dev/null 62 +++ b/Tests/mysqliLoadedTest.php 63 @@ -0,0 +1,13 @@ 64 +<?php 65 +class mysqliLoadedTest extends PHPUnit_Framework_TestCase 66 +{ 67 + public function testForMysqli() 68 + { 69 + if (!extension_loaded('mysqli')) { 70 + $this->markTestSkipped('[mysqliLoadedTest]->[testForMysqli()]: The MySQLi extension is not available'); 71 + }else{ 72 + fwrite(STDERR, print_r('[mysqliLoadedTest]->[testForMysqli()]: The MySQLi extension is available', TRUE)); 73 + } 74 + } 75 +} 76 +?> 77 diff --git a/phpunit_mysql.xml b/phpunit_mysqli.xml 78 similarity index 55% 79 rename from phpunit_mysql.xml 80 rename to phpunit_mysqli.xml 81 index c3878bd..d419812 100644 82 --- a/phpunit_mysql.xml 83 +++ b/phpunit_mysqli.xml 84 @@ -1,18 +1,14 @@ 85 <?xml version="1.0" encoding="UTF-8"?> 86 87 -<phpunit indexTest="Tests/indexTest.php" colors="true"> 88 +<phpunit bootstrap="Tests/bootstrap.php" colors="true" verbose="true"> 89 <php> 90 - <var name="db_dsn" value="mysql:dbname=hello_world_test;host=localhost"/> 91 + <var name="db_dsn" value="mysqli:dbname=RPICMS;host=localhost"/> 92 <var name="db_username" value="root"/> 93 <var name="db_password" value=""/> 94 </php> 95 - 96 - <testsuites> 97 - <testsuite name="RPICMS Test Suite"> 98 - <directory>./Tests/</directory> 99 - </testsuite> 100 - </testsuites> 101 - 102 + <testsuite name="mysqliLoadedTest"> 103 + <file>Tests/mysqliLoadedTest.php</file> 104 + </testsuite> 105 <filter> 106 <whitelist> 107 <directory>./</directory>