rpicms

A CMS for the Raspberry Pi
git clone git://archive.git.mtrnord.blog/RpicmsTeam/rpicms.git
Log | Files | Refs | README | LICENSE

commit e09c24e3547ece5e6abd005008a4fe38e2e0e320
parent 3183d7a44715b885397cd55f2908ba74b087b0c5
Author: Marcel <MTRNord@users.noreply.github.com>
Date:   Sun,  4 Oct 2015 15:35:32 +0200

Merge pull request #17 from RpicmsTeam/develop

Add First Test (MysqliLoadedTest)
Diffstat:
M.travis.yml | 6++++--
ATests/bootstrap.php | 10++++++++++
ATests/index.php | 6++++++
DTests/indexTest.php | 1-
ATests/mysqliLoadedTest.php | 13+++++++++++++
Dphpunit_mysql.xml | 24------------------------
Aphpunit_mysqli.xml | 20++++++++++++++++++++
7 files changed, 53 insertions(+), 27 deletions(-)

diff --git a/.travis.yml b/.travis.yml @@ -5,13 +5,15 @@ php: - 7.0 #RequireDB env: - - DB=mysql + - DB=mysqli #Allow errors in php7 matrix: allow_failures: - php: 7.0 #Create Database before_script: + - wget https://phar.phpunit.de/phpunit.phar + - chmod +x phpunit.phar - mysql -e 'create database RPICMS;' #RunTests -script: phpunit --configuration phpunit_$DB.xml --coverage-text +script: php phpunit.phar --configuration phpunit_$DB.xml --verbose diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php @@ -0,0 +1,10 @@ + +<?php +function loader($class) +{ + $file = $class . '.php'; + if (file_exists($file)) { + require $file; + } +} +spl_autoload_register('loader'); 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'); +} +?> diff --git a/Tests/indexTest.php b/Tests/indexTest.php @@ -1 +0,0 @@ - diff --git a/Tests/mysqliLoadedTest.php b/Tests/mysqliLoadedTest.php @@ -0,0 +1,13 @@ +<?php +class mysqliLoadedTest extends PHPUnit_Framework_TestCase +{ + public function testForMysqli() + { + if (!extension_loaded('mysqli')) { + $this->markTestSkipped('[mysqliLoadedTest]->[testForMysqli()]: The MySQLi extension is not available'); + }else{ + fwrite(STDERR, print_r('[mysqliLoadedTest]->[testForMysqli()]: The MySQLi extension is available', TRUE)); + } + } +} +?> diff --git a/phpunit_mysql.xml b/phpunit_mysql.xml @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<phpunit indexTest="Tests/indexTest.php" colors="true"> - <php> - <var name="db_dsn" value="mysql:dbname=hello_world_test;host=localhost"/> - <var name="db_username" value="root"/> - <var name="db_password" value=""/> - </php> - - <testsuites> - <testsuite name="RPICMS Test Suite"> - <directory>./Tests/</directory> - </testsuite> - </testsuites> - - <filter> - <whitelist> - <directory>./</directory> - <exclude> - <directory>./Tests</directory> - </exclude> - </whitelist> - </filter> -</phpunit> diff --git a/phpunit_mysqli.xml b/phpunit_mysqli.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<phpunit bootstrap="Tests/bootstrap.php" colors="true" verbose="true"> + <php> + <var name="db_dsn" value="mysqli:dbname=RPICMS;host=localhost"/> + <var name="db_username" value="root"/> + <var name="db_password" value=""/> + </php> + <testsuite name="mysqliLoadedTest"> + <file>Tests/mysqliLoadedTest.php</file> + </testsuite> + <filter> + <whitelist> + <directory>./</directory> + <exclude> + <directory>./Tests</directory> + </exclude> + </whitelist> + </filter> +</phpunit>