Browse Source

Loosen test assertion as the specs do not guarantee the key order

Marc Würth 7 years ago
parent
commit
907ba797bd
1 changed files with 8 additions and 1 deletions
  1. 8 1
      tests/TestCase/Cache/SimpleCacheEngineTest.php

+ 8 - 1
tests/TestCase/Cache/SimpleCacheEngineTest.php

@@ -275,6 +275,9 @@ class SimpleCacheEngineTest extends TestCase
     /**
     /**
      * Test setMultiple
      * Test setMultiple
      *
      *
+     * We should not assert for array equality, as the PSR-16 specs
+     * do not make any guarantees on key order.
+     *
      * @return void
      * @return void
      * @covers ::setMultiple
      * @covers ::setMultiple
      */
      */
@@ -284,10 +287,14 @@ class SimpleCacheEngineTest extends TestCase
             'key' => 'a value',
             'key' => 'a value',
             'key2' => 'other value',
             'key2' => 'other value',
         ];
         ];
+        $expected = [
+            'key2' => 'other value',
+            'key' => 'a value',
+        ];
         $this->cache->setMultiple($data);
         $this->cache->setMultiple($data);
 
 
         $results = $this->cache->getMultiple(array_keys($data));
         $results = $this->cache->getMultiple(array_keys($data));
-        $this->assertSame($data, $results);
+        $this->assertEquals($expected, $results);
     }
     }
 
 
     /**
     /**