Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
42
vendor/psy/psysh/test/Exception/BreakExceptionTest.php
vendored
Normal file
42
vendor/psy/psysh/test/Exception/BreakExceptionTest.php
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2018 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy\Test\Exception;
|
||||
|
||||
use Psy\Exception\BreakException;
|
||||
|
||||
class BreakExceptionTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testInstance()
|
||||
{
|
||||
$e = new BreakException();
|
||||
|
||||
$this->assertInstanceOf('Psy\Exception\Exception', $e);
|
||||
$this->assertInstanceOf('Psy\Exception\BreakException', $e);
|
||||
}
|
||||
|
||||
public function testMessage()
|
||||
{
|
||||
$e = new BreakException('foo');
|
||||
|
||||
$this->assertContains('foo', $e->getMessage());
|
||||
$this->assertSame('foo', $e->getRawMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psy\Exception\BreakException
|
||||
* @expectedExceptionMessage Goodbye
|
||||
*/
|
||||
public function testExitShell()
|
||||
{
|
||||
BreakException::exitShell();
|
||||
}
|
||||
}
|
125
vendor/psy/psysh/test/Exception/ErrorExceptionTest.php
vendored
Normal file
125
vendor/psy/psysh/test/Exception/ErrorExceptionTest.php
vendored
Normal file
|
@ -0,0 +1,125 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2018 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy\Test\Exception;
|
||||
|
||||
use Psy\Exception\ErrorException;
|
||||
|
||||
class ErrorExceptionTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testInstance()
|
||||
{
|
||||
$e = new ErrorException();
|
||||
|
||||
$this->assertInstanceOf('Psy\Exception\Exception', $e);
|
||||
$this->assertInstanceOf('ErrorException', $e);
|
||||
$this->assertInstanceOf('Psy\Exception\ErrorException', $e);
|
||||
}
|
||||
|
||||
public function testMessage()
|
||||
{
|
||||
$e = new ErrorException('foo');
|
||||
|
||||
$this->assertContains('foo', $e->getMessage());
|
||||
$this->assertSame('foo', $e->getRawMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getLevels
|
||||
*/
|
||||
public function testErrorLevels($level, $type)
|
||||
{
|
||||
$e = new ErrorException('foo', 0, $level);
|
||||
$this->assertContains('PHP ' . $type, $e->getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getLevels
|
||||
*/
|
||||
public function testThrowException($level, $type)
|
||||
{
|
||||
try {
|
||||
ErrorException::throwException($level, '{whot}', '{file}', '13');
|
||||
} catch (ErrorException $e) {
|
||||
$this->assertContains('PHP ' . $type, $e->getMessage());
|
||||
$this->assertContains('{whot}', $e->getMessage());
|
||||
$this->assertContains('in {file}', $e->getMessage());
|
||||
$this->assertContains('on line 13', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function getLevels()
|
||||
{
|
||||
return [
|
||||
[E_WARNING, 'Warning'],
|
||||
[E_CORE_WARNING, 'Warning'],
|
||||
[E_COMPILE_WARNING, 'Warning'],
|
||||
[E_USER_WARNING, 'Warning'],
|
||||
[E_STRICT, 'Strict error'],
|
||||
[E_DEPRECATED, 'Deprecated'],
|
||||
[E_USER_DEPRECATED, 'Deprecated'],
|
||||
[E_RECOVERABLE_ERROR, 'Recoverable fatal error'],
|
||||
[0, 'Error'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getUserLevels
|
||||
*/
|
||||
public function testThrowExceptionAsErrorHandler($level, $type)
|
||||
{
|
||||
\set_error_handler(['Psy\Exception\ErrorException', 'throwException']);
|
||||
try {
|
||||
\trigger_error('{whot}', $level);
|
||||
} catch (ErrorException $e) {
|
||||
$this->assertContains('PHP ' . $type, $e->getMessage());
|
||||
$this->assertContains('{whot}', $e->getMessage());
|
||||
}
|
||||
\restore_error_handler();
|
||||
}
|
||||
|
||||
public function getUserLevels()
|
||||
{
|
||||
return [
|
||||
[E_USER_ERROR, 'Error'],
|
||||
[E_USER_WARNING, 'Warning'],
|
||||
[E_USER_NOTICE, 'Notice'],
|
||||
[E_USER_DEPRECATED, 'Deprecated'],
|
||||
];
|
||||
}
|
||||
|
||||
public function testIgnoreExecutionLoopFilename()
|
||||
{
|
||||
$e = new ErrorException('{{message}}', 0, 1, '/fake/path/to/Psy/ExecutionLoop.php');
|
||||
$this->assertEmpty($e->getFile());
|
||||
|
||||
$e = new ErrorException('{{message}}', 0, 1, 'c:\fake\path\to\Psy\ExecutionLoop.php');
|
||||
$this->assertEmpty($e->getFile());
|
||||
|
||||
$e = new ErrorException('{{message}}', 0, 1, '/fake/path/to/Psy/File.php');
|
||||
$this->assertNotEmpty($e->getFile());
|
||||
}
|
||||
|
||||
public function testFromError()
|
||||
{
|
||||
if (\version_compare(PHP_VERSION, '7.0.0', '<')) {
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
$error = new \Error('{{message}}', 0);
|
||||
$exception = ErrorException::fromError($error);
|
||||
|
||||
$this->assertContains('PHP Error: {{message}}', $exception->getMessage());
|
||||
$this->assertEquals(0, $exception->getCode());
|
||||
$this->assertEquals($error->getFile(), $exception->getFile());
|
||||
$this->assertSame($exception->getPrevious(), $error);
|
||||
}
|
||||
}
|
51
vendor/psy/psysh/test/Exception/FatalErrorExceptionTest.php
vendored
Normal file
51
vendor/psy/psysh/test/Exception/FatalErrorExceptionTest.php
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2018 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy\Test\Exception;
|
||||
|
||||
use Psy\Exception\FatalErrorException;
|
||||
|
||||
class FatalErrorExceptionTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testInstance()
|
||||
{
|
||||
$e = new FatalErrorException();
|
||||
|
||||
$this->assertInstanceOf('Psy\Exception\Exception', $e);
|
||||
$this->assertInstanceOf('ErrorException', $e);
|
||||
$this->assertInstanceOf('Psy\Exception\FatalErrorException', $e);
|
||||
}
|
||||
|
||||
public function testMessage()
|
||||
{
|
||||
$e = new FatalErrorException('{msg}', 0, 0, '{filename}', 13);
|
||||
|
||||
$this->assertSame('{msg}', $e->getRawMessage());
|
||||
$this->assertContains('{msg}', $e->getMessage());
|
||||
$this->assertContains('{filename}', $e->getMessage());
|
||||
$this->assertContains('line 13', $e->getMessage());
|
||||
}
|
||||
|
||||
public function testMessageWithNoFilename()
|
||||
{
|
||||
$e = new FatalErrorException('{msg}');
|
||||
|
||||
$this->assertSame('{msg}', $e->getRawMessage());
|
||||
$this->assertContains('{msg}', $e->getMessage());
|
||||
$this->assertContains('eval()\'d code', $e->getMessage());
|
||||
}
|
||||
|
||||
public function testNegativeOneLineNumberIgnored()
|
||||
{
|
||||
$e = new FatalErrorException('{msg}', 0, 1, null, -1);
|
||||
$this->assertEquals(0, $e->getLine());
|
||||
}
|
||||
}
|
42
vendor/psy/psysh/test/Exception/ParseErrorExceptionTest.php
vendored
Normal file
42
vendor/psy/psysh/test/Exception/ParseErrorExceptionTest.php
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2018 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy\Test\Exception;
|
||||
|
||||
use Psy\Exception\ParseErrorException;
|
||||
|
||||
class ParseErrorExceptionTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testInstance()
|
||||
{
|
||||
$e = new ParseErrorException();
|
||||
|
||||
$this->assertInstanceOf('Psy\Exception\Exception', $e);
|
||||
$this->assertInstanceOf('PhpParser\Error', $e);
|
||||
$this->assertInstanceOf('Psy\Exception\ParseErrorException', $e);
|
||||
}
|
||||
|
||||
public function testMessage()
|
||||
{
|
||||
$e = new ParseErrorException('{msg}', 1);
|
||||
|
||||
$this->assertContains('{msg}', $e->getMessage());
|
||||
$this->assertContains('PHP Parse error:', $e->getMessage());
|
||||
}
|
||||
|
||||
public function testConstructFromParseError()
|
||||
{
|
||||
$e = ParseErrorException::fromParseError(new \PhpParser\Error('{msg}'));
|
||||
|
||||
$this->assertContains('{msg}', $e->getRawMessage());
|
||||
$this->assertContains('PHP Parse error:', $e->getMessage());
|
||||
}
|
||||
}
|
30
vendor/psy/psysh/test/Exception/RuntimeExceptionTest.php
vendored
Normal file
30
vendor/psy/psysh/test/Exception/RuntimeExceptionTest.php
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2018 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy\Test\Exception;
|
||||
|
||||
use Psy\Exception\RuntimeException;
|
||||
|
||||
class RuntimeExceptionTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testException()
|
||||
{
|
||||
$msg = 'bananas';
|
||||
$e = new RuntimeException($msg);
|
||||
|
||||
$this->assertInstanceOf('Psy\Exception\Exception', $e);
|
||||
$this->assertInstanceOf('RuntimeException', $e);
|
||||
$this->assertInstanceOf('Psy\Exception\RuntimeException', $e);
|
||||
|
||||
$this->assertSame($msg, $e->getMessage());
|
||||
$this->assertSame($msg, $e->getRawMessage());
|
||||
}
|
||||
}
|
66
vendor/psy/psysh/test/Exception/ThrowUpExceptionTest.php
vendored
Normal file
66
vendor/psy/psysh/test/Exception/ThrowUpExceptionTest.php
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2018 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy\Test\Exception;
|
||||
|
||||
use Psy\Exception\ThrowUpException;
|
||||
|
||||
class ThrowUpExceptionTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testException()
|
||||
{
|
||||
$previous = new \Exception('{{message}}', 123);
|
||||
$e = new ThrowUpException($previous);
|
||||
|
||||
$this->assertInstanceOf('Psy\Exception\Exception', $e);
|
||||
$this->assertInstanceOf('Psy\Exception\ThrowUpException', $e);
|
||||
|
||||
$this->assertEquals("Throwing Exception with message '{{message}}'", $e->getMessage());
|
||||
$this->assertEquals('{{message}}', $e->getRawMessage());
|
||||
$this->assertEquals(123, $e->getCode());
|
||||
$this->assertSame($previous, $e->getPrevious());
|
||||
}
|
||||
|
||||
public function testFromThrowable()
|
||||
{
|
||||
$previous = new \Exception('{{message}}');
|
||||
$e = ThrowUpException::fromThrowable($previous);
|
||||
|
||||
$this->assertInstanceOf('Psy\Exception\ThrowUpException', $e);
|
||||
$this->assertSame($previous, $e->getPrevious());
|
||||
}
|
||||
|
||||
public function testFromThrowableWithError()
|
||||
{
|
||||
if (\version_compare(PHP_VERSION, '7.0.0', '<')) {
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
$previous = new \Error('{{message}}');
|
||||
$e = ThrowUpException::fromThrowable($previous);
|
||||
|
||||
$this->assertInstanceOf('Psy\Exception\ThrowUpException', $e);
|
||||
$this->assertInstanceOf('Psy\Exception\ErrorException', $e->getPrevious());
|
||||
|
||||
$this->assertNotSame($previous, $e->getPrevious());
|
||||
$this->assertSame($previous, $e->getPrevious()->getPrevious());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage throw-up can only throw Exceptions and Errors
|
||||
*/
|
||||
public function testFromThrowableThrowsError()
|
||||
{
|
||||
$notThrowable = new \StdClass();
|
||||
ThrowUpException::fromThrowable($notThrowable);
|
||||
}
|
||||
}
|
52
vendor/psy/psysh/test/Exception/TypeErrorExceptionTest.php
vendored
Normal file
52
vendor/psy/psysh/test/Exception/TypeErrorExceptionTest.php
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2018 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy\Test\Exception;
|
||||
|
||||
use Psy\Exception\TypeErrorException;
|
||||
|
||||
class TypeErrorExceptionTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testException()
|
||||
{
|
||||
$e = new TypeErrorException('{{message}}', 13);
|
||||
|
||||
$this->assertInstanceOf('Psy\Exception\Exception', $e);
|
||||
$this->assertInstanceOf('Psy\Exception\TypeErrorException', $e);
|
||||
|
||||
$this->assertEquals('TypeError: {{message}}', $e->getMessage());
|
||||
$this->assertEquals('{{message}}', $e->getRawMessage());
|
||||
$this->assertEquals(13, $e->getCode());
|
||||
}
|
||||
|
||||
public function testStripsEvalFromMessage()
|
||||
{
|
||||
$message = 'Something or other, called in line 10: eval()\'d code';
|
||||
$e = new TypeErrorException($message);
|
||||
$this->assertEquals($message, $e->getRawMessage());
|
||||
$this->assertEquals('TypeError: Something or other', $e->getMessage());
|
||||
}
|
||||
|
||||
public function testFromTypeError()
|
||||
{
|
||||
if (\version_compare(PHP_VERSION, '7.0.0', '<')) {
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
$previous = new \TypeError('{{message}}', 13);
|
||||
$e = TypeErrorException::fromTypeError($previous);
|
||||
|
||||
$this->assertInstanceOf('Psy\Exception\TypeErrorException', $e);
|
||||
$this->assertEquals('TypeError: {{message}}', $e->getMessage());
|
||||
$this->assertEquals('{{message}}', $e->getRawMessage());
|
||||
$this->assertEquals(13, $e->getCode());
|
||||
}
|
||||
}
|
Reference in a new issue