/** * @dataProvider simpleArrayProvider */ public function testSortDescWithoutPreserveKeys(array $array) { $ma = new ImmutableArray($array); $copiedMa = $ma->sort(SORT_DESC, SORT_REGULAR, false); rsort($array, SORT_REGULAR); $this->assertTrue($copiedMa !== $ma); $this->assertTrue($array === $copiedMa->toArray()); }
/** * @dataProvider simpleArrayProvider * * @param array $array */ public function testSortDescWithPreserveKeys(array $array) { $arrayzy = new A($array); $resultArrayzy = $arrayzy->sort(SORT_DESC, SORT_REGULAR, true); $resultArray = $array; arsort($resultArray, SORT_REGULAR); $this->assertImmutable($arrayzy, $resultArrayzy, $array, $resultArray); }