Browse Source

fix tests in CI

pull/100/head
Martin Monperrus 6 years ago
parent
commit
0c4e65ffc0
  1. 5
      .travis.yml
  2. 10
      bibtexbrowser-test.php

5
.travis.yml

@ -5,9 +5,7 @@ services:
- mysql - mysql
php: php:
- '5.6'
- '7.0'
- '7.1'
- '7.2'
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
@ -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 # 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]' #- $WPCLI post create --post_title=test --post_content='[wp-publications bib="sample.bib" all=true]'
- cp bibtexbrowser.php ./wp-content/plugins/wp-publications/ - cp bibtexbrowser.php ./wp-content/plugins/wp-publications/
- echo "<?php define('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT',false);?>" > ./wp-content/plugins/wp-publications/bibtexbrowser.local.php
- $WPCLI rest post list --slug=wp-publications-example --field=content | tee before.txt - $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) # 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 reference-output-wp-publications.txt before.txt

10
bibtexbrowser-test.php

@ -61,7 +61,7 @@ class SimpleDisplayExt extends SimpleDisplay {
class BTBTest extends PHPUnit_Framework_TestCase { class BTBTest extends PHPUnit_Framework_TestCase {
protected function setUp()
public function setUp():void
{ {
// resetting the default link style // resetting the default link style
bibtexbrowser_configure('BIBTEXBROWSER_LINK_STYLE','bib2links_default'); bibtexbrowser_configure('BIBTEXBROWSER_LINK_STYLE','bib2links_default');
@ -202,7 +202,7 @@ class BTBTest extends PHPUnit_Framework_TestCase {
$this->assertFalse(config_value('BIBTEXBROWSER_NO_DEFAULT')); $this->assertFalse(config_value('BIBTEXBROWSER_NO_DEFAULT'));
ob_start(); ob_start();
default_message(); 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(); ob_start();
$d->display(); $d->display();
$data = ob_get_clean(); $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); $results=$btb->multisearch($q);
$this->assertTrue(count($results) == 1); $this->assertTrue(count($results) == 1);
$entry = $results[0]; $entry = $results[0];
$this->assertContains("aKey-withSlash",$entry->toHTML());
$this->assertStringContainsString("aKey-withSlash",$entry->toHTML());
$q=array(Q_KEY=>'aKey-withSlash'); $q=array(Q_KEY=>'aKey-withSlash');
$results=$btb->multisearch($q); $results=$btb->multisearch($q);
@ -743,7 +743,7 @@ class BTBTest extends PHPUnit_Framework_TestCase {
$db = new BibDataBase(); $db = new BibDataBase();
$db->update_internal("inline", $test_data); $db->update_internal("inline", $test_data);
$entry=$db->getEntryByKey("key"); $entry=$db->getEntryByKey("key");
$this->assertContains('<a href="https://scholar.google.com/scholar?cites=1234">[citations]</a>', $entry->toHTML());
$this->assertStringContainsString('<a href="https://scholar.google.com/scholar?cites=1234">[citations]</a>', $entry->toHTML());
} }

Loading…
Cancel
Save