From c03960fff23a688fb13d1950512bd563dd73006b Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Tue, 20 Oct 2015 08:46:25 -0400
Subject: [PATCH] Added print test.

---
 .../src/VuFindTest/Mink/CartTest.php          | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/CartTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/CartTest.php
index 927e1a070bb..fe8efc8e19c 100644
--- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/CartTest.php
+++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/CartTest.php
@@ -200,6 +200,8 @@ class CartTest extends \VuFindTest\Unit\MinkTestCase
      * Select all of the items currently in the cart lightbox.
      *
      * @param Element $page Page element
+     *
+     * @return void
      */
     protected function selectAllItemsInCart(Element $page)
     {
@@ -365,4 +367,31 @@ class CartTest extends \VuFindTest\Unit\MinkTestCase
 
         $session->stop();
     }
+
+    /**
+     * Test that the print control works.
+     *
+     * @return void
+     */
+    public function testCartPrint()
+    {
+        $session = $this->getMinkSession();
+        $session->start();
+        $page = $this->setUpGenericCartTest($session);
+        $button = $page->find('css', '.cart-controls button[name=print]');
+
+        // First try clicking without selecting anything:
+        $button->click();
+        $this->checkForNonSelectedMessage($page);
+
+        // Now do it for real -- we should get redirected.
+        $this->selectAllItemsInCart($page);
+        $button->click();
+        list(, $params) = explode('?', $session->getCurrentUrl());
+        $this->assertEquals(
+            'print=true&id[]=VuFind|testsample1&id[]=VuFind|testsample2', $params
+        );
+
+        $session->stop();
+    }
 }
-- 
GitLab