commit 7bb2806a035fa5895a7d984d68b8e51078f5dd44
parent da6a629280110b8d1fe8e6d78e0b4325fb3c13e7
Author: Marcel <MTRNord@users.noreply.github.com>
Date: Tue, 13 Oct 2015 21:04:51 +0200
Merge pull request #1 from MTRNord/develop
Develop
Diffstat:
5 files changed, 70 insertions(+), 0 deletions(-)
diff --git a/.travis.yml b/.travis.yml
@@ -0,0 +1,24 @@
+#Test php5.6 and php7.0
+language: php
+php:
+ - 5.6
+ - 7.0
+ - hhvm
+#Allow errors in php7
+matrix:
+ allow_failures:
+ - php: 7.0
+ - php: hhvm
+before_script:
+ - wget https://phar.phpunit.de/phpunit.phar
+ - chmod +x phpunit.phar
+#RunTests
+script: php phpunit.phar --configuration phpunit.xml --verbose
+#Webhook for Gitter
+notifications:
+ webhooks:
+ urls:
+ - https://webhooks.gitter.im/e/5eacb5c124fcb31d1531
+ on_success: change # options: [always|never|change] default: always
+ on_failure: always # options: [always|never|change] default: always
+ on_start: never # options: [always|never|change] default: always
diff --git a/phpunit.xml b/phpunit.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<phpunit bootstrap="tests/bootstrap.php" colors="true" verbose="true">
+ <testsuite name="mysqliLoadedTest">
+ <file>tests/mysqliLoadedTest.php</file>
+ <file>tests/mysqliMakeDB.php</file>
+ </testsuite>
+</phpunit>
diff --git a/tests/AutoLoader.php b/tests/AutoLoader.php
@@ -0,0 +1,29 @@
+<?php
+class AutoLoader {
+ static private $classNames = array();
+ /**
+ * Store the filename (sans extension) & full path of all ".php" files found
+ */
+ public static function registerDirectory($dirName) {
+ $di = new DirectoryIterator($dirName);
+ foreach ($di as $file) {
+ if ($file->isDir() && !$file->isLink() && !$file->isDot()) {
+ // recurse into directories other than a few special ones
+ self::registerDirectory($file->getPathname());
+ } elseif (substr($file->getFilename(), -4) === '.php') {
+ // save the class name / path of a .php file found
+ $className = substr($file->getFilename(), 0, -4);
+ AutoLoader::registerClass($className, $file->getPathname());
+ }
+ }
+ }
+ public static function registerClass($className, $fileName) {
+ AutoLoader::$classNames[$className] = $fileName;
+ }
+ public static function loadClass($className) {
+ if (isset(AutoLoader::$classNames[$className])) {
+ require_once(AutoLoader::$classNames[$className]);
+ }
+ }
+ }
+ spl_autoload_register(array('AutoLoader', 'loadClass'));
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
@@ -0,0 +1,3 @@
+<?php
+include_once('AutoLoader.php');
+AutoLoader::registerDirectory('tests');
diff --git a/tests/index.php b/tests/index.php
@@ -0,0 +1,6 @@
+<?php
+class mysqlTest extends PHPUnit_Framework_TestCase
+{
+ $this->markTestIncomplete('This test is not a test xD');
+}
+?>