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ގῇ`0Y
ozXZ:ta=ėю xi1[Zݟ	+~F0(>^T_3HL6Tڢ2+bX)j|N)5
DBn&=TJ{EvǚՇ"/^&YqAbD10ax#oZy\V\Dy,7}$&8"L`VxnLR)'OЉCKN$Â_kX(ćHM^+'bѽʛ췕~M {}v)-cv-}Bk7Џ{2f͐[۹|_Wwʶ"cNG`rº&vMb4A~=NM$lhO'-,$rDy?%8ńNP|I(Fu{^+t;ӟMI<L^NM$lhOkN7cHG)c=IƦrn1p%rdnwº:7.IO>63$*r.)Wa@O]%c<'	+T~ <Ѽm8+cmJ6SVE2*X*FB[=}N#8:BNջWȠN+JBE+B,bC7 et)瑼u#*_^y	9WokH[U50FRrVN᭠)k3/@Ȗm2jhk9͙,yJO^!VDKaӘ	S]O0' a2νU:/sr4²؟Xz|{e;颬$`J[E9?Un"}K/Pmrx#H1ҏٺ!ΖW<\=_~ͷ,2TR~LDsQa/4 pɖ~gBNM$lhOg8>U
XX&H_1q1=W<@;xG_Y;dnEBG`%&<h0;
MՊ]'Iݑ{MwpmzAqK)DJ5G朴`2Ә	S]O0e<kolϚuJADQoBP9750ӌki2H<ȷF$s`Ó@hl}Bdf?ˋdy5cUhRȰ8]=꺴췕~M {BԄsxha͐[۹|_WwEѺ}&ҕ.J	%]^k;R	3rpb*e~%8V& (&9-(6-z֬0cUL%,+U3M}Lgi,/ІioDgǋW-K=캡tWe !ؙUvc',M
5m?DWܚ^{l- "XU*d}ѩ3t}@ǚܷhx3UX@(~z(HOT+AR%aEfMre	ve`N(|(YVe^5Hk,w1Wp~j@!Sjˮpm$%,>j%%m{vS/7AX&߀wHɉmΦ03qG') 7Na7;Sy*Aw]6<.ix
y X6 HĒUXAA
vqyK8e&UmR|[؇a!3r>expects($this->at(1))
            ->method('evaluateVersionCondition')
            ->with('PHP', '<7.1')
            ->will($this->returnValue(true));

        $mockVersionInfo->expects($this->at(2))
            ->method('evaluateVersionCondition')
            ->with('MySQL', '>=5.5')
            ->will($this->returnValue(true));

        $compatible = $mockVersionInfo
            ->getLatestCompatibleVersion($this->_releases);
        $this->assertEquals('4.4.14.1', $compatible['version']);

    }

    /**
     * Tests getLatestCompatibleVersion() when there are multiple servers configured
     *
     * @return void
     */
    public function testGetLaestCompatibleVersionWithMultipleServers()
    {
        $GLOBALS['cfg']['Servers'] = array(
            array(),
            array()
        );

        $mockVersionInfo = $this->getMockBuilder('PMA\libraries\VersionInformation')
            ->setMethods(array('evaluateVersionCondition'))
            ->getMock();

        $mockVersionInfo->expects($this->at(0))
            ->method('evaluateVersionCondition')
            ->with('PHP', '>=5.3')
            ->will($this->returnValue(true));

        $mockVersionInfo->expects($this->at(1))
            ->method('evaluateVersionCondition')
            ->with('PHP', '<7.1')
            ->will($this->returnValue(true));

        $compatible = $mockVersionInfo
            ->getLatestCompatibleVersion($this->_releases);
        $this->assertEquals('4.4.14.1', $compatible['version']);
    }

    /**
     * Tests getLatestCompatibleVersion() with an old PHP version
     *
     * @return void
     */
    public function testGetLaestCompatibleVersionWithOldPHPVersion()
    {
        $GLOBALS['cfg']['Servers'] = array(
            array(),
            array()
        );

        $mockVersionInfo = $this->getMockBuilder('PMA\libraries\VersionInformation')
            ->setMethods(array('evaluateVersionCondition'))
            ->getMock();

        $mockVersionInfo->expects($this->at(0))
            ->method('evaluateVersionCondition')
            ->with('PHP', '>=5.3')
            ->will($this->returnValue(false));

        $mockVersionInfo->expects($this->at(1))
            ->method('evaluateVersionCondition')
            ->with('PHP', '>=5.3')
            ->will($this->returnValue(false));

        $mockVersionInfo->expects($this->at(2))
            ->method('evaluateVersionCondition')
            ->with('PHP', '>=5.2')
            ->will($this->returnValue(true));

        $mockVersionInfo->expects($this->at(3))
            ->method('evaluateVersionCondition')
            ->with('PHP', '<5.3')
            ->will($this->returnValue(true));

        $compatible = $mockVersionInfo
            ->getLatestCompatibleVersion($this->_releases);
        $this->assertEquals('4.0.10.10', $compatible['version']);
    }

    /**
     * Tests evaluateVersionCondition() method
     *
     * @return void
     */
    public function testEvaluateVersionCondition()
    {
        $mockVersionInfo = $this->getMockBuilder('PMA\libraries\VersionInformation')
            ->setMethods(array('getPHPVersion'))
            ->getMock();

        $mockVersionInfo->expects($this->any())
            ->method('getPHPVersion')
            ->will($this->returnValue('5.2.4'));

        $this->assertTrue($mockVersionInfo->evaluateVersionCondition('PHP', '<=5.3'));
        $this->assertTrue($mockVersionInfo->evaluateVersionCondition('PHP', '<5.3'));
        $this->assertTrue($mockVersionInfo->evaluateVersionCondition('PHP', '>=5.2'));
        $this->assertTrue($mockVersionInfo->evaluateVersionCondition('PHP', '>5.2'));
        $this->assertTrue($mockVersionInfo->evaluateVersionCondition('PHP', '!=5.3'));

        $this->assertFalse($mockVersionInfo->evaluateVersionCondition('PHP', '<=5.2'));
        $this->assertFalse($mockVersionInfo->evaluateVersionCondition('PHP', '<5.2'));
        $this->assertFalse($mockVersionInfo->evaluateVersionCondition('PHP', '>=7.0'));
        $this->assertFalse($mockVersionInfo->evaluateVersionCondition('PHP', '>7.0'));
        $this->assertTrue($mockVersionInfo->evaluateVersionCondition('PHP', '!=5.2'));
    }
}
