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

Simple save test.

parent b013d284
No related merge requests found
<?php
/**
* Mink search actions test class.
*
* PHP version 5
*
* Copyright (C) Villanova University 2011.
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @category VuFind2
* @package Tests
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://www.vufind.org Main Page
*/
namespace VuFindTest\Mink;
/**
* Mink search actions test class.
*
* @category VuFind2
* @package Tests
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://www.vufind.org Main Page
*/
class SearchActionsTest extends \VuFindTest\Unit\MinkTestCase
{
use \VuFindTest\Unit\UserCreationTrait;
/**
* Standard setup method.
*
* @return void
*/
public static function setUpBeforeClass()
{
return static::failIfUsersExist();
}
/**
* Standard setup method.
*
* @return void
*/
public function setUp()
{
// Give up if we're not running in CI:
if (!$this->continuousIntegrationRunning()) {
return $this->markTestSkipped('Continuous integration not running.');
}
}
/**
* Search for the specified query.
*
* @param string $query Search term(s)
*
* @return \Behat\Mink\Element\Element
*/
protected function performSearch($query)
{
$session = $this->getMinkSession();
$session->visit($this->getVuFindUrl() . '/Search/Home');
$page = $session->getPage();
$this->findCss($page, '.searchForm [name="lookfor"]')->setValue($query);
$this->findCss($page, '.btn.btn-primary')->click();
$this->snooze();
return $page;
}
/**
* Test saving and clearing a search.
*
* @return void
*/
public function testSaveSearch()
{
$page = $this->performSearch('test');
$this->findCss($page, '.fa.fa-save')->click();
$this->snooze();
$this->findCss($page, '.createAccountLink')->click();
$this->snooze();
$this->fillInAccountForm($page);
$this->findCss($page, 'input.btn.btn-primary')->click();
$this->snooze();
$this->assertEquals(
'Search saved successfully.',
$this->findCss($page, '.alert.alert-success')->getText()
);
}
/**
* Standard teardown method.
*
* @return void
*/
public static function tearDownAfterClass()
{
static::removeUsers(['username1']);
}
}
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