Skip to content

Commit

Permalink
use modern phpunit (#1787)
Browse files Browse the repository at this point in the history
* 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 1df387e
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 14 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion inc/commonitilvalidation.class.php
Expand Up @@ -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');

Expand Down
4 changes: 2 additions & 2 deletions inc/search.class.php
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/API/APIBaseClass.php
Expand Up @@ -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);
Expand Down Expand Up @@ -1039,4 +1039,4 @@ protected function checkEmptyContentRange($data, $headers) {
$this->assertEquals(0, $data['totalcount']);
$this->assertArrayNotHasKey('Content-Range', $headers);
}
}
}
2 changes: 1 addition & 1 deletion tests/DbTestCase.php
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/HtmlTest.php
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/SessionTest.php
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/TicketTest.php
Expand Up @@ -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(
Expand Down Expand Up @@ -150,4 +150,4 @@ protected function _testTicketUser(Ticket $ticket, $actor, $role, $notify, $alte
}
}

}
}
2 changes: 1 addition & 1 deletion tests/ToolboxTest.php
Expand Up @@ -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
Expand Down

0 comments on commit 1df387e

Please sign in to comment.