mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-24 19:59:10 -04:00
ALPHA 3.0.2a
This commit is contained in:
4
vendor/psy/psysh/test/ClassWithSecrets.php
vendored
4
vendor/psy/psysh/test/ClassWithSecrets.php
vendored
@@ -20,7 +20,7 @@ class ClassWithSecrets
|
||||
private static function privateStaticMethod($extra = null)
|
||||
{
|
||||
if ($extra !== null) {
|
||||
return 'private and static and method with ' . json_encode($extra);
|
||||
return 'private and static and method with ' . \json_encode($extra);
|
||||
}
|
||||
|
||||
return 'private and static and method';
|
||||
@@ -29,7 +29,7 @@ class ClassWithSecrets
|
||||
private function privateMethod($extra = null)
|
||||
{
|
||||
if ($extra !== null) {
|
||||
return 'private and method with ' . json_encode($extra);
|
||||
return 'private and method with ' . \json_encode($extra);
|
||||
}
|
||||
|
||||
return 'private and method';
|
||||
|
||||
@@ -37,7 +37,7 @@ class FinalClassPassTest extends CodeCleanerTestCase
|
||||
// array('namespace A { final class B {} } namespace C { class D extends \\A\\B {} }'),
|
||||
];
|
||||
|
||||
if (!defined('HHVM_VERSION')) {
|
||||
if (!\defined('HHVM_VERSION')) {
|
||||
// For some reason Closure isn't final in HHVM?
|
||||
$data[] = ['class A extends \\Closure {}'];
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class FunctionReturnInWriteContextPassTest extends CodeCleanerTestCase
|
||||
$this->traverser->traverse($this->parse('isset(strtolower("A"))'));
|
||||
$this->fail();
|
||||
} catch (FatalErrorException $e) {
|
||||
if (version_compare(PHP_VERSION, '5.5', '>=')) {
|
||||
if (\version_compare(PHP_VERSION, '5.5', '>=')) {
|
||||
$this->assertContains(
|
||||
'Cannot use isset() on the result of a function call (you can use "null !== func()" instead)',
|
||||
$e->getMessage()
|
||||
@@ -66,7 +66,7 @@ class FunctionReturnInWriteContextPassTest extends CodeCleanerTestCase
|
||||
*/
|
||||
public function testEmpty()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '5.5', '>=')) {
|
||||
if (\version_compare(PHP_VERSION, '5.5', '>=')) {
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class LegacyEmptyPassTest extends CodeCleanerTestCase
|
||||
|
||||
public function invalidStatements()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '5.5', '>=')) {
|
||||
if (\version_compare(PHP_VERSION, '5.5', '>=')) {
|
||||
return [
|
||||
['empty()'],
|
||||
];
|
||||
@@ -58,7 +58,7 @@ class LegacyEmptyPassTest extends CodeCleanerTestCase
|
||||
|
||||
public function validStatements()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '5.5', '<')) {
|
||||
if (\version_compare(PHP_VERSION, '5.5', '<')) {
|
||||
return [
|
||||
['empty($foo)'],
|
||||
];
|
||||
|
||||
@@ -26,7 +26,7 @@ class ListPassTest extends CodeCleanerTestCase
|
||||
*/
|
||||
public function testProcessInvalidStatement($code, $expectedMessage)
|
||||
{
|
||||
if (method_exists($this, 'setExpectedException')) {
|
||||
if (\method_exists($this, 'setExpectedException')) {
|
||||
$this->setExpectedException('Psy\Exception\ParseErrorException', $expectedMessage);
|
||||
} else {
|
||||
$this->expectExceptionMessage($expectedMessage);
|
||||
@@ -50,20 +50,23 @@ class ListPassTest extends CodeCleanerTestCase
|
||||
['list("a") = array(1)', $errorPhpParserSyntax],
|
||||
];
|
||||
|
||||
if (version_compare(PHP_VERSION, '7.1', '<')) {
|
||||
return array_merge($invalidExpr, [
|
||||
if (\version_compare(PHP_VERSION, '7.1', '<')) {
|
||||
return \array_merge($invalidExpr, [
|
||||
['list("a" => _) = array("a" => 1)', $errorPhpParserSyntax],
|
||||
['[] = []', $errorShortListAssign],
|
||||
['[$a] = [1]', $errorShortListAssign],
|
||||
['list("a" => $a) = array("a" => 1)', $errorAssocListAssign],
|
||||
['[$a[0], $a[1]] = [1, 2]', $errorShortListAssign],
|
||||
['[$a->b, $a->c] = [1, 2]', $errorShortListAssign],
|
||||
]);
|
||||
}
|
||||
|
||||
return array_merge($invalidExpr, [
|
||||
return \array_merge($invalidExpr, [
|
||||
['list("a" => _) = array("a" => 1)', $errorPhpParserSyntax],
|
||||
['["a"] = [1]', $errorNonVariableAssign],
|
||||
['[] = []', $errorEmptyList],
|
||||
['[,] = [1,2]', $errorEmptyList],
|
||||
['[,,] = [1,2,3]', $errorEmptyList],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -84,8 +87,8 @@ class ListPassTest extends CodeCleanerTestCase
|
||||
['list($x, $y) = array(1, 2)'],
|
||||
];
|
||||
|
||||
if (version_compare(PHP_VERSION, '7.1', '>=')) {
|
||||
return array_merge($validExpr, [
|
||||
if (\version_compare(PHP_VERSION, '7.1', '>=')) {
|
||||
return \array_merge($validExpr, [
|
||||
['[$a] = array(1)'],
|
||||
['list($b) = [2]'],
|
||||
['[$x, $y] = array(1, 2)'],
|
||||
@@ -96,6 +99,8 @@ class ListPassTest extends CodeCleanerTestCase
|
||||
['[,$b] = [1,2,3]'],
|
||||
['[$a,,$c] = [1,2,3]'],
|
||||
['[$a,,,] = [1,2,3]'],
|
||||
['[$a[0], $a[1]] = [1, 2]'],
|
||||
['[$a->b, $a->c] = [1, 2]'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class NamespacePassTest extends CodeCleanerTestCase
|
||||
// A new block namespace clears out the current namespace...
|
||||
$this->parseAndTraverse('namespace Gamma { array_merge(); }');
|
||||
|
||||
if (defined('PhpParser\\Node\\Stmt\\Namespace_::KIND_SEMICOLON')) {
|
||||
if (\defined('PhpParser\\Node\\Stmt\\Namespace_::KIND_SEMICOLON')) {
|
||||
$this->assertNull($this->cleaner->getNamespace());
|
||||
} else {
|
||||
// But not for PHP-Parser < v3.1.2 :(
|
||||
|
||||
@@ -20,7 +20,7 @@ class NoReturnValueTest extends ParserTestCase
|
||||
public function testCreate()
|
||||
{
|
||||
$stmt = NoReturnValue::create();
|
||||
if (class_exists('PhpParser\Node\Stmt\Expression')) {
|
||||
if (\class_exists('PhpParser\Node\Stmt\Expression')) {
|
||||
$stmt = new Expression($stmt);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class RequirePassTest extends CodeCleanerTestCase
|
||||
*/
|
||||
public function testResolveEmptyWarnings($file)
|
||||
{
|
||||
if (!E_WARNING & error_reporting()) {
|
||||
if (!E_WARNING & \error_reporting()) {
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class StrictTypesPassTest extends CodeCleanerTestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '7.0', '<')) {
|
||||
if (\version_compare(PHP_VERSION, '7.0', '<')) {
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ class UseStatementPassTest extends CodeCleanerTestCase
|
||||
|
||||
public function groupUseStatements()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '7.0', '<')) {
|
||||
if (\version_compare(PHP_VERSION, '7.0', '<')) {
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
|
||||
@@ -172,6 +172,7 @@ class ValidClassNamePassTest extends CodeCleanerTestCase
|
||||
['DateTime::$someMethod()'],
|
||||
['Psy\Test\CodeCleaner\Fixtures\ClassWithStatic::doStuff()'],
|
||||
['Psy\Test\CodeCleaner\Fixtures\ClassWithCallStatic::doStuff()'],
|
||||
['Psy\Test\CodeCleaner\Fixtures\TraitWithStatic::doStuff()'],
|
||||
|
||||
// Allow `self` and `static` as class names.
|
||||
['
|
||||
@@ -305,12 +306,12 @@ class ValidClassNamePassTest extends CodeCleanerTestCase
|
||||
];
|
||||
|
||||
// Ugh. There's gotta be a better way to test for this.
|
||||
if (class_exists('PhpParser\ParserFactory')) {
|
||||
if (\class_exists('PhpParser\ParserFactory')) {
|
||||
// PHP 7.0 anonymous classes, only supported by PHP Parser v2.x
|
||||
$valid[] = ['$obj = new class() {}'];
|
||||
}
|
||||
|
||||
if (version_compare(PHP_VERSION, '5.5', '>=')) {
|
||||
if (\version_compare(PHP_VERSION, '5.5', '>=')) {
|
||||
$valid[] = ['interface A {} A::class'];
|
||||
$valid[] = ['interface A {} A::CLASS'];
|
||||
$valid[] = ['class A {} A::class'];
|
||||
|
||||
@@ -47,7 +47,7 @@ class ValidConstructorPassTest extends CodeCleanerTestCase
|
||||
['class A { private static function a() {}}'],
|
||||
];
|
||||
|
||||
if (version_compare(PHP_VERSION, '7.0', '>=')) {
|
||||
if (\version_compare(PHP_VERSION, '7.0', '>=')) {
|
||||
$data[] = ['class A { public function A(): ?array {}}'];
|
||||
$data[] = ['class A { public function a(): ?array {}}'];
|
||||
}
|
||||
@@ -82,7 +82,7 @@ class ValidConstructorPassTest extends CodeCleanerTestCase
|
||||
['namespace B; class A { private static function A() {}}'],
|
||||
];
|
||||
|
||||
if (version_compare(PHP_VERSION, '7.0', '>=')) {
|
||||
if (\version_compare(PHP_VERSION, '7.0', '>=')) {
|
||||
$data[] = ['class A { public static function A() {} public function __construct() {}}'];
|
||||
$data[] = ['class A { private function __construct() {} public static function A(): ?array {}}'];
|
||||
$data[] = ['namespace B; class A { private static function A(): ?array {}}'];
|
||||
|
||||
2
vendor/psy/psysh/test/CodeCleanerTest.php
vendored
2
vendor/psy/psysh/test/CodeCleanerTest.php
vendored
@@ -79,7 +79,7 @@ class CodeCleanerTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testMoreUnclosedStatements(array $lines)
|
||||
{
|
||||
if (defined('HHVM_VERSION')) {
|
||||
if (\defined('HHVM_VERSION')) {
|
||||
$this->markTestSkipped('HHVM not supported.');
|
||||
}
|
||||
|
||||
|
||||
40
vendor/psy/psysh/test/ConfigurationTest.php
vendored
40
vendor/psy/psysh/test/ConfigurationTest.php
vendored
@@ -30,10 +30,10 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$config = $this->getConfig();
|
||||
|
||||
$this->assertSame(function_exists('readline'), $config->hasReadline());
|
||||
$this->assertSame(function_exists('readline'), $config->useReadline());
|
||||
$this->assertSame(function_exists('pcntl_signal'), $config->hasPcntl());
|
||||
$this->assertSame(function_exists('pcntl_signal'), $config->usePcntl());
|
||||
$this->assertSame(\function_exists('readline'), $config->hasReadline());
|
||||
$this->assertSame(\function_exists('readline'), $config->useReadline());
|
||||
$this->assertSame(\function_exists('pcntl_signal'), $config->hasPcntl());
|
||||
$this->assertSame(\function_exists('pcntl_signal'), $config->usePcntl());
|
||||
$this->assertFalse($config->requireSemicolons());
|
||||
$this->assertSame(Configuration::COLOR_MODE_AUTO, $config->colorMode());
|
||||
$this->assertNull($config->getStartupMessage());
|
||||
@@ -57,20 +57,20 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testFilesAndDirectories($home, $configFile, $historyFile, $manualDbFile)
|
||||
{
|
||||
$oldHome = getenv('HOME');
|
||||
putenv("HOME=$home");
|
||||
$oldHome = \getenv('HOME');
|
||||
\putenv("HOME=$home");
|
||||
|
||||
$config = new Configuration();
|
||||
$this->assertSame(realpath($configFile), realpath($config->getConfigFile()));
|
||||
$this->assertSame(realpath($historyFile), realpath($config->getHistoryFile()));
|
||||
$this->assertSame(realpath($manualDbFile), realpath($config->getManualDbFile()));
|
||||
$this->assertSame(\realpath($configFile), \realpath($config->getConfigFile()));
|
||||
$this->assertSame(\realpath($historyFile), \realpath($config->getHistoryFile()));
|
||||
$this->assertSame(\realpath($manualDbFile), \realpath($config->getManualDbFile()));
|
||||
|
||||
putenv("HOME=$oldHome");
|
||||
\putenv("HOME=$oldHome");
|
||||
}
|
||||
|
||||
public function directories()
|
||||
{
|
||||
$base = realpath(__DIR__ . '/fixtures');
|
||||
$base = \realpath(__DIR__ . '/fixtures');
|
||||
|
||||
return [
|
||||
[
|
||||
@@ -125,21 +125,21 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$config = $this->getConfig(__DIR__ . '/fixtures/config.php');
|
||||
|
||||
$runtimeDir = $this->joinPath(realpath(sys_get_temp_dir()), 'psysh_test', 'withconfig', 'temp');
|
||||
$runtimeDir = $this->joinPath(\realpath(\sys_get_temp_dir()), 'psysh_test', 'withconfig', 'temp');
|
||||
|
||||
$this->assertStringStartsWith($runtimeDir, realpath($config->getTempFile('foo', 123)));
|
||||
$this->assertStringStartsWith($runtimeDir, realpath(dirname($config->getPipe('pipe', 123))));
|
||||
$this->assertStringStartsWith($runtimeDir, realpath($config->getRuntimeDir()));
|
||||
$this->assertStringStartsWith($runtimeDir, \realpath($config->getTempFile('foo', 123)));
|
||||
$this->assertStringStartsWith($runtimeDir, \realpath(\dirname($config->getPipe('pipe', 123))));
|
||||
$this->assertStringStartsWith($runtimeDir, \realpath($config->getRuntimeDir()));
|
||||
|
||||
$this->assertSame(function_exists('readline'), $config->useReadline());
|
||||
$this->assertSame(\function_exists('readline'), $config->useReadline());
|
||||
$this->assertFalse($config->usePcntl());
|
||||
$this->assertSame(E_ALL & ~E_NOTICE, $config->errorLoggingLevel());
|
||||
}
|
||||
|
||||
public function testLoadLocalConfigFile()
|
||||
{
|
||||
$oldPwd = getcwd();
|
||||
chdir(realpath(__DIR__ . '/fixtures/project/'));
|
||||
$oldPwd = \getcwd();
|
||||
\chdir(\realpath(__DIR__ . '/fixtures/project/'));
|
||||
|
||||
$config = new Configuration();
|
||||
|
||||
@@ -153,7 +153,7 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertFalse($config->requireSemicolons());
|
||||
$this->assertTrue($config->useUnicode());
|
||||
|
||||
chdir($oldPwd);
|
||||
\chdir($oldPwd);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,7 +166,7 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
private function joinPath()
|
||||
{
|
||||
return implode(DIRECTORY_SEPARATOR, func_get_args());
|
||||
return \implode(DIRECTORY_SEPARATOR, \func_get_args());
|
||||
}
|
||||
|
||||
public function testConfigIncludes()
|
||||
|
||||
6
vendor/psy/psysh/test/ContextTest.php
vendored
6
vendor/psy/psysh/test/ContextTest.php
vendored
@@ -244,7 +244,7 @@ class ContextTest extends \PHPUnit\Framework\TestCase
|
||||
$__line = 'dixie';
|
||||
$__dir = 'wrinkly';
|
||||
|
||||
$vars = compact('__function', '__method', '__class', '__namespace', '__file', '__line', '__dir');
|
||||
$vars = \compact('__function', '__method', '__class', '__namespace', '__file', '__line', '__dir');
|
||||
|
||||
$context = new Context();
|
||||
$context->setCommandScopeVariables($vars);
|
||||
@@ -259,7 +259,7 @@ class ContextTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertEquals($__line, $context->get('__line'));
|
||||
$this->assertEquals($__dir, $context->get('__dir'));
|
||||
|
||||
$someVars = compact('__function', '__namespace', '__file', '__line', '__dir');
|
||||
$someVars = \compact('__function', '__namespace', '__file', '__line', '__dir');
|
||||
$context->setCommandScopeVariables($someVars);
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ class ContextTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$this->assertEquals(
|
||||
['__method', '__class'],
|
||||
array_values($context->getUnusedCommandScopeVariableNames())
|
||||
\array_values($context->getUnusedCommandScopeVariableNames())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,14 +76,14 @@ class ErrorExceptionTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testThrowExceptionAsErrorHandler($level, $type)
|
||||
{
|
||||
set_error_handler(['Psy\Exception\ErrorException', 'throwException']);
|
||||
\set_error_handler(['Psy\Exception\ErrorException', 'throwException']);
|
||||
try {
|
||||
trigger_error('{whot}', $level);
|
||||
\trigger_error('{whot}', $level);
|
||||
} catch (ErrorException $e) {
|
||||
$this->assertContains('PHP ' . $type, $e->getMessage());
|
||||
$this->assertContains('{whot}', $e->getMessage());
|
||||
}
|
||||
restore_error_handler();
|
||||
\restore_error_handler();
|
||||
}
|
||||
|
||||
public function getUserLevels()
|
||||
@@ -110,7 +110,7 @@ class ErrorExceptionTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testFromError()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '7.0.0', '<')) {
|
||||
if (\version_compare(PHP_VERSION, '7.0.0', '<')) {
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class ThrowUpExceptionTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testFromThrowableWithError()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '7.0.0', '<')) {
|
||||
if (\version_compare(PHP_VERSION, '7.0.0', '<')) {
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class TypeErrorExceptionTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testFromTypeError()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '7.0.0', '<')) {
|
||||
if (\version_compare(PHP_VERSION, '7.0.0', '<')) {
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class CodeFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
public function testFormat($reflector, $expected)
|
||||
{
|
||||
$formatted = CodeFormatter::format($reflector);
|
||||
$formattedWithoutColors = preg_replace('#' . chr(27) . '\[\d\d?m#', '', $formatted);
|
||||
$formattedWithoutColors = \preg_replace('#' . \chr(27) . '\[\d\d?m#', '', $formatted);
|
||||
|
||||
$this->assertEquals($expected, self::trimLines($formattedWithoutColors));
|
||||
$this->assertNotEquals($expected, self::trimLines($formatted));
|
||||
@@ -88,7 +88,7 @@ EOS;
|
||||
[new \ReflectionProperty('Psy\Test\Formatter\Fixtures\SomeClass', 'someProp')],
|
||||
];
|
||||
|
||||
if (version_compare(PHP_VERSION, '7.1.0', '>=')) {
|
||||
if (\version_compare(PHP_VERSION, '7.1.0', '>=')) {
|
||||
$reflectors[] = [new \ReflectionClassConstant('Psy\Test\Formatter\Fixtures\SomeClass', 'SOME_CONST')];
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ EOS;
|
||||
|
||||
public function filenames()
|
||||
{
|
||||
if (defined('HHVM_VERSION')) {
|
||||
if (\defined('HHVM_VERSION')) {
|
||||
$this->markTestSkipped('We have issues with PHPUnit mocks on HHVM.');
|
||||
}
|
||||
|
||||
@@ -124,6 +124,6 @@ EOS;
|
||||
|
||||
private static function trimLines($code)
|
||||
{
|
||||
return rtrim(implode("\n", array_map('rtrim', explode("\n", $code))));
|
||||
return \rtrim(\implode("\n", \array_map('rtrim', \explode("\n", $code))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class SignatureFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testFormat($reflector, $expected)
|
||||
{
|
||||
$this->assertSame($expected, strip_tags(SignatureFormatter::format($reflector)));
|
||||
$this->assertSame($expected, \strip_tags(SignatureFormatter::format($reflector)));
|
||||
}
|
||||
|
||||
public function signatureReflectors()
|
||||
@@ -37,7 +37,7 @@ class SignatureFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
return [
|
||||
[
|
||||
new \ReflectionFunction('implode'),
|
||||
defined('HHVM_VERSION') ? 'function implode($arg1, $arg2 = null)' : 'function implode($glue, $pieces)',
|
||||
\defined('HHVM_VERSION') ? 'function implode($arg1, $arg2 = null)' : 'function implode($glue, $pieces)',
|
||||
],
|
||||
[
|
||||
ReflectionClassConstant::create($this, 'FOO'),
|
||||
|
||||
2
vendor/psy/psysh/test/ParserTestCase.php
vendored
2
vendor/psy/psysh/test/ParserTestCase.php
vendored
@@ -92,6 +92,6 @@ class ParserTestCase extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$msg = $e->getRawMessage();
|
||||
|
||||
return ($msg === 'Unexpected token EOF') || (strpos($msg, 'Syntax error, unexpected EOF') !== false);
|
||||
return ($msg === 'Unexpected token EOF') || (\strpos($msg, 'Syntax error, unexpected EOF') !== false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ class GNUReadlineTest extends \PHPUnit\Framework\TestCase
|
||||
$this->markTestSkipped('GNUReadline not enabled');
|
||||
}
|
||||
|
||||
$this->historyFile = tempnam(sys_get_temp_dir(), 'psysh_test_history');
|
||||
file_put_contents($this->historyFile, "_HiStOrY_V2_\n");
|
||||
$this->historyFile = \tempnam(\sys_get_temp_dir(), 'psysh_test_history');
|
||||
\file_put_contents($this->historyFile, "_HiStOrY_V2_\n");
|
||||
}
|
||||
|
||||
public function testHistory()
|
||||
|
||||
16
vendor/psy/psysh/test/Readline/LibeditTest.php
vendored
16
vendor/psy/psysh/test/Readline/LibeditTest.php
vendored
@@ -23,20 +23,20 @@ class LibeditTest extends \PHPUnit\Framework\TestCase
|
||||
$this->markTestSkipped('Libedit not enabled');
|
||||
}
|
||||
|
||||
$this->historyFile = tempnam(sys_get_temp_dir(), 'psysh_test_history');
|
||||
if (false === file_put_contents($this->historyFile, "_HiStOrY_V2_\n")) {
|
||||
$this->historyFile = \tempnam(\sys_get_temp_dir(), 'psysh_test_history');
|
||||
if (false === \file_put_contents($this->historyFile, "_HiStOrY_V2_\n")) {
|
||||
$this->fail('Unable to write history file: ' . $this->historyFile);
|
||||
}
|
||||
// Calling readline_read_history before readline_clear_history
|
||||
// avoids segfault with PHP 5.5.7 & libedit v3.1
|
||||
readline_read_history($this->historyFile);
|
||||
readline_clear_history();
|
||||
\readline_read_history($this->historyFile);
|
||||
\readline_clear_history();
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
if (is_file($this->historyFile)) {
|
||||
unlink($this->historyFile);
|
||||
if (\is_file($this->historyFile)) {
|
||||
\unlink($this->historyFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ class LibeditTest extends \PHPUnit\Framework\TestCase
|
||||
public function testListHistory()
|
||||
{
|
||||
$readline = new Libedit($this->historyFile);
|
||||
file_put_contents(
|
||||
\file_put_contents(
|
||||
$this->historyFile,
|
||||
"This is an entry\n\0This is a comment\nThis is an entry\0With a comment\n",
|
||||
FILE_APPEND
|
||||
@@ -113,7 +113,7 @@ class LibeditTest extends \PHPUnit\Framework\TestCase
|
||||
public function testLinebreaksSupport()
|
||||
{
|
||||
$readline = new Libedit($this->historyFile);
|
||||
file_put_contents(
|
||||
\file_put_contents(
|
||||
$this->historyFile,
|
||||
"foo\rbar\nbaz\r\nw00t",
|
||||
FILE_APPEND
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Psy\Test\Reflection;
|
||||
|
||||
use Psy\Reflection\ReflectionConstant_;
|
||||
|
||||
define('Psy\\Test\\Reflection\\SOME_CONSTANT', 'yep');
|
||||
\define('Psy\\Test\\Reflection\\SOME_CONSTANT', 'yep');
|
||||
|
||||
class ReflectionConstantTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
||||
67
vendor/psy/psysh/test/ShellTest.php
vendored
67
vendor/psy/psysh/test/ShellTest.php
vendored
@@ -25,7 +25,7 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
public function tearDown()
|
||||
{
|
||||
foreach ($this->streams as $stream) {
|
||||
fclose($stream);
|
||||
\fclose($stream);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
$_e = 'ignore this';
|
||||
|
||||
$shell = new Shell($this->getConfig());
|
||||
$shell->setScopeVariables(compact('one', 'two', 'three', '__psysh__', '_', '_e', 'this'));
|
||||
$shell->setScopeVariables(\compact('one', 'two', 'three', '__psysh__', '_', '_e', 'this'));
|
||||
|
||||
$this->assertNotContains('__psysh__', $shell->getScopeVariableNames());
|
||||
$this->assertSame(['one', 'two', 'three', '_'], $shell->getScopeVariableNames());
|
||||
@@ -48,6 +48,9 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertSame($three, $shell->getScopeVariable('three'));
|
||||
$this->assertNull($shell->getScopeVariable('_'));
|
||||
|
||||
$diff = $shell->getScopeVariablesDiff(['one' => $one, 'two' => 'not two']);
|
||||
$this->assertSame(['two' => $two, 'three' => $three, '_' => null], $diff);
|
||||
|
||||
$shell->setScopeVariables([]);
|
||||
$this->assertSame(['_'], $shell->getScopeVariableNames());
|
||||
|
||||
@@ -80,7 +83,7 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
$config = $this->getConfig(['usePcntl' => false]);
|
||||
|
||||
$shell = new Shell($config);
|
||||
$shell->setScopeVariables(compact('one', 'two', 'three', '__psysh__', '_', '_e', 'this'));
|
||||
$shell->setScopeVariables(\compact('one', 'two', 'three', '__psysh__', '_', '_e', 'this'));
|
||||
$shell->addInput('exit', true);
|
||||
|
||||
// This is super slow and we shouldn't do this :(
|
||||
@@ -160,8 +163,8 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertFalse($shell->hasCode());
|
||||
$this->assertEmpty($shell->getCodeBuffer());
|
||||
|
||||
rewind($stream);
|
||||
$streamContents = stream_get_contents($stream);
|
||||
\rewind($stream);
|
||||
$streamContents = \stream_get_contents($stream);
|
||||
|
||||
$this->assertContains('PHP Parse error', $streamContents);
|
||||
$this->assertContains('message', $streamContents);
|
||||
@@ -175,19 +178,19 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
$stream = $output->getStream();
|
||||
$shell->setOutput($output);
|
||||
|
||||
$oldLevel = error_reporting();
|
||||
error_reporting($oldLevel & ~E_USER_NOTICE);
|
||||
$oldLevel = \error_reporting();
|
||||
\error_reporting($oldLevel & ~E_USER_NOTICE);
|
||||
|
||||
try {
|
||||
$shell->handleError(E_USER_NOTICE, 'wheee', null, 13);
|
||||
} catch (ErrorException $e) {
|
||||
error_reporting($oldLevel);
|
||||
\error_reporting($oldLevel);
|
||||
$this->fail('Unexpected error exception');
|
||||
}
|
||||
error_reporting($oldLevel);
|
||||
\error_reporting($oldLevel);
|
||||
|
||||
rewind($stream);
|
||||
$streamContents = stream_get_contents($stream);
|
||||
\rewind($stream);
|
||||
$streamContents = \stream_get_contents($stream);
|
||||
|
||||
$this->assertContains('PHP Notice:', $streamContents);
|
||||
$this->assertContains('wheee', $streamContents);
|
||||
@@ -200,13 +203,13 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
public function testNotHandlingErrors()
|
||||
{
|
||||
$shell = new Shell($this->getConfig());
|
||||
$oldLevel = error_reporting();
|
||||
error_reporting($oldLevel | E_USER_NOTICE);
|
||||
$oldLevel = \error_reporting();
|
||||
\error_reporting($oldLevel | E_USER_NOTICE);
|
||||
|
||||
try {
|
||||
$shell->handleError(E_USER_NOTICE, 'wheee', null, 13);
|
||||
} catch (ErrorException $e) {
|
||||
error_reporting($oldLevel);
|
||||
\error_reporting($oldLevel);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -217,8 +220,8 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$this->assertInstanceOf('Symfony\Component\Console\Application', $shell);
|
||||
$this->assertContains(Shell::VERSION, $shell->getVersion());
|
||||
$this->assertContains(phpversion(), $shell->getVersion());
|
||||
$this->assertContains(php_sapi_name(), $shell->getVersion());
|
||||
$this->assertContains(PHP_VERSION, $shell->getVersion());
|
||||
$this->assertContains(PHP_SAPI, $shell->getVersion());
|
||||
}
|
||||
|
||||
public function testCodeBuffer()
|
||||
@@ -236,7 +239,7 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
$shell->addCode('{}');
|
||||
$code = $shell->flushCode();
|
||||
$this->assertFalse($shell->hasCode());
|
||||
$code = preg_replace('/\s+/', ' ', $code);
|
||||
$code = \preg_replace('/\s+/', ' ', $code);
|
||||
$this->assertNotNull($code);
|
||||
$this->assertSame('class a { } return new \\Psy\\CodeCleaner\\NoReturnValue();', $code);
|
||||
}
|
||||
@@ -256,7 +259,7 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
$shell->addCode('+ 1');
|
||||
$code = $shell->flushCode();
|
||||
$this->assertFalse($shell->hasCode());
|
||||
$code = preg_replace('/\s+/', ' ', $code);
|
||||
$code = \preg_replace('/\s+/', ' ', $code);
|
||||
$this->assertNotNull($code);
|
||||
$this->assertSame('return 1 + 1 + 1;', $code);
|
||||
}
|
||||
@@ -291,8 +294,8 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$shell->writeStdout("{{stdout}}\n");
|
||||
|
||||
rewind($stream);
|
||||
$streamContents = stream_get_contents($stream);
|
||||
\rewind($stream);
|
||||
$streamContents = \stream_get_contents($stream);
|
||||
|
||||
$this->assertSame('{{stdout}}' . PHP_EOL, $streamContents);
|
||||
}
|
||||
@@ -306,8 +309,8 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$shell->writeStdout('{{stdout}}');
|
||||
|
||||
rewind($stream);
|
||||
$streamContents = stream_get_contents($stream);
|
||||
\rewind($stream);
|
||||
$streamContents = \stream_get_contents($stream);
|
||||
|
||||
$this->assertSame('{{stdout}}<aside>⏎</aside>' . PHP_EOL, $streamContents);
|
||||
}
|
||||
@@ -323,8 +326,8 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
$shell->setOutput($output);
|
||||
|
||||
$shell->writeReturnValue($input);
|
||||
rewind($stream);
|
||||
$this->assertEquals($expected, stream_get_contents($stream));
|
||||
\rewind($stream);
|
||||
$this->assertEquals($expected, \stream_get_contents($stream));
|
||||
}
|
||||
|
||||
public function getReturnValues()
|
||||
@@ -346,8 +349,8 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
$shell->setOutput($output);
|
||||
|
||||
$shell->writeException($exception);
|
||||
rewind($stream);
|
||||
$this->assertSame($expected, stream_get_contents($stream));
|
||||
\rewind($stream);
|
||||
$this->assertSame($expected, \stream_get_contents($stream));
|
||||
}
|
||||
|
||||
public function getRenderedExceptions()
|
||||
@@ -367,8 +370,8 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
$shell = new Shell($this->getConfig());
|
||||
$shell->setOutput($output);
|
||||
$this->assertEquals($expected, $shell->execute($input));
|
||||
rewind($stream);
|
||||
$this->assertSame('', stream_get_contents($stream));
|
||||
\rewind($stream);
|
||||
$this->assertSame('', \stream_get_contents($stream));
|
||||
}
|
||||
|
||||
public function getExecuteValues()
|
||||
@@ -414,7 +417,7 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
private function getOutput()
|
||||
{
|
||||
$stream = fopen('php://memory', 'w+');
|
||||
$stream = \fopen('php://memory', 'w+');
|
||||
$this->streams[] = $stream;
|
||||
|
||||
$output = new StreamOutput($stream, StreamOutput::VERBOSITY_NORMAL, false);
|
||||
@@ -425,8 +428,8 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
private function getConfig(array $config = [])
|
||||
{
|
||||
// Mebbe there's a better way than this?
|
||||
$dir = tempnam(sys_get_temp_dir(), 'psysh_shell_test_');
|
||||
unlink($dir);
|
||||
$dir = \tempnam(\sys_get_temp_dir(), 'psysh_shell_test_');
|
||||
\unlink($dir);
|
||||
|
||||
$defaults = [
|
||||
'configDir' => $dir,
|
||||
@@ -434,6 +437,6 @@ class ShellTest extends \PHPUnit\Framework\TestCase
|
||||
'runtimeDir' => $dir,
|
||||
];
|
||||
|
||||
return new Configuration(array_merge($defaults, $config));
|
||||
return new Configuration(\array_merge($defaults, $config));
|
||||
}
|
||||
}
|
||||
|
||||
2
vendor/psy/psysh/test/SudoTest.php
vendored
2
vendor/psy/psysh/test/SudoTest.php
vendored
@@ -17,7 +17,7 @@ class SudoTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '7.1.0', '<')) {
|
||||
if (\version_compare(PHP_VERSION, '7.1.0', '<')) {
|
||||
$this->markTestSkipped('YOLO');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class AutoCompleterTest extends \PHPUnit\Framework\TestCase
|
||||
$code = $tabCompletion->processCallback('', 0, [
|
||||
'line_buffer' => $line,
|
||||
'point' => 0,
|
||||
'end' => strlen($line),
|
||||
'end' => \strlen($line),
|
||||
]);
|
||||
|
||||
foreach ($mustContain as $mc) {
|
||||
|
||||
2
vendor/psy/psysh/test/Util/DocblockTest.php
vendored
2
vendor/psy/psysh/test/Util/DocblockTest.php
vendored
@@ -41,7 +41,7 @@ class DocblockTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function comments()
|
||||
{
|
||||
if (defined('HHVM_VERSION')) {
|
||||
if (\defined('HHVM_VERSION')) {
|
||||
$this->markTestSkipped('We have issues with PHPUnit mocks on HHVM.');
|
||||
}
|
||||
|
||||
|
||||
2
vendor/psy/psysh/test/Util/MirrorTest.php
vendored
2
vendor/psy/psysh/test/Util/MirrorTest.php
vendored
@@ -36,7 +36,7 @@ class MirrorTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertInstanceOf('ReflectionObject', $refl);
|
||||
|
||||
$refl = Mirror::get($this, 'FOO');
|
||||
if (version_compare(PHP_VERSION, '7.1.0', '>=')) {
|
||||
if (\version_compare(PHP_VERSION, '7.1.0', '>=')) {
|
||||
$this->assertInstanceOf('ReflectionClassConstant', $refl);
|
||||
} else {
|
||||
$this->assertInstanceOf('Psy\Reflection\ReflectionClassConstant', $refl);
|
||||
|
||||
2
vendor/psy/psysh/test/Util/StrTest.php
vendored
2
vendor/psy/psysh/test/Util/StrTest.php
vendored
@@ -26,6 +26,6 @@ class StrTest extends \PHPUnit\Framework\TestCase
|
||||
public function unvisProvider()
|
||||
{
|
||||
//return require_once(__DIR__.'/../fixtures/unvis_fixtures.php');
|
||||
return json_decode(file_get_contents(__DIR__ . '/../fixtures/unvis_fixtures.json'));
|
||||
return \json_decode(\file_get_contents(__DIR__ . '/../fixtures/unvis_fixtures.json'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,13 +52,13 @@ class GitHubCheckerTest extends \PHPUnit\Framework\TestCase
|
||||
public function jsonResults()
|
||||
{
|
||||
return [
|
||||
[false, json_decode('{"tag_name":"v9.0.0"}')],
|
||||
[true, json_decode('{"tag_name":"v' . Shell::VERSION . '"}')],
|
||||
[true, json_decode('{"tag_name":"v0.0.1"}')],
|
||||
[true, json_decode('{"tag_name":"v0.4.1-alpha"}')],
|
||||
[true, json_decode('{"tag_name":"v0.4.2-beta3"}')],
|
||||
[true, json_decode('{"tag_name":"v0.0.1"}')],
|
||||
[true, json_decode('{"tag_name":""}')],
|
||||
[false, \json_decode('{"tag_name":"v9.0.0"}')],
|
||||
[true, \json_decode('{"tag_name":"v' . Shell::VERSION . '"}')],
|
||||
[true, \json_decode('{"tag_name":"v0.0.1"}')],
|
||||
[true, \json_decode('{"tag_name":"v0.4.1-alpha"}')],
|
||||
[true, \json_decode('{"tag_name":"v0.4.2-beta3"}')],
|
||||
[true, \json_decode('{"tag_name":"v0.0.1"}')],
|
||||
[true, \json_decode('{"tag_name":""}')],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -71,12 +71,12 @@ class GitHubCheckerTest extends \PHPUnit\Framework\TestCase
|
||||
[null],
|
||||
[false],
|
||||
[true],
|
||||
[json_decode('{"foo":"bar"}')],
|
||||
[json_decode('{}')],
|
||||
[json_decode('[]')],
|
||||
[\json_decode('{"foo":"bar"}')],
|
||||
[\json_decode('{}')],
|
||||
[\json_decode('[]')],
|
||||
[[]],
|
||||
[json_decode('{"tag_name":false"}')],
|
||||
[json_decode('{"tag_name":true"}')],
|
||||
[\json_decode('{"tag_name":false"}')],
|
||||
[\json_decode('{"tag_name":true"}')],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
2
vendor/psy/psysh/test/fixtures/config.php
vendored
2
vendor/psy/psysh/test/fixtures/config.php
vendored
@@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
$config->setRuntimeDir(sys_get_temp_dir() . '/psysh_test/withconfig/temp');
|
||||
$config->setRuntimeDir(\sys_get_temp_dir() . '/psysh_test/withconfig/temp');
|
||||
|
||||
return [
|
||||
'useReadline' => true,
|
||||
|
||||
0
vendor/psy/psysh/test/tools/gen_unvis_fixtures.py
vendored
Normal file → Executable file
0
vendor/psy/psysh/test/tools/gen_unvis_fixtures.py
vendored
Normal file → Executable file
0
vendor/psy/psysh/test/tools/vis.py
vendored
Normal file → Executable file
0
vendor/psy/psysh/test/tools/vis.py
vendored
Normal file → Executable file
Reference in New Issue
Block a user