From 0c4e65ffc039b13484ad76d966f1fcaed02db9d7 Mon Sep 17 00:00:00 2001 From: Martin Monperrus Date: Sun, 15 Dec 2019 16:47:49 +0100 Subject: [PATCH] fix tests in CI --- .travis.yml | 5 ++--- bibtexbrowser-test.php | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9a08353..959cd26 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,7 @@ services: - mysql php: - - '5.6' - - '7.0' - - '7.1' + - '7.2' script: - curl -L -o reflectivedoc.php https://www.monperrus.net/martin/reflectivedoc.php.txt @@ -33,6 +31,7 @@ script: # there is no need to create a post, because one activation task of wp-publications is to create a fake post #- $WPCLI post create --post_title=test --post_content='[wp-publications bib="sample.bib" all=true]' - cp bibtexbrowser.php ./wp-content/plugins/wp-publications/ + - echo "" > ./wp-content/plugins/wp-publications/bibtexbrowser.local.php - $WPCLI rest post list --slug=wp-publications-example --field=content | tee before.txt # do we still have the reference output? (useful for detecting changes in Wordpress or WP-CLI) (diff exits with 1 if there is a difference) - diff reference-output-wp-publications.txt before.txt diff --git a/bibtexbrowser-test.php b/bibtexbrowser-test.php index 4484dbb..d8cc0d1 100755 --- a/bibtexbrowser-test.php +++ b/bibtexbrowser-test.php @@ -61,7 +61,7 @@ class SimpleDisplayExt extends SimpleDisplay { class BTBTest extends PHPUnit_Framework_TestCase { - protected function setUp() + public function setUp():void { // resetting the default link style bibtexbrowser_configure('BIBTEXBROWSER_LINK_STYLE','bib2links_default'); @@ -202,7 +202,7 @@ class BTBTest extends PHPUnit_Framework_TestCase { $this->assertFalse(config_value('BIBTEXBROWSER_NO_DEFAULT')); ob_start(); default_message(); - $this->assertContains('Congratulations', ob_get_clean()); + $this->assertStringContainsString('Congratulations', ob_get_clean()); } @@ -219,7 +219,7 @@ class BTBTest extends PHPUnit_Framework_TestCase { ob_start(); $d->display(); $data = ob_get_clean(); - $this->assertContains('Livres', $data); + $this->assertStringContainsString('Livres', $data); } @@ -229,7 +229,7 @@ class BTBTest extends PHPUnit_Framework_TestCase { $results=$btb->multisearch($q); $this->assertTrue(count($results) == 1); $entry = $results[0]; - $this->assertContains("aKey-withSlash",$entry->toHTML()); + $this->assertStringContainsString("aKey-withSlash",$entry->toHTML()); $q=array(Q_KEY=>'aKey-withSlash'); $results=$btb->multisearch($q); @@ -743,7 +743,7 @@ class BTBTest extends PHPUnit_Framework_TestCase { $db = new BibDataBase(); $db->update_internal("inline", $test_data); $entry=$db->getEntryByKey("key"); - $this->assertContains('[citations]', $entry->toHTML()); + $this->assertStringContainsString('[citations]', $entry->toHTML()); }