composeer update
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
trait TraitWithConstructor
|
||||
{
|
||||
private $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function value(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
--TEST--
|
||||
GH-2591: Test class process isolation with preserving global state and with loaded bootstrap, without global string.
|
||||
Expected result is to have an error in first test, and then have variable set in second test to be visible in third.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--bootstrap';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/2591/bootstrapWithBootstrapNoGlobal.php';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/2591/SeparateClassPreserveTest.php';
|
||||
|
||||
require __DIR__ . '/../../../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
E.E 3 / 3 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There were 2 errors:
|
||||
|
||||
1) Issue2591_SeparateClassPreserveTest::testOriginalGlobalString
|
||||
Undefined index: globalString
|
||||
|
||||
%sSeparateClassPreserveTest.php:%d
|
||||
|
||||
2) Issue2591_SeparateClassPreserveTest::testGlobalString
|
||||
Undefined index: globalString
|
||||
|
||||
%sSeparateClassPreserveTest.php:%s
|
||||
|
||||
ERRORS!
|
||||
Tests: 3, Assertions: 1, Errors: 2.
|
||||
|
||||
Vendored
-21
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
GH-2591: Test class process isolation with preserving global state and with loaded bootstrap.
|
||||
Expected result is to have a global variable modified in first test to be the same in the second.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--bootstrap';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/2591/bootstrapWithBootstrap.php';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/2591/SeparateClassPreserveTest.php';
|
||||
|
||||
require __DIR__ . '/../../../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
... 3 / 3 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (3 tests, 3 assertions)
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
--TEST--
|
||||
GH-2591: Test method process isolation without preserving global state and without loaded bootstrap.
|
||||
Expected result is to have an error, because of no classes loaded.
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (extension_loaded('xdebug')) {
|
||||
print 'skip: xdebug loaded';
|
||||
} elseif (version_compare(PHP_VERSION, '7.3.0-dev', '<')) {
|
||||
print 'skip: PHP 7.3 required';
|
||||
}
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--bootstrap';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/2591/bootstrapNoBootstrap.php';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/2591/SeparateFunctionNoPreserveTest.php';
|
||||
|
||||
require __DIR__ . '/../../../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
EE 2 / 2 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There were 2 errors:
|
||||
|
||||
1) Issue2591_SeparateFunctionNoPreserveTest::testChangedGlobalString
|
||||
PHPUnit\Framework\Exception: %sUncaught Error%sin %s
|
||||
%a
|
||||
2) Issue2591_SeparateFunctionNoPreserveTest::testGlobalString
|
||||
PHPUnit\Framework\Exception: %sUncaught Error%sin %s
|
||||
%a
|
||||
ERRORS!
|
||||
Tests: 2, Assertions: 0, Errors: 2.
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
GH-2591: Test method process isolation without preserving global state and without loaded bootstrap.
|
||||
Expected result is to have an error, because of no classes loaded.
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('xdebug')) {
|
||||
print 'skip: xdebug not loaded';
|
||||
} elseif (version_compare(PHP_VERSION, '7.3.0-dev', '>=')) {
|
||||
print 'skip: PHP < 7.3 required';
|
||||
}
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--bootstrap';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/2591/bootstrapNoBootstrap.php';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/2591/SeparateFunctionNoPreserveTest.php';
|
||||
|
||||
require __DIR__ . '/../../../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
EE 2 / 2 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There were 2 errors:
|
||||
|
||||
1) Issue2591_SeparateFunctionNoPreserveTest::testChangedGlobalString
|
||||
PHPUnit\Framework\Exception:%sPHP Fatal error: Class 'PHPUnit\Framework\TestCase' not found %s
|
||||
%SPHP Stack trace:%S
|
||||
%a
|
||||
2) Issue2591_SeparateFunctionNoPreserveTest::testGlobalString
|
||||
PHPUnit\Framework\Exception:%sPHP Fatal error: Class 'PHPUnit\Framework\TestCase' not found %s
|
||||
%SPHP Stack trace:%S
|
||||
%a
|
||||
ERRORS!
|
||||
Tests: 2, Assertions: 0, Errors: 2.
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
--TEST--
|
||||
GH-2591: Test method process isolation without preserving global state and without loaded bootstrap.
|
||||
Expected result is to have an error, because of no classes loaded.
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (extension_loaded('xdebug')) {
|
||||
print 'skip: xdebug loaded';
|
||||
} elseif (version_compare(PHP_VERSION, '7.3.0-dev', '>=')) {
|
||||
print 'skip: PHP < 7.3 required';
|
||||
}
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--bootstrap';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/2591/bootstrapNoBootstrap.php';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/2591/SeparateFunctionNoPreserveTest.php';
|
||||
|
||||
require __DIR__ . '/../../../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
EE 2 / 2 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There were 2 errors:
|
||||
|
||||
1) Issue2591_SeparateFunctionNoPreserveTest::testChangedGlobalString
|
||||
PHPUnit\Framework\Exception:%sPHP Fatal error: Class 'PHPUnit\Framework\TestCase' not found %s
|
||||
%A
|
||||
2) Issue2591_SeparateFunctionNoPreserveTest::testGlobalString
|
||||
PHPUnit\Framework\Exception:%sPHP Fatal error: Class 'PHPUnit\Framework\TestCase' not found %s
|
||||
%A
|
||||
ERRORS!
|
||||
Tests: 2, Assertions: 0, Errors: 2.
|
||||
Vendored
-20
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
GH-2591: Test method process isolation without preserving global state and with loaded bootstrap.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--bootstrap';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/2591/bootstrapWithBootstrap.php';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/2591/SeparateFunctionNoPreserveTest.php';
|
||||
|
||||
require __DIR__ . '/../../../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
.. 2 / 2 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (2 tests, 2 assertions)
|
||||
Vendored
-20
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
GH-2591: Test method process isolation with preserving global state and with loaded bootstrap.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--bootstrap';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/2591/bootstrapWithBootstrap.php';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/2591/SeparateFunctionPreserveTest.php';
|
||||
|
||||
require __DIR__ . '/../../../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
.. 2 / 2 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (2 tests, 2 assertions)
|
||||
Vendored
-35
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @runClassInSeparateProcess
|
||||
* @preserveGlobalState enabled
|
||||
*/
|
||||
class Issue2591_SeparateClassPreserveTest extends TestCase
|
||||
{
|
||||
public function testOriginalGlobalString(): void
|
||||
{
|
||||
$this->assertEquals('Hello', $GLOBALS['globalString']);
|
||||
}
|
||||
|
||||
public function testChangedGlobalString(): void
|
||||
{
|
||||
$value = 'Hello! I am changed from inside!';
|
||||
|
||||
$GLOBALS['globalString'] = $value;
|
||||
$this->assertEquals($value, $GLOBALS['globalString']);
|
||||
}
|
||||
|
||||
public function testGlobalString(): void
|
||||
{
|
||||
$this->assertEquals('Hello', $GLOBALS['globalString']);
|
||||
}
|
||||
}
|
||||
Vendored
-28
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
class Issue2591_SeparateFunctionNoPreserveTest extends TestCase
|
||||
{
|
||||
public function testChangedGlobalString(): void
|
||||
{
|
||||
$GLOBALS['globalString'] = 'Hello!';
|
||||
$this->assertEquals('Hello!', $GLOBALS['globalString']);
|
||||
}
|
||||
|
||||
public function testGlobalString(): void
|
||||
{
|
||||
$this->assertEquals('Hello', $GLOBALS['globalString']);
|
||||
}
|
||||
}
|
||||
Vendored
-28
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState enabled
|
||||
*/
|
||||
class Issue2591_SeparateFunctionPreserveTest extends TestCase
|
||||
{
|
||||
public function testChangedGlobalString(): void
|
||||
{
|
||||
$GLOBALS['globalString'] = 'Hello!';
|
||||
$this->assertEquals('Hello!', $GLOBALS['globalString']);
|
||||
}
|
||||
|
||||
public function testGlobalString(): void
|
||||
{
|
||||
$this->assertEquals('Hello', $GLOBALS['globalString']);
|
||||
}
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
\ini_set('display_errors', 0);
|
||||
\ini_set('log_errors', 1);
|
||||
|
||||
$globalString = 'Hello';
|
||||
|
||||
// require __DIR__ . '/../../../../bootstrap.php';
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
$globalString = 'Hello';
|
||||
|
||||
require __DIR__ . '/../../../../bootstrap.php';
|
||||
Vendored
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/../../../../bootstrap.php';
|
||||
@@ -1110,13 +1110,20 @@ class MockObjectTest extends TestCase
|
||||
$this->assertInstanceOf(stdClass::class, $stub->methodWithObjectReturnTypeDeclaration());
|
||||
}
|
||||
|
||||
public function testGetObjectForTrait(): void
|
||||
public function testTraitCanBeDoubled(): void
|
||||
{
|
||||
$object = $this->getObjectForTrait(ExampleTrait::class);
|
||||
|
||||
$this->assertSame('ohHai', $object->ohHai());
|
||||
}
|
||||
|
||||
public function testTraitWithConstructorCanBeDoubled(): void
|
||||
{
|
||||
$object = $this->getObjectForTrait(TraitWithConstructor::class, ['value']);
|
||||
|
||||
$this->assertSame('value', $object->value());
|
||||
}
|
||||
|
||||
private function resetMockObjects(): void
|
||||
{
|
||||
$refl = new ReflectionObject($this);
|
||||
|
||||
Reference in New Issue
Block a user