Browse Source

fix travis PHP7

pull/81/merge
Martin Monperrus 8 years ago
parent
commit
d14042b81b
  1. 2
      .travis.yml
  2. 48
      bibtexbrowser-test.php

2
.travis.yml

@ -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

48
bibtexbrowser-test.php

@ -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')) {
set_error_handler("exception_error_handler");
require('reflectivedoc.php');
$_GET['library'] = 1;
foreach(getAllSnippetsInFile('bibtexbrowser.php') as $snippet) {
//echo $snippet;
class Nothing {
function main() {}
}
define('BIBTEXBROWSER_MAIN','Nothing');
//require_once('bibtexbrowser.php');
set_error_handler("exception_error_handler");
require('reflectivedoc.php');
$nsnippet=0;
foreach(getAllSnippetsInFile('bibtexbrowser.php') as $snippet) {
ob_start(); ob_start();
eval($snippet); eval($snippet);
ob_get_clean(); ob_get_clean();
unset($_GET['bib']); unset($_GET['bib']);
}
restore_error_handler();
} else {
$_GET['library']=1;
require_once ('bibtexbrowser.php');
$nsnippet++;
} }
if ($nsnippet!=19) {
die('oops '.$nsnippet);
}
restore_error_handler();
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';
$_GET['all'] = 1;
$d = new Dispatcher();
$db = new BibDataBase();
$db->load('bibacid-utf8.bib');
$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\']');

Loading…
Cancel
Save