__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Tuf\Tests\TestHelpers;
/**
* General test utility helper trait.
*/
trait UtilsTrait
{
/**
* Helper methods for dataProvider methods to return keyed arrays.
*
* @param array $providedData
* The dataProvider data.
*
* @param integer|null $useArgumentNumber
* (optional) The argument to user the key.
*
* @return array
* The new keyed array where the keys are string concatenation of the
* arguments.
*/
protected static function getKeyedArray(array $providedData, int $useArgumentNumber = null): array
{
$newData = [];
foreach ($providedData as $arguments) {
$key = '';
if ($useArgumentNumber !== null) {
$key = (string) $arguments[$useArgumentNumber];
} else {
foreach ($arguments as $argument) {
if (is_numeric($argument) || is_string($argument)) {
$key .= '-' . (string) $argument;
}
}
}
if (isset($newData[$key])) {
throw new \RuntimeException("Cannot produce unique keys");
}
$newData[$key] = $arguments;
}
return $newData;
}
/**
* Change a nested array element.
*
* @param array $keys
* Ordered keys to the value to set.
* @param array $data
* The array to modify.
* @param mixed $newValue
* The new value to set.
*
* @return void
*/
protected static function nestedChange(array $keys, array &$data, $newValue): void
{
$key = array_shift($keys);
if ($keys) {
static::nestedChange($keys, $data[$key], $newValue);
} else {
$data[$key] = $newValue;
}
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| DurableStorage | Folder | 0775 |
|
|
| FixturesTrait.php | File | 3.54 KB | 0664 |
|
| TestClock.php | File | 577 B | 0664 |
|
| TestRepository.php | File | 894 B | 0664 |
|
| UtilsTrait.php | File | 1.8 KB | 0664 |
|