mirror of
https://github.com/predis/predis.git
synced 2026-08-23 18:53:24 +00:00
ac259bdb6f
* Add complete CI * Fix CI * Fix spelling * Fix indentation * Fix CI * Fix CI * Revert disabling unit tests * Add coverage driver to CI * Start coverage debugging * Fix debugging ignored, and an empty message aborts the commit. * Stop debugging * Move TODO-s from source to GitHub issues * Ignore too long lines in certain files * Revert requiring php-parallel-lint/php-parallel-lint * formatting * try shorter formatting * formatting * fix syntax * try two paths? * Update .editorconfig Co-authored-by: Viktor Szépe <viktor@szepe.net> * indentation * make it a group Co-authored-by: Till Krüss <tillkruss@users.noreply.github.com>
60 lines
1.1 KiB
PHP
60 lines
1.1 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Predis package.
|
|
*
|
|
* (c) 2009-2020 Daniele Alessandri
|
|
* (c) 2021-2023 Till Krüss
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
/**
|
|
* PHPUnit constraint matching arrays with same elements even in different order.
|
|
*/
|
|
class ArrayHasSameValuesConstraint extends \PHPUnit\Framework\Constraint\Constraint
|
|
{
|
|
protected $array;
|
|
|
|
/**
|
|
* @param array $array
|
|
*/
|
|
public function __construct(array $array)
|
|
{
|
|
$this->array = $array;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function matches($other): bool
|
|
{
|
|
if (count($this->array) !== count($other)) {
|
|
return false;
|
|
}
|
|
|
|
if (array_diff($this->array, $other)) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function toString(): string
|
|
{
|
|
return 'two arrays contain the same elements.';
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
protected function failureDescription($other): string
|
|
{
|
|
return $this->toString();
|
|
}
|
|
}
|