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

Improved tests (added coverage for external export redirect).

parent 274824ab
No related merge requests found
...@@ -128,17 +128,14 @@ class CartTest extends \VuFindTest\Unit\MinkTestCase ...@@ -128,17 +128,14 @@ class CartTest extends \VuFindTest\Unit\MinkTestCase
* *
* @return Element * @return Element
*/ */
protected function setUpGenericCartTest() protected function setUpGenericCartTest($extraConfigs = [])
{ {
// Activate the cart: // Activate the cart:
$this->changeConfigs( $extraConfigs['config']['Site']
['config' => = ['showBookBag' => true, 'theme' => 'bootprint3'];
[ $extraConfigs['config']['Mail']
'Site' => ['showBookBag' => true, 'theme' => 'bootprint3'], = ['testOnly' => 1];
'Mail' => ['testOnly' => 1], $this->changeConfigs($extraConfigs);
],
]
);
$page = $this->getSearchResultsPage(); $page = $this->getSearchResultsPage();
...@@ -383,10 +380,53 @@ class CartTest extends \VuFindTest\Unit\MinkTestCase ...@@ -383,10 +380,53 @@ class CartTest extends \VuFindTest\Unit\MinkTestCase
// Do the export: // Do the export:
$submit = $this->findCss($page, '.modal-body input[name=submit]'); $submit = $this->findCss($page, '.modal-body input[name=submit]');
$submit->click(); $submit->click();
$this->snooze();
$result = $this->findCss($page, '.modal-body .alert .text-center .btn'); $result = $this->findCss($page, '.modal-body .alert .text-center .btn');
$this->assertEquals('Download File', $result->getText()); $this->assertEquals('Download File', $result->getText());
} }
/**
* Test that the export control works when redirecting to a third-party site.
*
* @return void
*/
public function testCartExportToThirdParty()
{
$page = $this->setUpGenericCartTest(
[
'config' => [
'Export' => [
'Google' => 'record,bulk',
],
],
'export' => [
'Google' => [
'requiredMethods[]' => 'getTitle',
'redirectUrl' => 'https://www.google.com',
'headers[]' => 'Content-type: text/plain; charset=utf-8',
],
],
]
);
$button = $this->findCss($page, '.cart-controls button[name=export]');
// Go to export option list:
$this->selectAllItemsInCart($page);
$button->click();
// Select EndNote option
$select = $this->findCss($page, '#format');
$select->selectOption('Google');
// Do the export:
$submit = $this->findCss($page, '.modal-body input[name=submit]');
$submit->click();
$this->snooze();
$this->assertEquals(
'https://www.google.com/', $this->getMinkSession()->getCurrentUrl()
);
}
/** /**
* Test that the print control works. * Test that the print control works.
* *
......
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