1.diff (3010B)
1 diff --git a/.travis.yml b/.travis.yml 2 new file mode 100644 3 index 0000000..29c94c3 4 --- /dev/null 5 +++ b/.travis.yml 6 @@ -0,0 +1,24 @@ 7 +#Test php5.6 and php7.0 8 +language: php 9 +php: 10 + - 5.6 11 + - 7.0 12 + - hhvm 13 +#Allow errors in php7 14 +matrix: 15 + allow_failures: 16 + - php: 7.0 17 + - php: hhvm 18 +before_script: 19 + - wget https://phar.phpunit.de/phpunit.phar 20 + - chmod +x phpunit.phar 21 +#RunTests 22 +script: php phpunit.phar --configuration phpunit.xml --verbose 23 +#Webhook for Gitter 24 +notifications: 25 + webhooks: 26 + urls: 27 + - https://webhooks.gitter.im/e/5eacb5c124fcb31d1531 28 + on_success: change # options: [always|never|change] default: always 29 + on_failure: always # options: [always|never|change] default: always 30 + on_start: never # options: [always|never|change] default: always 31 diff --git a/phpunit.xml b/phpunit.xml 32 new file mode 100644 33 index 0000000..fcdde63 34 --- /dev/null 35 +++ b/phpunit.xml 36 @@ -0,0 +1,8 @@ 37 +<?xml version="1.0" encoding="UTF-8"?> 38 + 39 +<phpunit bootstrap="tests/bootstrap.php" colors="true" verbose="true"> 40 + <testsuite name="mysqliLoadedTest"> 41 + <file>tests/mysqliLoadedTest.php</file> 42 + <file>tests/mysqliMakeDB.php</file> 43 + </testsuite> 44 +</phpunit> 45 diff --git a/tests/AutoLoader.php b/tests/AutoLoader.php 46 new file mode 100644 47 index 0000000..e30b629 48 --- /dev/null 49 +++ b/tests/AutoLoader.php 50 @@ -0,0 +1,29 @@ 51 +<?php 52 +class AutoLoader { 53 + static private $classNames = array(); 54 + /** 55 + * Store the filename (sans extension) & full path of all ".php" files found 56 + */ 57 + public static function registerDirectory($dirName) { 58 + $di = new DirectoryIterator($dirName); 59 + foreach ($di as $file) { 60 + if ($file->isDir() && !$file->isLink() && !$file->isDot()) { 61 + // recurse into directories other than a few special ones 62 + self::registerDirectory($file->getPathname()); 63 + } elseif (substr($file->getFilename(), -4) === '.php') { 64 + // save the class name / path of a .php file found 65 + $className = substr($file->getFilename(), 0, -4); 66 + AutoLoader::registerClass($className, $file->getPathname()); 67 + } 68 + } 69 + } 70 + public static function registerClass($className, $fileName) { 71 + AutoLoader::$classNames[$className] = $fileName; 72 + } 73 + public static function loadClass($className) { 74 + if (isset(AutoLoader::$classNames[$className])) { 75 + require_once(AutoLoader::$classNames[$className]); 76 + } 77 + } 78 + } 79 + spl_autoload_register(array('AutoLoader', 'loadClass')); 80 diff --git a/tests/bootstrap.php b/tests/bootstrap.php 81 new file mode 100644 82 index 0000000..22e6c1a 83 --- /dev/null 84 +++ b/tests/bootstrap.php 85 @@ -0,0 +1,3 @@ 86 +<?php 87 +include_once('AutoLoader.php'); 88 +AutoLoader::registerDirectory('tests'); 89 diff --git a/tests/index.php b/tests/index.php 90 new file mode 100644 91 index 0000000..c7f154b 92 --- /dev/null 93 +++ b/tests/index.php 94 @@ -0,0 +1,6 @@ 95 +<?php 96 +class mysqlTest extends PHPUnit_Framework_TestCase 97 +{ 98 + $this->markTestIncomplete('This test is not a test xD'); 99 +} 100 +?>