2018-10-08 02:15:27 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// this is in the same namespace as Install for mocking 'function_exists'
|
|
|
|
namespace Friendica\Core;
|
|
|
|
|
2019-03-26 22:04:31 +01:00
|
|
|
use Friendica\Core\Config\Cache\IConfigCache;
|
2019-02-24 13:40:54 +01:00
|
|
|
use Friendica\Network\CurlResult;
|
|
|
|
use Friendica\Object\Image;
|
2018-11-01 13:44:47 +01:00
|
|
|
use Friendica\Test\MockedTest;
|
|
|
|
use Friendica\Test\Util\L10nMockTrait;
|
2018-10-08 02:15:27 +02:00
|
|
|
use Friendica\Test\Util\VFSTrait;
|
2019-02-24 13:40:54 +01:00
|
|
|
use Friendica\Util\Network;
|
2018-10-08 02:15:27 +02:00
|
|
|
|
2018-10-22 20:59:51 +02:00
|
|
|
/**
|
|
|
|
* @runTestsInSeparateProcesses
|
|
|
|
* @preserveGlobalState disabled
|
|
|
|
*/
|
2018-11-01 13:44:47 +01:00
|
|
|
class InstallerTest extends MockedTest
|
2018-10-08 02:15:27 +02:00
|
|
|
{
|
|
|
|
use VFSTrait;
|
2018-11-01 13:44:47 +01:00
|
|
|
use L10nMockTrait;
|
2018-10-08 02:15:27 +02:00
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
2018-11-01 13:44:47 +01:00
|
|
|
parent::setUp();
|
2018-10-08 02:15:27 +02:00
|
|
|
|
|
|
|
$this->setUpVfsDir();
|
|
|
|
}
|
|
|
|
|
2018-11-01 13:44:47 +01:00
|
|
|
/**
|
|
|
|
* Mocking the L10n::t() calls for the function checks
|
|
|
|
*/
|
|
|
|
private function mockFunctionL10TCalls()
|
|
|
|
{
|
|
|
|
$this->mockL10nT('Apache mod_rewrite module', 1);
|
|
|
|
$this->mockL10nT('PDO or MySQLi PHP module', 1);
|
|
|
|
$this->mockL10nT('libCurl PHP module', 1);
|
|
|
|
$this->mockL10nT('Error: libCURL PHP module required but not installed.', 1);
|
|
|
|
$this->mockL10nT('XML PHP module', 1);
|
|
|
|
$this->mockL10nT('GD graphics PHP module', 1);
|
|
|
|
$this->mockL10nT('Error: GD graphics PHP module with JPEG support required but not installed.', 1);
|
|
|
|
$this->mockL10nT('OpenSSL PHP module', 1);
|
|
|
|
$this->mockL10nT('Error: openssl PHP module required but not installed.', 1);
|
|
|
|
$this->mockL10nT('mb_string PHP module', 1);
|
|
|
|
$this->mockL10nT('Error: mb_string PHP module required but not installed.', 1);
|
|
|
|
$this->mockL10nT('iconv PHP module', 1);
|
|
|
|
$this->mockL10nT('Error: iconv PHP module required but not installed.', 1);
|
|
|
|
$this->mockL10nT('POSIX PHP module', 1);
|
|
|
|
$this->mockL10nT('Error: POSIX PHP module required but not installed.', 1);
|
2018-12-22 23:56:57 +01:00
|
|
|
$this->mockL10nT('JSON PHP module', 1);
|
|
|
|
$this->mockL10nT('Error: JSON PHP module required but not installed.', 1);
|
2019-02-16 22:13:19 +01:00
|
|
|
$this->mockL10nT('File Information PHP module', 1);
|
|
|
|
$this->mockL10nT('Error: File Information PHP module required but not installed.', 1);
|
2018-11-01 13:44:47 +01:00
|
|
|
}
|
|
|
|
|
2018-10-08 02:15:27 +02:00
|
|
|
private function assertCheckExist($position, $title, $help, $status, $required, $assertionArray)
|
|
|
|
{
|
|
|
|
$this->assertArraySubset([$position => [
|
|
|
|
'title' => $title,
|
|
|
|
'status' => $status,
|
|
|
|
'required' => $required,
|
|
|
|
'error_msg' => null,
|
|
|
|
'help' => $help]
|
|
|
|
], $assertionArray);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Replaces function_exists results with given mocks
|
|
|
|
*
|
|
|
|
* @param array $functions a list from function names and their result
|
|
|
|
*/
|
|
|
|
private function setFunctions($functions)
|
|
|
|
{
|
|
|
|
global $phpMock;
|
|
|
|
$phpMock['function_exists'] = function($function) use ($functions) {
|
|
|
|
foreach ($functions as $name => $value) {
|
|
|
|
if ($function == $name) {
|
|
|
|
return $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return '__phpunit_continue__';
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-10-23 12:31:15 +02:00
|
|
|
/**
|
|
|
|
* Replaces class_exist results with given mocks
|
|
|
|
*
|
|
|
|
* @param array $classes a list from class names and their results
|
|
|
|
*/
|
|
|
|
private function setClasses($classes)
|
|
|
|
{
|
|
|
|
global $phpMock;
|
|
|
|
$phpMock['class_exists'] = function($class) use ($classes) {
|
|
|
|
foreach ($classes as $name => $value) {
|
|
|
|
if ($class == $name) {
|
|
|
|
return $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return '__phpunit_continue__';
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-10-08 02:15:27 +02:00
|
|
|
/**
|
|
|
|
* @small
|
|
|
|
*/
|
|
|
|
public function testCheckKeys()
|
|
|
|
{
|
2019-01-30 20:26:17 +01:00
|
|
|
$this->mockL10nT();
|
|
|
|
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->setFunctions(['openssl_pkey_new' => false]);
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->assertFalse($install->checkKeys());
|
|
|
|
|
|
|
|
$this->setFunctions(['openssl_pkey_new' => true]);
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->assertTrue($install->checkKeys());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @small
|
|
|
|
*/
|
|
|
|
public function testCheckFunctions()
|
|
|
|
{
|
2018-11-01 13:44:47 +01:00
|
|
|
$this->mockFunctionL10TCalls();
|
|
|
|
$this->setFunctions(['curl_init' => false, 'imagecreatefromjpeg' => true]);
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->assertFalse($install->checkFunctions());
|
|
|
|
$this->assertCheckExist(3,
|
2018-11-01 13:44:47 +01:00
|
|
|
'libCurl PHP module',
|
|
|
|
'Error: libCURL PHP module required but not installed.',
|
2018-10-08 02:15:27 +02:00
|
|
|
false,
|
|
|
|
true,
|
|
|
|
$install->getChecks());
|
|
|
|
|
2018-11-01 13:44:47 +01:00
|
|
|
$this->mockFunctionL10TCalls();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->setFunctions(['imagecreatefromjpeg' => false]);
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->assertFalse($install->checkFunctions());
|
|
|
|
$this->assertCheckExist(4,
|
2018-11-01 13:44:47 +01:00
|
|
|
'GD graphics PHP module',
|
|
|
|
'Error: GD graphics PHP module with JPEG support required but not installed.',
|
2018-10-08 02:15:27 +02:00
|
|
|
false,
|
|
|
|
true,
|
|
|
|
$install->getChecks());
|
|
|
|
|
2018-11-01 13:44:47 +01:00
|
|
|
$this->mockFunctionL10TCalls();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->setFunctions(['openssl_public_encrypt' => false]);
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->assertFalse($install->checkFunctions());
|
|
|
|
$this->assertCheckExist(5,
|
2018-11-01 13:44:47 +01:00
|
|
|
'OpenSSL PHP module',
|
|
|
|
'Error: openssl PHP module required but not installed.',
|
2018-10-08 02:15:27 +02:00
|
|
|
false,
|
|
|
|
true,
|
|
|
|
$install->getChecks());
|
|
|
|
|
2018-11-01 13:44:47 +01:00
|
|
|
$this->mockFunctionL10TCalls();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->setFunctions(['mb_strlen' => false]);
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->assertFalse($install->checkFunctions());
|
|
|
|
$this->assertCheckExist(6,
|
2018-11-01 13:44:47 +01:00
|
|
|
'mb_string PHP module',
|
|
|
|
'Error: mb_string PHP module required but not installed.',
|
2018-10-08 02:15:27 +02:00
|
|
|
false,
|
|
|
|
true,
|
|
|
|
$install->getChecks());
|
|
|
|
|
2018-11-01 13:44:47 +01:00
|
|
|
$this->mockFunctionL10TCalls();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->setFunctions(['iconv_strlen' => false]);
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->assertFalse($install->checkFunctions());
|
|
|
|
$this->assertCheckExist(7,
|
2018-11-01 13:44:47 +01:00
|
|
|
'iconv PHP module',
|
|
|
|
'Error: iconv PHP module required but not installed.',
|
2018-10-08 02:15:27 +02:00
|
|
|
false,
|
|
|
|
true,
|
|
|
|
$install->getChecks());
|
|
|
|
|
2018-11-01 13:44:47 +01:00
|
|
|
$this->mockFunctionL10TCalls();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->setFunctions(['posix_kill' => false]);
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->assertFalse($install->checkFunctions());
|
|
|
|
$this->assertCheckExist(8,
|
2018-11-01 13:44:47 +01:00
|
|
|
'POSIX PHP module',
|
|
|
|
'Error: POSIX PHP module required but not installed.',
|
2018-10-08 02:15:27 +02:00
|
|
|
false,
|
|
|
|
true,
|
|
|
|
$install->getChecks());
|
|
|
|
|
2018-12-22 23:04:47 +01:00
|
|
|
$this->mockFunctionL10TCalls();
|
|
|
|
$this->setFunctions(['json_encode' => false]);
|
|
|
|
$install = new Installer();
|
|
|
|
$this->assertFalse($install->checkFunctions());
|
|
|
|
$this->assertCheckExist(9,
|
|
|
|
'JSON PHP module',
|
|
|
|
'Error: JSON PHP module required but not installed.',
|
|
|
|
false,
|
|
|
|
true,
|
|
|
|
$install->getChecks());
|
|
|
|
|
2019-02-16 22:13:19 +01:00
|
|
|
$this->mockFunctionL10TCalls();
|
|
|
|
$this->setFunctions(['finfo_open' => false]);
|
|
|
|
$install = new Installer();
|
|
|
|
$this->assertFalse($install->checkFunctions());
|
|
|
|
$this->assertCheckExist(10,
|
|
|
|
'File Information PHP module',
|
|
|
|
'Error: File Information PHP module required but not installed.',
|
|
|
|
false,
|
|
|
|
true,
|
|
|
|
$install->getChecks());
|
|
|
|
|
2018-11-01 13:44:47 +01:00
|
|
|
$this->mockFunctionL10TCalls();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->setFunctions([
|
|
|
|
'curl_init' => true,
|
|
|
|
'imagecreatefromjpeg' => true,
|
|
|
|
'openssl_public_encrypt' => true,
|
|
|
|
'mb_strlen' => true,
|
|
|
|
'iconv_strlen' => true,
|
2018-12-22 23:36:53 +01:00
|
|
|
'posix_kill' => true,
|
2019-02-16 22:13:19 +01:00
|
|
|
'json_encode' => true,
|
|
|
|
'finfo_open' => true,
|
2018-10-08 02:15:27 +02:00
|
|
|
]);
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->assertTrue($install->checkFunctions());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @small
|
|
|
|
*/
|
|
|
|
public function testCheckLocalIni()
|
|
|
|
{
|
2019-01-30 20:26:17 +01:00
|
|
|
$this->mockL10nT();
|
|
|
|
|
2018-11-25 07:44:09 +01:00
|
|
|
$this->assertTrue($this->root->hasChild('config/local.config.php'));
|
2018-10-08 02:15:27 +02:00
|
|
|
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->assertTrue($install->checkLocalIni());
|
|
|
|
|
2018-11-25 07:44:09 +01:00
|
|
|
$this->delConfigFile('local.config.php');
|
2018-10-08 02:15:27 +02:00
|
|
|
|
2018-11-25 07:44:09 +01:00
|
|
|
$this->assertFalse($this->root->hasChild('config/local.config.php'));
|
2018-10-08 02:15:27 +02:00
|
|
|
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->assertTrue($install->checkLocalIni());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @small
|
|
|
|
*/
|
|
|
|
public function testCheckHtAccessFail()
|
|
|
|
{
|
2019-01-30 20:26:17 +01:00
|
|
|
$this->mockL10nT();
|
|
|
|
|
2018-10-08 02:15:27 +02:00
|
|
|
// Mocking the CURL Response
|
2019-02-24 13:40:54 +01:00
|
|
|
$curlResult = \Mockery::mock(CurlResult::class);
|
2018-10-08 02:15:27 +02:00
|
|
|
$curlResult
|
2018-10-29 14:10:45 +01:00
|
|
|
->shouldReceive('getReturnCode')
|
|
|
|
->andReturn('404');
|
2018-10-08 02:15:27 +02:00
|
|
|
$curlResult
|
|
|
|
->shouldReceive('getRedirectUrl')
|
|
|
|
->andReturn('');
|
|
|
|
$curlResult
|
|
|
|
->shouldReceive('getError')
|
|
|
|
->andReturn('test Error');
|
|
|
|
|
|
|
|
// Mocking the CURL Request
|
2019-02-24 13:40:54 +01:00
|
|
|
$networkMock = \Mockery::mock('alias:' . Network::class);
|
2018-10-08 02:15:27 +02:00
|
|
|
$networkMock
|
|
|
|
->shouldReceive('fetchUrlFull')
|
|
|
|
->with('https://test/install/testrewrite')
|
|
|
|
->andReturn($curlResult);
|
|
|
|
$networkMock
|
|
|
|
->shouldReceive('fetchUrlFull')
|
|
|
|
->with('http://test/install/testrewrite')
|
|
|
|
->andReturn($curlResult);
|
|
|
|
|
|
|
|
// Mocking that we can use CURL
|
|
|
|
$this->setFunctions(['curl_init' => true]);
|
|
|
|
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-08 02:15:27 +02:00
|
|
|
|
2018-10-29 14:10:45 +01:00
|
|
|
$this->assertFalse($install->checkHtAccess('https://test'));
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->assertSame('test Error', $install->getChecks()[0]['error_msg']['msg']);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @small
|
|
|
|
*/
|
|
|
|
public function testCheckHtAccessWork()
|
|
|
|
{
|
2019-01-30 20:26:17 +01:00
|
|
|
$this->mockL10nT();
|
|
|
|
|
2018-10-08 02:15:27 +02:00
|
|
|
// Mocking the failed CURL Response
|
2019-02-24 13:40:54 +01:00
|
|
|
$curlResultF = \Mockery::mock(CurlResult::class);
|
2018-10-08 02:15:27 +02:00
|
|
|
$curlResultF
|
2018-10-29 14:10:45 +01:00
|
|
|
->shouldReceive('getReturnCode')
|
|
|
|
->andReturn('404');
|
2018-10-08 02:15:27 +02:00
|
|
|
|
|
|
|
// Mocking the working CURL Response
|
2019-02-24 13:40:54 +01:00
|
|
|
$curlResultW = \Mockery::mock(CurlResult::class);
|
2018-10-08 02:15:27 +02:00
|
|
|
$curlResultW
|
2018-10-29 14:10:45 +01:00
|
|
|
->shouldReceive('getReturnCode')
|
|
|
|
->andReturn('204');
|
2018-10-08 02:15:27 +02:00
|
|
|
|
|
|
|
// Mocking the CURL Request
|
2019-02-24 13:40:54 +01:00
|
|
|
$networkMock = \Mockery::mock('alias:' . Network::class);
|
2018-10-08 02:15:27 +02:00
|
|
|
$networkMock
|
|
|
|
->shouldReceive('fetchUrlFull')
|
|
|
|
->with('https://test/install/testrewrite')
|
|
|
|
->andReturn($curlResultF);
|
|
|
|
$networkMock
|
|
|
|
->shouldReceive('fetchUrlFull')
|
|
|
|
->with('http://test/install/testrewrite')
|
|
|
|
->andReturn($curlResultW);
|
|
|
|
|
|
|
|
// Mocking that we can use CURL
|
|
|
|
$this->setFunctions(['curl_init' => true]);
|
|
|
|
|
|
|
|
// needed because of "normalise_link"
|
|
|
|
require_once __DIR__ . '/../../../include/text.php';
|
|
|
|
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-08 02:15:27 +02:00
|
|
|
|
2018-10-29 14:10:45 +01:00
|
|
|
$this->assertTrue($install->checkHtAccess('https://test'));
|
2018-10-08 02:15:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @small
|
|
|
|
*/
|
|
|
|
public function testImagick()
|
|
|
|
{
|
2019-01-30 20:26:17 +01:00
|
|
|
$this->mockL10nT();
|
|
|
|
|
2019-02-24 13:40:54 +01:00
|
|
|
$imageMock = \Mockery::mock('alias:'. Image::class);
|
2018-10-08 02:15:27 +02:00
|
|
|
$imageMock
|
|
|
|
->shouldReceive('supportedTypes')
|
|
|
|
->andReturn(['image/gif' => 'gif']);
|
|
|
|
|
2018-10-23 12:31:15 +02:00
|
|
|
$this->setClasses(['Imagick' => true]);
|
|
|
|
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-08 02:15:27 +02:00
|
|
|
|
|
|
|
// even there is no supported type, Imagick should return true (because it is not required)
|
|
|
|
$this->assertTrue($install->checkImagick());
|
2018-10-23 12:31:15 +02:00
|
|
|
|
2018-10-08 02:15:27 +02:00
|
|
|
$this->assertCheckExist(1,
|
|
|
|
L10n::t('ImageMagick supports GIF'),
|
|
|
|
'',
|
|
|
|
true,
|
|
|
|
false,
|
|
|
|
$install->getChecks());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @small
|
|
|
|
*/
|
|
|
|
public function testImagickNotFound()
|
|
|
|
{
|
2019-01-30 20:26:17 +01:00
|
|
|
$this->mockL10nT();
|
|
|
|
|
2019-02-24 13:40:54 +01:00
|
|
|
$imageMock = \Mockery::mock('alias:' . Image::class);
|
2018-10-08 02:15:27 +02:00
|
|
|
$imageMock
|
|
|
|
->shouldReceive('supportedTypes')
|
|
|
|
->andReturn([]);
|
|
|
|
|
2018-10-23 12:31:15 +02:00
|
|
|
$this->setClasses(['Imagick' => true]);
|
|
|
|
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-08 02:15:27 +02:00
|
|
|
|
|
|
|
// even there is no supported type, Imagick should return true (because it is not required)
|
|
|
|
$this->assertTrue($install->checkImagick());
|
|
|
|
$this->assertCheckExist(1,
|
|
|
|
L10n::t('ImageMagick supports GIF'),
|
|
|
|
'',
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
$install->getChecks());
|
|
|
|
}
|
2018-10-23 12:31:15 +02:00
|
|
|
|
|
|
|
public function testImagickNotInstalled()
|
|
|
|
{
|
|
|
|
$this->setClasses(['Imagick' => false]);
|
2018-11-01 13:44:47 +01:00
|
|
|
$this->mockL10nT('ImageMagick PHP extension is not installed');
|
2018-10-23 12:31:15 +02:00
|
|
|
|
2018-10-29 18:44:39 +01:00
|
|
|
$install = new Installer();
|
2018-10-23 12:31:15 +02:00
|
|
|
|
|
|
|
// even there is no supported type, Imagick should return true (because it is not required)
|
|
|
|
$this->assertTrue($install->checkImagick());
|
|
|
|
$this->assertCheckExist(0,
|
2018-11-01 13:44:47 +01:00
|
|
|
'ImageMagick PHP extension is not installed',
|
2018-10-23 12:31:15 +02:00
|
|
|
'',
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
$install->getChecks());
|
|
|
|
}
|
2019-03-26 22:04:31 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the setup of the config cache for installation
|
|
|
|
*/
|
|
|
|
public function testSetUpCache()
|
|
|
|
{
|
|
|
|
$this->mockL10nT();
|
|
|
|
|
|
|
|
$install = new Installer();
|
|
|
|
$configCache = \Mockery::mock(IConfigCache::class);
|
|
|
|
$configCache->shouldReceive('set')->with('config', 'php_path', \Mockery::any())->once();
|
|
|
|
$configCache->shouldReceive('set')->with('system', 'basepath', '/test/')->once();
|
|
|
|
|
|
|
|
$install->setUpCache($configCache, '/test/');
|
|
|
|
}
|
2018-10-08 02:15:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A workaround to replace the PHP native function_exists with a mocked function
|
|
|
|
*
|
|
|
|
* @param string $function_name the Name of the function
|
|
|
|
*
|
|
|
|
* @return bool true or false
|
|
|
|
*/
|
|
|
|
function function_exists($function_name)
|
|
|
|
{
|
|
|
|
global $phpMock;
|
|
|
|
if (isset($phpMock['function_exists'])) {
|
|
|
|
$result = call_user_func_array($phpMock['function_exists'], func_get_args());
|
|
|
|
if ($result !== '__phpunit_continue__') {
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return call_user_func_array('\function_exists', func_get_args());
|
|
|
|
}
|
2018-10-23 12:31:15 +02:00
|
|
|
|
|
|
|
function class_exists($class_name)
|
|
|
|
{
|
|
|
|
global $phpMock;
|
|
|
|
if (isset($phpMock['class_exists'])) {
|
|
|
|
$result = call_user_func_array($phpMock['class_exists'], func_get_args());
|
|
|
|
if ($result !== '__phpunit_continue__') {
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return call_user_func_array('\class_exists', func_get_args());
|
|
|
|
}
|