diff --git a/.travis.yml b/.travis.yml index cf8543d5db..96b588068a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,9 +13,9 @@ services: sudo: required install: - - if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then source ~/virtualenv/python3.6/bin/activate ; fi + - if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then source ~/virtualenv/python3.6/bin/activate ; fi - ./test/ci-install-$CI_MODE - - if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then case "$TRAVIS_PHP_VERSION" in hhvm*) ;; *) phpenv config-add test/php-noprofile.ini ;; esac ; fi + - if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then case "$TRAVIS_PHP_VERSION" in hhvm*) ;; *) phpenv config-add test/php-noprofile.ini ;; esac ; fi before_script: - export TESTSUITE_PASSWORD=`openssl rand -base64 30` @@ -89,6 +89,18 @@ jobs: php: "nightly" name: "PHP nightly" env: CI_MODE=test + - stage: "PHP Unit tests" + name: "PHP 7.2" + os: windows + language: sh + env: CI_MODE=test + before_install: + - choco install php composer mariadb + - export PATH=/c/tools/php72:/c/ProgramData/ComposerSetup/bin:/c/"Program Files"/"MariaDB 10.2"/bin:$PATH + - PHP_EXTENSIONS="mysqli curl bz2 gd2 pdo_mysql" + - for php_ext in $PHP_EXTENSIONS ; do sed -i -e "s/^;extension=${php_ext}/extension=${php_ext}/" /c/tools/php72/php.ini ; done + - sed -i -e 's/^memory_limit = .*/memory_limit = -1/' /c/tools/php72/php.ini + - find . -type f -name "*.php" -print0 | xargs -0 sed -i ':a;N;$!ba;s/\r//g' - stage: "Other tests" name: "Build release" php: "7.1" @@ -132,6 +144,7 @@ jobs: env: CI_MODE=test - php: "7.2" env: CI_MODE=phpstan + - os: windows cache: pip: true diff --git a/libraries/classes/Config.php b/libraries/classes/Config.php index e7bc5efdbc..8c4b562d05 100644 --- a/libraries/classes/Config.php +++ b/libraries/classes/Config.php @@ -458,7 +458,7 @@ class Config return; } // split file to lines - $ref_lines = explode("\n", $packed_refs); + $ref_lines = explode(PHP_EOL, $packed_refs); foreach ($ref_lines as $line) { // skip comments if ($line[0] == '#') { diff --git a/libraries/classes/Engines/Innodb.php b/libraries/classes/Engines/Innodb.php index 3e54b13f13..37332b4d16 100644 --- a/libraries/classes/Engines/Innodb.php +++ b/libraries/classes/Engines/Innodb.php @@ -154,11 +154,9 @@ class Innodb extends StorageEngine // The following query is only possible because we know // that we are on MySQL 5 here (checked above)! // side note: I love MySQL 5 for this. :-) - $sql - = ' - SHOW STATUS - WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\' - OR Variable_name = \'Innodb_page_size\';'; + $sql = 'SHOW STATUS' + . ' WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\'' + . ' OR Variable_name = \'Innodb_page_size\';'; $status = $GLOBALS['dbi']->fetchResult($sql, 0, 1); $output = '
| ' . PHP_EOL + ' | ' . "\n" . ' [BLOB - 4 B]' . PHP_EOL - . ' | ' . PHP_EOL + . 'class="disableAjax">[BLOB - 4 B]' . "\n" + . '' . "\n" ], [ 'noblob', @@ -1548,9 +1548,9 @@ class ResultsTest extends PmaTestCase [], 0, 'binary', - '' . PHP_EOL - . ' 1001' . PHP_EOL - . ' | ' . PHP_EOL + '' . "\n" + . ' 1001' . "\n" + . ' | ' . "\n" ], [ 'noblob', @@ -1567,12 +1567,12 @@ class ResultsTest extends PmaTestCase [], 0, 0, - '' . PHP_EOL - . ' NULL' . PHP_EOL - . ' | ' . PHP_EOL + '' . "\n" + . ' NULL' . "\n" + . ' | ' . "\n" ], [ 'all', diff --git a/test/classes/ErrorTest.php b/test/classes/ErrorTest.php index 9e2bff6de6..a2ab295429 100644 --- a/test/classes/ErrorTest.php +++ b/test/classes/ErrorTest.php @@ -98,8 +98,11 @@ class ErrorTest extends PmaTestCase public function filePathProvider() { return [ - ['./ChangeLog', './ChangeLog'], - [__FILE__, './test/classes/ErrorTest.php'], + ['./ChangeLog', '.' . DIRECTORY_SEPARATOR . 'ChangeLog'], + [ + __FILE__, + '.' . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'ErrorTest.php' + ], ['./NONEXISTING', 'NONEXISTING'], ]; } diff --git a/test/classes/ZipExtensionTest.php b/test/classes/ZipExtensionTest.php index 271255d828..427c9a92c4 100644 --- a/test/classes/ZipExtensionTest.php +++ b/test/classes/ZipExtensionTest.php @@ -148,14 +148,15 @@ class ZipExtensionTest extends PmaTestCase } /** - * Helper function to get ZipArchive for content. + * Test for createFile * - * @param mixed $file file - * - * @return ZipArchive + * @return void */ - private function getZip($file) + public function testCreateSingleFile() { + $file = $this->zipExtension->createFile("Test content", "test.txt"); + $this->assertNotEmpty($file); + $tmp = tempnam('./', 'zip-test'); $handle = fopen($tmp, 'w'); fwrite($handle, $file); @@ -166,24 +167,10 @@ class ZipExtensionTest extends PmaTestCase $zip->open($tmp) ); - unlink($tmp); - - return $zip; - } - - /** - * Test for createFile - * - * @return void - */ - public function testCreateSingleFile() - { - $file = $this->zipExtension->createFile("Test content", "test.txt"); - $this->assertNotEmpty($file); - - $zip = $this->getZip($file); - $this->assertEquals(0, $zip->locateName('test.txt')); + + $zip->close(); + unlink($tmp); } /** @@ -214,8 +201,21 @@ class ZipExtensionTest extends PmaTestCase ["name1.txt", "name2.txt"] ); $this->assertNotEmpty($file); - $zip = $this->getZip($file); + + $tmp = tempnam('./', 'zip-test'); + $handle = fopen($tmp, 'w'); + fwrite($handle, $file); + fclose($handle); + + $zip = new ZipArchive(); + $this->assertTrue( + $zip->open($tmp) + ); + $this->assertEquals(0, $zip->locateName('name1.txt')); $this->assertEquals(1, $zip->locateName('name2.txt')); + + $zip->close(); + unlink($tmp); } }