Updated CI config for Travis, preload OLE (#16)

* Test only on supported PHP versions on Travis CI.

* Preload OLE.php as contains important constants.
Were getting: Use of undefined constant OLE_PPS_TYPE_FILE - assumed 'OLE_PPS_TYPE_FILE' (this will throw an Error in a future version of PHP) in OLE/PPS/File.php:60

* Forbid installing on PHP 7.3 for time being.
pear/OLE does not really work on PHP 7.3, so this package is also unusable there.
This commit is contained in:
Alexey Kopytko 2018-10-23 10:53:35 +09:00 committed by GitHub
parent 71f006f7ed
commit 2fc22c490b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 4 deletions

View File

@ -2,11 +2,11 @@ sudo: false
language: php language: php
php: php:
- 5.3
- 5.4
- 5.5 - 5.5
- 5.6 - 5.6
- 7.0
- 7.1 - 7.1
- 7.2
cache: cache:
directories: directories:
@ -15,3 +15,5 @@ cache:
install: install:
- composer install --prefer-dist - composer install --prefer-dist
script:
- php vendor/bin/phpunit

View File

@ -39,6 +39,10 @@ if (!class_exists('Spreadsheet_Excel_Writer_BIFFwriter')) {
require_once 'Spreadsheet/Excel/Writer/Parser.php'; require_once 'Spreadsheet/Excel/Writer/Parser.php';
} }
if (!class_exists('OLE')) {
require_once 'OLE.php';
}
if (!class_exists('OLE_PPS_Root')) { if (!class_exists('OLE_PPS_Root')) {
require_once 'OLE/PPS/Root.php'; require_once 'OLE/PPS/Root.php';
} }

View File

@ -51,8 +51,8 @@
"type": "library", "type": "library",
"require": { "require": {
"pear/pear-core-minimal": "^1.10", "pear/pear-core-minimal": "^1.10",
"pear/ole": "*", "pear/ole": ">=1.0.0RC3",
"php": ">=5.3.3" "php": ">=5.3.3 <7.3"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "<6.0" "phpunit/phpunit": "<6.0"

View File

@ -6,6 +6,12 @@
*/ */
class Test_Spreadsheet_Excel_Writer_WorkbookTest extends Test_Spreadsheet_Excel_WriterTestCase class Test_Spreadsheet_Excel_Writer_WorkbookTest extends Test_Spreadsheet_Excel_WriterTestCase
{ {
public static function setUpBeforeClass()
{
// Preload constants from OLE
@class_exists(OLE::class);
}
public function testSetVersion() public function testSetVersion()
{ {
$workbook = $this->getNewWorkbook(); $workbook = $this->getNewWorkbook();