HEX
Server: Apache
System: Linux srv13.cpanelhost.cl 3.10.0-962.3.2.lve1.5.38.el7.x86_64 #1 SMP Thu Jun 18 05:28:41 EDT 2020 x86_64
User: cca63905 (4205)
PHP: 7.3.20
Disabled: NONE
Upload Files
File: //proc/self/cwd/nueva/modules/ps_mbo/vendor/prestashop/circuit-breaker/tests/Util/AssertTest.php
<?php

namespace Tests\PrestaShop\CircuitBreaker\Util;

use PHPUnit\Framework\TestCase;
use PrestaShop\CircuitBreaker\Util\Assert;
use stdClass;

class AssertTest extends TestCase
{
    /**
     * @dataProvider getValues
     *
     * @param mixed $value
     * @param bool $expected
     */
    public function testIsPositiveValue($value, $expected)
    {
        $this->assertSame($expected, Assert::isPositiveValue($value));
    }

    /**
     * @dataProvider getURIs
     *
     * @param mixed $value
     * @param bool $expected
     */
    public function testIsURI($value, $expected)
    {
        $this->assertSame($expected, Assert::isURI($value));
    }

    /**
     * @dataProvider getStrings
     *
     * @param mixed $value
     * @param bool $expected
     */
    public function testIsString($value, $expected)
    {
        $this->assertSame($expected, Assert::isString($value));
    }

    /**
     * @return array
     */
    public function getValues()
    {
        return [
            '0' => [0, true],
            'str_0' => ['0', false],
            'float' => [0.1, true],
            'stdclass' => [new stdClass(), false],
            'callable' => [
                function () {
                    return 0;
                },
                false,
            ],
            'negative' => [-1, false],
            'bool' => [false, false],
        ];
    }

    /**
     * @return array
     */
    public function getURIs()
    {
        return [
            'valid' => ['http://www.prestashop.com', true],
            'int' => [0, false],
            'null' => [null, false],
            'bool' => [false, false],
            'local' => ['http://localhost', true],
            'ssh' => ['ssh://git@git.example.com/FOO/my_project.git', true],
        ];
    }

    public function getStrings()
    {
        return [
            'valid' => ['foo', true],
            'empty' => ['', false],
            'null' => [null, false],
            'bool' => [false, false],
            'stdclass' => [new stdClass(), false],
            'valid2' => ['INVALID_STATE', true],
        ];
    }
}