#/** * @package Akismet */ /* Plugin Name: Akismet Anti-spam: Spam Protection Plugin URI: https://akismet.com/ Description: Used by millions, Akismet is quite possibly the best way in the world to protect your blog from spam. Akismet Anti-spam keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key. Version: 5.4 Requires at least: 5.8 Requires PHP: 7.2 Author: Automattic - Anti-spam Team Author URI: https://automattic.com/wordpress-plugins/ License: GPLv2 or later Text Domain: akismet */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Copyright 2005-2025 Automattic, Inc. */ // Make sure we don't expose any info if called directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 62.109.13.187 / Your IP : 216.73.216.11 [ Web Server : Apache/2.4.6 (CentOS) mpm-itk/2.4.7-04 OpenSSL/1.0.2k-fips PHP/8.2.28 System : Linux robothost.ru 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : mosrembit ( 6064) PHP Version : 8.2.28 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/phpMyAdmin/test/classes/ |
Upload File : |
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Tests for methods in VersionInformation class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/Util.class.php';
/*
* Include to test.
*/
require_once 'libraries/VersionInformation.php';
/**
* Tests for methods in VersionInformation class
*
* @package PhpMyAdmin-test
*/
class VersionInformationTest extends PHPUnit_Framework_TestCase
{
private $_releases;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @return void
*/
protected function setUp()
{
$this->_releases = array();
$release = new stdClass();
$release->date = "2015-09-08";
$release->php_versions = ">=5.3,<7.1";
$release->version = "4.4.14.1";
$release->mysql_versions = ">=5.5";
$this->_releases[] = $release;
$release = new stdClass();
$release->date = "2015-09-09";
$release->php_versions = ">=5.3,<7.0";
$release->version = "4.4.13.3";
$release->mysql_versions = ">=5.5";
$this->_releases[] = $release;
$release = new stdClass();
$release->date = "2015-05-13";
$release->php_versions = ">=5.2,<5.3";
$release->version = "4.0.10.10";
$release->mysql_versions = ">=5.0";
$this->_releases[] = $release;
}
/**
* Test version checking
*
* @return void
*
* @group large
*/
/*
public function testGetLatestVersion()
{
$GLOBALS['cfg']['ProxyUrl'] = '';
$GLOBALS['cfg']['VersionCheckProxyUrl'] = '';
$versionInformation = new VersionInformation();
$version = $versionInformation->getLatestVersion();
$this->assertNotEmpty($version->version);
$this->assertNotEmpty($version->date);
}
*/
/**
* Test version to int conversion.
*
* @param string $version Version string
* @param int $numeric Integer matching version
*
* @return void
*
* @dataProvider dataVersions
*/
public function testVersionToInt($version, $numeric)
{
$versionInformation = new VersionInformation();
$this->assertEquals(
$numeric,
$versionInformation->versionToInt($version)
);
}
/**
* Data provider for version parsing
*
* @return array with test data
*/
public function dataVersions()
{
return array(
array('1.0.0', 1000050),
array('2.0.0.2-dev', 2000002),
array('3.4.2.1', 3040251),
array('3.4.2-dev3', 3040203),
array('3.4.2-dev', 3040200),
array('3.4.2-pl', 3040260),
array('3.4.2-pl3', 3040263),
array('4.4.2-rc22', 4040252),
array('4.4.2-rc', 4040230),
array('4.4.22-beta22', 4042242),
array('4.4.22-beta', 4042220),
array('4.4.21-alpha22', 4042132),
array('4.4.20-alpha', 4042010),
array('4.40.20-alpha-dev', 4402010),
array('4.4a', 4000050),
array('4.4.4-test', 4040400),
array('4.1.0', 4010050),
array('4.0.1.3', 4000153),
array('4.1-dev', 4010000),
);
}
/**
* Tests getLatestCompatibleVersion() when there is only one server confgiured
*
* @return void
*/
public function testGetLatestCompatibleVersionWithSingleServer()
{
$GLOBALS['cfg']['Servers'] = array(
array()
);
$mockVersionInfo = $this->getMockBuilder('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));
$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('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('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('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'));
}
}