diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-07-27 10:05:23 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-07-27 10:05:23 +0200 |
| commit | 5bf66662a9bdd62c5bccab15e607cd95cfb8fcab (patch) | |
| tree | 39a1a4629749056191c05dfd899f931701b7acf3 /srcs/phpmyadmin/vendor/dasprid/enum/test | |
| parent | 5afd237bbd22028b85532b8c0b3fcead49a00764 (diff) | |
| download | ft_server-master.tar.gz ft_server-master.tar.bz2 ft_server-master.zip | |
Removed wordpress and phpmyadmin, my server doesn't handle it well and it brings shame on my famillyHEADmaster
Diffstat (limited to 'srcs/phpmyadmin/vendor/dasprid/enum/test')
5 files changed, 0 insertions, 494 deletions
diff --git a/srcs/phpmyadmin/vendor/dasprid/enum/test/AbstractEnumTest.php b/srcs/phpmyadmin/vendor/dasprid/enum/test/AbstractEnumTest.php deleted file mode 100644 index ddba7d3..0000000 --- a/srcs/phpmyadmin/vendor/dasprid/enum/test/AbstractEnumTest.php +++ /dev/null @@ -1,121 +0,0 @@ -<?php -declare(strict_types = 1); - -namespace DASPRiD\EnumTest; - -use DASPRiD\Enum\AbstractEnum; -use DASPRiD\Enum\Exception\CloneNotSupportedException; -use DASPRiD\Enum\Exception\IllegalArgumentException; -use DASPRiD\Enum\Exception\MismatchException; -use DASPRiD\Enum\Exception\SerializeNotSupportedException; -use DASPRiD\Enum\Exception\UnserializeNotSupportedException; -use PHPUnit\Framework\TestCase; -use ReflectionClass; - -final class AbstractEnumTest extends TestCase -{ - public function setUp() - { - $reflectionClass = new ReflectionClass(AbstractEnum::class); - - $constantsProperty = $reflectionClass->getProperty('constants'); - $constantsProperty->setAccessible(true); - $constantsProperty->setValue([]); - - $valuesProperty = $reflectionClass->getProperty('values'); - $valuesProperty->setAccessible(true); - $valuesProperty->setValue([]); - - $allValuesLoadedProperty = $reflectionClass->getProperty('allValuesLoaded'); - $allValuesLoadedProperty->setAccessible(true); - $allValuesLoadedProperty->setValue([]); - } - - public function testToString() : void - { - $weekday = WeekDay::FRIDAY(); - self::assertSame('FRIDAY', (string) $weekday); - } - - public function testName() : void - { - $this->assertSame('WEDNESDAY', WeekDay::WEDNESDAY()->name()); - } - - public function testOrdinal() : void - { - $this->assertSame(2, WeekDay::WEDNESDAY()->ordinal()); - } - - public function testSameInstanceIsReturned() : void - { - self::assertSame(WeekDay::FRIDAY(), WeekDay::FRIDAY()); - } - - public static function testValueOf() : void - { - self::assertSame(WeekDay::FRIDAY(), WeekDay::valueOf('FRIDAY')); - } - - public function testValueOfInvalidConstant() : void - { - $this->expectException(IllegalArgumentException::class); - WeekDay::valueOf('CATURDAY'); - } - - public function testExceptionOnCloneAttempt() : void - { - $this->expectException(CloneNotSupportedException::class); - clone WeekDay::FRIDAY(); - } - - public function testExceptionOnSerializeAttempt() : void - { - $this->expectException(SerializeNotSupportedException::class); - serialize(WeekDay::FRIDAY()); - } - - public function testExceptionOnUnserializeAttempt() : void - { - $this->expectException(UnserializeNotSupportedException::class); - unserialize('O:24:"DASPRiD\\EnumTest\\WeekDay":0:{}'); - } - - public function testReturnValueOfValuesIsSortedByOrdinal() : void - { - // Initialize some week days out of order - WeekDay::SATURDAY(); - WeekDay::TUESDAY(); - - $ordinals = array_values(array_map(function (WeekDay $weekDay) : int { - return $weekDay->ordinal(); - }, WeekDay::values())); - - self::assertSame([0, 1, 2, 3, 4, 5, 6], $ordinals); - - $cachedOrdinals = array_values(array_map(function (WeekDay $weekDay) : int { - return $weekDay->ordinal(); - }, WeekDay::values())); - $this->assertSame($ordinals, $cachedOrdinals); - } - - public function testCompareTo() : void - { - $this->assertSame(-4, WeekDay::WEDNESDAY()->compareTo(WeekDay::SUNDAY())); - $this->assertSame(4, WeekDay::SUNDAY()->compareTo(WeekDay::WEDNESDAY())); - $this->assertSame(0, WeekDay::WEDNESDAY()->compareTo(WeekDay::WEDNESDAY())); - } - - public function testCompareToWrongEnum() : void - { - $this->expectException(MismatchException::class); - WeekDay::MONDAY()->compareTo(Planet::EARTH()); - } - - public function testParameterizedEnum() : void - { - $planet = Planet::EARTH(); - $this->assertSame(5.976e+24, $planet->mass()); - $this->assertSame(6.37814e6, $planet->radius()); - } -} diff --git a/srcs/phpmyadmin/vendor/dasprid/enum/test/EnumMapTest.php b/srcs/phpmyadmin/vendor/dasprid/enum/test/EnumMapTest.php deleted file mode 100644 index d51a86c..0000000 --- a/srcs/phpmyadmin/vendor/dasprid/enum/test/EnumMapTest.php +++ /dev/null @@ -1,243 +0,0 @@ -<?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', null, false], - ['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, $value, bool $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, $value, bool $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([1 => 'bar', 4 => 'foo', 6 => null], $result); - } -} diff --git a/srcs/phpmyadmin/vendor/dasprid/enum/test/NullValueTest.php b/srcs/phpmyadmin/vendor/dasprid/enum/test/NullValueTest.php deleted file mode 100644 index 9f70640..0000000 --- a/srcs/phpmyadmin/vendor/dasprid/enum/test/NullValueTest.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php -declare(strict_types = 1); - -namespace DASPRiD\EnumTest; - -use DASPRiD\Enum\Exception\CloneNotSupportedException; -use DASPRiD\Enum\Exception\SerializeNotSupportedException; -use DASPRiD\Enum\Exception\UnserializeNotSupportedException; -use DASPRiD\Enum\NullValue; -use PHPUnit\Framework\TestCase; - -final class NullValueTest extends TestCase -{ - public function testExceptionOnCloneAttempt() : void - { - $this->expectException(CloneNotSupportedException::class); - clone NullValue::instance(); - } - - public function testExceptionOnSerializeAttempt() : void - { - $this->expectException(SerializeNotSupportedException::class); - serialize(NullValue::instance()); - } - - public function testExceptionOnUnserializeAttempt() : void - { - $this->expectException(UnserializeNotSupportedException::class); - unserialize('O:22:"DASPRiD\\Enum\\NullValue":0:{}'); - } -} diff --git a/srcs/phpmyadmin/vendor/dasprid/enum/test/Planet.php b/srcs/phpmyadmin/vendor/dasprid/enum/test/Planet.php deleted file mode 100644 index 3c44c1d..0000000 --- a/srcs/phpmyadmin/vendor/dasprid/enum/test/Planet.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php -declare(strict_types = 1); - -namespace DASPRiD\EnumTest; - -use DASPRiD\Enum\AbstractEnum; - -/** - * @method static self MERCURY() - * @method static self VENUS() - * @method static self EARTH() - * @method static self MARS() - * @method static self JUPITER() - * @method static self SATURN() - * @method static self URANUS() - * @method static self NEPTUNE() - */ -final class Planet extends AbstractEnum -{ - protected const MERCURY = [3.303e+23, 2.4397e6]; - protected const VENUS = [4.869e+24, 6.0518e6]; - protected const EARTH = [5.976e+24, 6.37814e6]; - protected const MARS = [6.421e+23, 3.3972e6]; - protected const JUPITER = [1.9e+27, 7.1492e7]; - protected const SATURN = [5.688e+26, 6.0268e7]; - protected const URANUS = [8.686e+25, 2.5559e7]; - protected const NEPTUNE = [1.024e+26, 2.4746e7]; - - /** - * Universal gravitational constant. - */ - private const G = 6.67300E-11; - - /** - * Mass in kilograms. - * - * @var float - */ - private $mass; - - /** - * Radius in meters. - * - * @var float - */ - private $radius; - - protected function __construct(float $mass, float $radius) - { - $this->mass = $mass; - $this->radius = $radius; - } - - public function mass() : float - { - return $this->mass; - } - - public function radius() : float - { - return $this->radius; - } - - public function surfaceGravity() : float - { - return self::G * $this->mass / ($this->radius * $this->radius); - } - - public function surfaceWeight(float $otherMass) : float - { - return $otherMass * $this->surfaceGravity(); - } -} diff --git a/srcs/phpmyadmin/vendor/dasprid/enum/test/WeekDay.php b/srcs/phpmyadmin/vendor/dasprid/enum/test/WeekDay.php deleted file mode 100644 index 70b8db5..0000000 --- a/srcs/phpmyadmin/vendor/dasprid/enum/test/WeekDay.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -declare(strict_types = 1); - -namespace DASPRiD\EnumTest; - -use DASPRiD\Enum\AbstractEnum; - -/** - * @method static self MONDAY() - * @method static self TUESDAY() - * @method static self WEDNESDAY() - * @method static self THURSDAY() - * @method static self FRIDAY() - * @method static self SATURDAY() - * @method static self SUNDAY() - */ -final class WeekDay extends AbstractEnum -{ - protected const MONDAY = null; - protected const TUESDAY = null; - protected const WEDNESDAY = null; - protected const THURSDAY = null; - protected const FRIDAY = null; - protected const SATURDAY = null; - protected const SUNDAY = null; -} |
