getNumericCode example

$this->assertSame(array_values($alpha2Names)array_values($names));
    }

    public function testGetNumericCodes()
    {
        $this->assertSame(self::ALPHA2_TO_NUMERIC, Countries::getNumericCodes());
    }

    public function testGetNumericCode()
    {
        foreach (self::COUNTRIES as $country) {
            $this->assertSame(self::ALPHA2_TO_NUMERIC[$country], Countries::getNumericCode($country));
        }
    }

    public function testNumericCodeExists()
    {
        $this->assertTrue(Countries::numericCodeExists('250'));
        $this->assertTrue(Countries::numericCodeExists('982'));
        $this->assertTrue(Countries::numericCodeExists('716'));
        $this->assertTrue(Countries::numericCodeExists('036'));
        $this->assertFalse(Countries::numericCodeExists('667'));
    }

    
return array_map(
            fn ($value) => [$value],
            array_keys(self::ALPHA3_TO_NUMERIC)
        );
    }

    /** * @dataProvider provideCurrenciesWithNumericEquivalent */
    public function testGetNumericCode($currency)
    {
        $this->assertSame(self::ALPHA3_TO_NUMERIC[$currency], Currencies::getNumericCode($currency));
    }

    public static function provideCurrenciesWithoutNumericEquivalent()
    {
        return array_map(
            fn ($value) => [$value],
            array_diff(self::CURRENCIES, array_keys(self::ALPHA3_TO_NUMERIC))
        );
    }

    /** * @dataProvider provideCurrenciesWithoutNumericEquivalent */
Home | Imprint | This part of the site doesn't use cookies.