From 2668b189c561132d5a539117ba1e2a4825eb842c Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Tue, 20 Oct 2015 08:56:47 -0400 Subject: [PATCH] Began refactoring code to be more generic. --- .../src/VuFindTest/Mink/FavoritesTest.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/FavoritesTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/FavoritesTest.php index ad8df73042d..46ec58afed5 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/FavoritesTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/FavoritesTest.php @@ -372,20 +372,19 @@ class FavoritesTest extends \VuFindTest\Unit\MinkTestCase public static function tearDownAfterClass() { // If CI is not running, all tests were skipped, so no work is necessary: - $test = new FavoritesTest(); + $test = new static(); // create instance of current class if (!$test->continuousIntegrationRunning()) { return; } // Delete test user - $test = new FavoritesTest(); $userTable = $test->getTable('User'); - $user = $userTable->getByUsername(self::$hash, false); - $user2 = $userTable->getByUsername(self::$hash2, false); - if (empty($user) || empty($user2)) { - throw new \Exception('Problem deleting expected user.'); + foreach ([self::$hash, self::$hash2] as $username) { + $user = $userTable->getByUsername($username, false); + if (empty($user)) { + throw new \Exception('Problem deleting expected user.'); + } + $user->delete(); } - $user->delete(); - $user2->delete(); } } -- GitLab