fix travis PHP7

This commit is contained in:
Martin Monperrus
2017-11-26 00:13:41 +01:00
parent dc4419678a
commit d14042b81b
2 changed files with 31 additions and 19 deletions
+2
View File
@@ -4,6 +4,8 @@ php:
- '5.4' - '5.4'
- '5.5' - '5.5'
- '5.6' - '5.6'
- '7.0'
- '7.1'
script: script:
- curl -L -o reflectivedoc.php https://www.monperrus.net/martin/reflectivedoc.php.txt - curl -L -o reflectivedoc.php https://www.monperrus.net/martin/reflectivedoc.php.txt
+25 -15
View File
@@ -24,25 +24,30 @@ function exception_error_handler($severity, $message, $file, $line) {
} }
error_reporting(E_ALL); error_reporting(E_ALL);
// setup
@copy('bibtexbrowser.local.php','bibtexbrowser.local.php.bak'); @copy('bibtexbrowser.local.php','bibtexbrowser.local.php.bak');
@unlink('bibtexbrowser.local.php'); @unlink('bibtexbrowser.local.php');
if(is_file('reflectivedoc.php')) { class Nothing {
function main() {}
}
define('BIBTEXBROWSER_MAIN','Nothing');
//require_once('bibtexbrowser.php');
set_error_handler("exception_error_handler"); set_error_handler("exception_error_handler");
require('reflectivedoc.php'); require('reflectivedoc.php');
$_GET['library'] = 1; $nsnippet=0;
foreach(getAllSnippetsInFile('bibtexbrowser.php') as $snippet) { foreach(getAllSnippetsInFile('bibtexbrowser.php') as $snippet) {
//echo $snippet;
ob_start(); ob_start();
eval($snippet); eval($snippet);
ob_get_clean(); ob_get_clean();
unset($_GET['bib']); unset($_GET['bib']);
$nsnippet++;
}
if ($nsnippet!=19) {
die('oops '.$nsnippet);
} }
restore_error_handler(); restore_error_handler();
} else {
$_GET['library']=1;
require_once ('bibtexbrowser.php');
}
class SimpleDisplayExt extends SimpleDisplay { class SimpleDisplayExt extends SimpleDisplay {
function setIndices() { function setIndices() {
@@ -53,6 +58,13 @@ class SimpleDisplayExt extends SimpleDisplay {
class BTBTest extends PHPUnit_Framework_TestCase { class BTBTest extends PHPUnit_Framework_TestCase {
protected function setUp()
{
// resetting the default link style
bibtexbrowser_configure('BIBTEXBROWSER_LINK_STYLE','bib2links_default');
bibtexbrowser_configure('ABBRV_TYPE','index');
}
function test_checkdoc() { function test_checkdoc() {
if(!is_file('gakowiki-syntax.php')) { return; } if(!is_file('gakowiki-syntax.php')) { return; }
if (!function_exists('gk_wiki2html')) { include('gakowiki-syntax.php'); } if (!function_exists('gk_wiki2html')) { include('gakowiki-syntax.php'); }
@@ -150,9 +162,6 @@ class BTBTest extends PHPUnit_Framework_TestCase {
bibtexbrowser_configure('ABBRV_TYPE','none'); bibtexbrowser_configure('ABBRV_TYPE','none');
$this->assertEquals("",$first_entry->getAbbrv()); $this->assertEquals("",$first_entry->getAbbrv());
// resetting the default link style
bibtexbrowser_configure('BIBTEXBROWSER_LINK_STYLE','bib2links_default');
} }
function testMultiSearch() { function testMultiSearch() {
@@ -393,14 +402,15 @@ class BTBTest extends PHPUnit_Framework_TestCase {
function test_PagedDisplay() { function test_PagedDisplay() {
$PAGE_SIZE = 3; $PAGE_SIZE = 4;
bibtexbrowser_configure('BIBTEXBROWSER_DEFAULT_DISPLAY', 'PagedDisplay'); bibtexbrowser_configure('BIBTEXBROWSER_DEFAULT_DISPLAY', 'PagedDisplay');
bibtexbrowser_configure('PAGE_SIZE', $PAGE_SIZE); bibtexbrowser_configure('PAGE_SIZE', $PAGE_SIZE);
$_GET['bib'] = 'bibacid-utf8.bib'; $db = new BibDataBase();
$_GET['all'] = 1; $db->load('bibacid-utf8.bib');
$d = new Dispatcher(); $d = new PagedDisplay();
$d->setEntries($db->bibdb);
ob_start(); ob_start();
$d->main(); $d->display();
$content = "<div>".ob_get_clean()."</div>"; $content = "<div>".ob_get_clean()."</div>";
$xml = new SimpleXMLElement($content); $xml = new SimpleXMLElement($content);
$result = $xml->xpath('//td[@class=\'bibref\']'); $result = $xml->xpath('//td[@class=\'bibref\']');