Permalink
Browse files

use modern phpunit (#1787)

* use modern phpunit
* run CS only against PHP 7.1
  • Loading branch information...
remicollet authored and trasher committed Feb 8, 2017
1 parent 7c8f92a commit 1df387eb037214d9c0a419fbb013b76ff760c614
View
@@ -10,15 +10,17 @@ env:
before_script:
- composer self-update
- composer install -o
- sed -e '/"php":/d' -i composer.json
- rm -f composer.lock
- composer install --optimize-autoloader
- mysql -u root -e 'create database glpitest;'
- php tools/cliinstall.php --db=glpitest --user=root --tests
- php -S localhost:8088 tests/router.php &>/dev/null &
script:
- mysql -u root -e 'select version();'
- vendor/bin/phpunit --verbose
- vendor/bin/phpcs -p --standard=vendor/glpi-project/coding-standard/GlpiStandard/ --ignore=/vendor/,/plugins/,/files/,/lib/,/config/,/tests/config ./
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.1" ]]; then vendor/bin/phpcs -p --standard=vendor/glpi-project/coding-standard/GlpiStandard/ --ignore=/vendor/,/plugins/,/files/,/lib/,/config/,/tests/config ./; fi
#note: default maria version is 5.5 for all main php versions list exept nightly
matrix:
View
@@ -38,7 +38,7 @@
"consolidation/robo": "^1.0",
"natxet/CssMin": "^3.0",
"patchwork/jsqueeze": "^2.0",
"phpunit/phpunit": "^5.7"
"phpunit/phpunit": "^5.7 || ^6.0"
},
"suggest": {
"ext-ldap": "Used ot provide LDAP authentication and synchronization",
@@ -1266,7 +1266,7 @@ static function getSpecificValueToSelect($field, $name='', $values='', array $op
function getRights($interface='central') {
$values = parent::getRights();
unset($values[UPDATE], $values[READ]);
unset($values[UPDATE], $values[READ]);
$values[self::VALIDATE] = __('Validate');
View
@@ -2284,7 +2284,7 @@ static function addSelect($itemtype, $ID, $num, $meta=0, $meta_type=0) {
if ($plug = isPluginItemType($itemtype)) {
$function = 'plugin_'.$plug['plugin'].'_addSelect';
if (function_exists($function)) {
$out = $function($itemtype,$ID,$num);
$out = $function($itemtype, $ID, $num);
if (!empty($out)) {
return $out;
}
@@ -4731,7 +4731,7 @@ static function giveItem($itemtype, $ID, array $data, $num, $meta=0,
$plug = $matches[1];
$function = 'plugin_'.$plug.'_giveItem';
if (function_exists($function)) {
$out = $function($itemtype,$ID,$data,$num);
$out = $function($itemtype, $ID, $data, $num);
if (!empty($out)) {
return $out;
}
@@ -26,7 +26,7 @@
--------------------------------------------------------------------------
*/
abstract class APIBaseClass extends PHPUnit_Framework_TestCase {
abstract class APIBaseClass extends PHPUnit\Framework\TestCase {
abstract protected function query($resource = "",
$params = [],
$expected_code = 200);
@@ -1039,4 +1039,4 @@ protected function checkEmptyContentRange($data, $headers) {
$this->assertEquals(0, $data['totalcount']);
$this->assertArrayNotHasKey('Content-Range', $headers);
}
}
}
View
@@ -32,7 +32,7 @@
// Generic test classe, to be extended for CommonDBTM Object
class DbTestCase extends PHPUnit_Framework_TestCase {
class DbTestCase extends PHPUnit\Framework\TestCase {
protected function setUp() {
global $DB;
View
@@ -32,7 +32,7 @@
/* Test for inc/html.class.php */
class HtmlTest extends PHPUnit_Framework_TestCase {
class HtmlTest extends PHPUnit\Framework\TestCase {
/**
* @covers Html::convDate
View
@@ -32,7 +32,7 @@
/* Test for inc/session.class.php */
class SessionTest extends PHPUnit_Framework_TestCase {
class SessionTest extends PHPUnit\Framework\TestCase {
/**
* @covers Session::addMessageAfterRedirect
View
@@ -32,7 +32,7 @@
/* Test for inc/ticket.class.php */
class TicketTest extends PHPUnit_Framework_TestCase {
class TicketTest extends PHPUnit\Framework\TestCase {
public function ticketProvider() {
return array(
@@ -150,4 +150,4 @@ protected function _testTicketUser(Ticket $ticket, $actor, $role, $notify, $alte
}
}
}
}
View
@@ -32,7 +32,7 @@
/* Test for inc/html.class.php */
class ToolboxTest extends PHPUnit_Framework_TestCase {
class ToolboxTest extends PHPUnit\Framework\TestCase {
/**
* @covers Toolbox::getRandomString

0 comments on commit 1df387e

Please sign in to comment.