mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-16 20:08:41 +00:00
fix unit tests
This commit is contained in:
parent
3fc7c0c233
commit
f5ad4345bb
|
|
@ -276,7 +276,7 @@ final class MultiMap implements \Countable
|
|||
$permutation = Permutation::permut($key, [], false);
|
||||
|
||||
foreach ($permutation as $permut) {
|
||||
if ($this->set(\implode(':', $permut), $value)) {
|
||||
if ($this->setSingle(\implode(':', $permut), $value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -284,7 +284,7 @@ final class MultiMap implements \Countable
|
|||
return false;
|
||||
}
|
||||
|
||||
return $this->set(\implode(':', $key), $value);
|
||||
return $this->setSingle(\implode(':', $key), $value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -340,7 +340,7 @@ final class MultiMap implements \Countable
|
|||
$key = \is_array($key) ? $key : [$key];
|
||||
|
||||
if ($this->orderType !== OrderType::LOOSE) {
|
||||
return $this->remove(\implode(':', $key));
|
||||
return $this->removeSingle(\implode(':', $key));
|
||||
}
|
||||
|
||||
/** @var array $keys */
|
||||
|
|
@ -348,7 +348,7 @@ final class MultiMap implements \Countable
|
|||
$found = false;
|
||||
|
||||
foreach ($keys as $key => $value) {
|
||||
$allFound = $this->remove(\implode(':', $value));
|
||||
$allFound = $this->removeSingle(\implode(':', $value));
|
||||
|
||||
if ($allFound) {
|
||||
$found = true;
|
||||
|
|
@ -505,14 +505,15 @@ final class MultiMap implements \Countable
|
|||
private function getSiblingsSingle(int|string $key) : array
|
||||
{
|
||||
$siblings = [];
|
||||
if (!isset($this->keys[$key])) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (isset($this->keys[$key])) {
|
||||
$id = $this->keys[$key];
|
||||
$id = $this->keys[$key];
|
||||
|
||||
foreach ($this->keys as $found => $value) {
|
||||
if ($value === $id && $found !== $key) {
|
||||
$siblings[] = $found;
|
||||
}
|
||||
foreach ($this->keys as $found => $value) {
|
||||
if ($value === $id && $found !== $key) {
|
||||
$siblings[] = $found;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -651,7 +651,7 @@ class MultiMapTest extends \PHPUnit\Framework\TestCase
|
|||
$map = new MultiMap(KeyType::MULTIPLE);
|
||||
|
||||
$map->add(['a', 'b'], 'val2');
|
||||
$remap = $map->remap(['a', 'b'], ['c', 'd']);
|
||||
$remap = $map->remap('a', 'b');
|
||||
|
||||
self::assertFalse($remap);
|
||||
}
|
||||
|
|
@ -716,7 +716,7 @@ class MultiMapTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertFalse($removed);
|
||||
|
||||
$removed = $map->remove(['a', 'b']);
|
||||
self::assertFalse($map->removeKey(['a', 'b']));
|
||||
self::assertFalse($map->removeKey('a'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -753,6 +753,6 @@ class MultiMapTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertFalse($removed);
|
||||
|
||||
$removed = $map->remove(['a', 'b']);
|
||||
self::assertFalse($map->removeKey(['a', 'b']));
|
||||
self::assertFalse($map->removeKey('a'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -665,8 +665,9 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
public function testNodeNext() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir->next();
|
||||
|
||||
self::assertEquals(__DIR__ . '/dirtest/test.txt', $dir->next()->getPath());
|
||||
self::assertEquals(__DIR__ . '/dirtest/test.txt', $dir->current()->getPath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -689,6 +690,7 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
|
||||
self::assertEquals('sub', $dir->key());
|
||||
|
||||
$dir->next();
|
||||
self::assertEquals('test.txt', $dir->key());
|
||||
}
|
||||
|
|
@ -813,8 +815,9 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
public function testDirname() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir->next();
|
||||
|
||||
self::assertEquals('dirtest', $dir->next()->getDirname());
|
||||
self::assertEquals('dirtest', $dir->current()->getDirname());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -824,8 +827,9 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
public function testName() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir->next();
|
||||
|
||||
self::assertEquals('test', $dir->next()->getName());
|
||||
self::assertEquals('test', $dir->current()->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -835,8 +839,9 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
public function testBaseame() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir->next();
|
||||
|
||||
self::assertEquals('test.txt', $dir->next()->getBasename());
|
||||
self::assertEquals('test.txt', $dir->current()->getBasename());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -846,7 +851,8 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
public function testDirpath() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir->next();
|
||||
|
||||
self::assertEquals(__DIR__ . '/dirtest', $dir->next()->getDirPath());
|
||||
self::assertEquals(__DIR__ . '/dirtest', $dir->current()->getDirPath());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -634,8 +634,9 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
public function testNodeNext() : void
|
||||
{
|
||||
$dir = new Directory(__DIR__ . '/dirtest');
|
||||
$dir->next();
|
||||
|
||||
self::assertEquals(__DIR__ . '/dirtest/test.txt', $dir->next()->getPath());
|
||||
self::assertEquals(__DIR__ . '/dirtest/test.txt', $dir->current()->getPath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -658,6 +659,7 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
$dir = new Directory(__DIR__ . '/dirtest');
|
||||
|
||||
self::assertEquals('sub', $dir->key());
|
||||
|
||||
$dir->next();
|
||||
self::assertEquals('test.txt', $dir->key());
|
||||
}
|
||||
|
|
@ -780,8 +782,9 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
public function testDirname() : void
|
||||
{
|
||||
$dir = new Directory(__DIR__ . '/dirtest');
|
||||
$dir->next();
|
||||
|
||||
self::assertEquals('dirtest', $dir->next()->getDirName());
|
||||
self::assertEquals('dirtest', $dir->current()->getDirName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -791,8 +794,9 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
public function testName() : void
|
||||
{
|
||||
$dir = new Directory(__DIR__ . '/dirtest');
|
||||
$dir->next();
|
||||
|
||||
self::assertEquals('test', $dir->next()->getName());
|
||||
self::assertEquals('test', $dir->current()->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -802,8 +806,9 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
public function testBaseame() : void
|
||||
{
|
||||
$dir = new Directory(__DIR__ . '/dirtest');
|
||||
$dir->next();
|
||||
|
||||
self::assertEquals('test.txt', $dir->next()->getBasename());
|
||||
self::assertEquals('test.txt', $dir->current()->getBasename());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -813,7 +818,8 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
public function testDirpath() : void
|
||||
{
|
||||
$dir = new Directory(__DIR__ . '/dirtest');
|
||||
$dir->next();
|
||||
|
||||
self::assertEquals(__DIR__ . '/dirtest', $dir->next()->getDirPath());
|
||||
self::assertEquals(__DIR__ . '/dirtest', $dir->current()->getDirPath());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user