Skip to content
Snippets Groups Projects
Commit cf267184 authored by Demian Katz's avatar Demian Katz
Browse files

Added tests for jump-to-single-result feature.

parent 7cd34414
Branches
Tags
No related merge requests found
<?php
/**
* "Jump to record" test class.
*
* PHP version 7
*
* Copyright (C) Villanova University 2018.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category VuFind
* @package Tests
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org Main Page
*/
namespace VuFindTest\Mink;
/**
* "Jump to record" test class.
*
* @category VuFind
* @package Tests
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org Main Page
*/
class NextPrevNavTest extends \VuFindTest\Unit\MinkTestCase
{
/**
* Test that we can jump to the first record in a single-record result set.
*
* @return void
*/
public function testJumpToFirst()
{
$this->changeConfigs(
["config" => ["Record" => ["jump_to_single_search_result" => true]]]
);
$page = $this->performSearch('id:testbug2');
$this->assertEquals(
'La congiura dei Principi Napoletani 1701 : (prima e seconda stesura) /',
trim($this->findCss($page, 'h3')->getText())
);
}
/**
* Same as the previous test, but without switching on the jump setting; this
* should result in a result list.
*
* @return void
*/
public function testDoNotJumpToFirst()
{
$page = $this->performSearch('id:testbug2');
$expected = 'Showing 1 - 1 results of 1 for search \'id:testbug2\'';
$this->assertEquals(
$expected, substr(
$this->findCss($page, '.search-stats')->getText(), 0,
strlen($expected)
)
);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment