From 1f0b3b598897f393860d76f7f02900b7e8d62883 Mon Sep 17 00:00:00 2001 From: Piotr M Date: Thu, 30 Mar 2017 14:28:13 +0200 Subject: [PATCH] Fix GlobalStoragesServiceTest comparing arrays --- .../Service/GlobalStoragesServiceTest.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/lib/Files/External/Service/GlobalStoragesServiceTest.php b/tests/lib/Files/External/Service/GlobalStoragesServiceTest.php index 5067257167..a3ee761628 100644 --- a/tests/lib/Files/External/Service/GlobalStoragesServiceTest.php +++ b/tests/lib/Files/External/Service/GlobalStoragesServiceTest.php @@ -129,6 +129,14 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { ]; } + private function assertEqualsArrays($expected, $actual) { + sort($expected); + sort($actual); + + $this->assertEquals($expected, $actual); + } + + /** * @dataProvider storageDataProvider */ @@ -143,9 +151,9 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { $this->assertEquals($storage->getMountPoint(), $newStorage->getMountPoint()); $this->assertEquals($storage->getBackend(), $newStorage->getBackend()); $this->assertEquals($storage->getAuthMechanism(), $newStorage->getAuthMechanism()); - $this->assertEquals($storage->getBackendOptions(), $newStorage->getBackendOptions()); - $this->assertEquals($storage->getApplicableUsers(), $newStorage->getApplicableUsers()); - $this->assertEquals($storage->getApplicableGroups(), $newStorage->getApplicableGroups()); + $this->assertEqualsArrays($storage->getBackendOptions(), $newStorage->getBackendOptions()); + $this->assertEqualsArrays($storage->getApplicableUsers(), $newStorage->getApplicableUsers()); + $this->assertEqualsArrays($storage->getApplicableGroups(), $newStorage->getApplicableGroups()); $this->assertEquals($storage->getPriority(), $newStorage->getPriority()); $this->assertEquals(0, $newStorage->getStatus()); @@ -182,8 +190,8 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { $this->assertEquals($updatedStorage->getMountPoint(), $newStorage->getMountPoint()); $this->assertEquals($updatedStorage->getBackendOptions()['password'], $newStorage->getBackendOptions()['password']); - $this->assertEquals($updatedStorage->getApplicableUsers(), $newStorage->getApplicableUsers()); - $this->assertEquals($updatedStorage->getApplicableGroups(), $newStorage->getApplicableGroups()); + $this->assertEqualsArrays($updatedStorage->getApplicableUsers(), $newStorage->getApplicableUsers()); + $this->assertEqualsArrays($updatedStorage->getApplicableGroups(), $newStorage->getApplicableGroups()); $this->assertEquals($updatedStorage->getPriority(), $newStorage->getPriority()); $this->assertEquals(0, $newStorage->getStatus()); } -- GitLab