composeer update

This commit is contained in:
2019-06-23 11:49:01 +00:00
parent fc2380d68c
commit e9efe70112
327 changed files with 5194 additions and 2278 deletions

View File

@@ -0,0 +1 @@
patreon: s_bergmann

View File

@@ -6,8 +6,6 @@ php:
- 7.3
- 7.4snapshot
sudo: false
before_install:
- composer self-update
- composer clear-cache

View File

@@ -2,6 +2,12 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [2.1.2] - 2019-06-07
### Fixed
* Fixed [#21](https://github.com/sebastianbergmann/php-timer/pull/3352): Formatting of memory consumption does not work on 32bit systems
## [2.1.1] - 2019-02-20
### Changed
@@ -24,6 +30,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* This component is no longer supported on PHP 5.3, PHP 5.4, PHP 5.5, PHP 5.6, and PHP 7.0
[2.1.2]: https://github.com/sebastianbergmann/diff/compare/2.1.1...2.1.2
[2.1.1]: https://github.com/sebastianbergmann/diff/compare/2.1.0...2.1.1
[2.1.0]: https://github.com/sebastianbergmann/diff/compare/2.0.0...2.1.0
[2.0.0]: https://github.com/sebastianbergmann/diff/compare/1.0.9...2.0.0

View File

@@ -44,17 +44,15 @@ final class Timer
return \microtime(true) - \array_pop(self::$startTimes);
}
public static function bytesToString(int $bytes): string
public static function bytesToString(float $bytes): string
{
foreach (self::$sizes as $unit => $value) {
if ($bytes >= $value) {
$size = \sprintf('%.2f', $bytes >= 1024 ? $bytes / $value : $bytes);
return $size . ' ' . $unit;
return \sprintf('%.2f %s', $bytes >= 1024 ? $bytes / $value : $bytes, $unit);
}
}
return $bytes . ' byte' . ($bytes !== 1 ? 's' : '');
return $bytes . ' byte' . ((int) $bytes !== 1 ? 's' : '');
}
public static function secondsToTimeString(float $time): string

View File

@@ -112,7 +112,7 @@ final class TimerTest extends TestCase
/**
* @dataProvider bytesProvider
*/
public function testCanFormatBytesAsString(string $string, int $bytes): void
public function testCanFormatBytesAsString(string $string, float $bytes): void
{
$this->assertEquals($string, Timer::bytesToString($bytes));
}

View File

@@ -2,6 +2,13 @@
All notable changes of the PHPUnit 7.5 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [7.5.13] - 2019-06-19
### Fixed
* Fixed [#3722](https://github.com/sebastianbergmann/phpunit/issues/3722): `getObjectForTrait()` does not work for traits that declare a constructor
* Fixed [#3723](https://github.com/sebastianbergmann/phpunit/pull/3723): Unescaped dash in character group in regular expression
## [7.5.12] - 2019-05-28
### Changed
@@ -119,6 +126,7 @@ All notable changes of the PHPUnit 7.5 release series are documented in this fil
* Fixed [#3429](https://github.com/sebastianbergmann/phpunit/pull/3429): Inefficient loop in `getHookMethods()`
* Fixed [#3437](https://github.com/sebastianbergmann/phpunit/pull/3437): JUnit logger skips PHPT tests
[7.5.13]: https://github.com/sebastianbergmann/phpunit/compare/7.5.12...7.5.13
[7.5.12]: https://github.com/sebastianbergmann/phpunit/compare/7.5.11...7.5.12
[7.5.11]: https://github.com/sebastianbergmann/phpunit/compare/7.5.10...7.5.11
[7.5.10]: https://github.com/sebastianbergmann/phpunit/compare/7.5.9...7.5.10

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpab" version="^1.25" installed="1.25.6" location="./tools/phpab" copy="true"/>
<phar name="php-cs-fixer" version="^2.14" installed="2.15.0" location="./tools/php-cs-fixer" copy="true"/>
<phar name="php-cs-fixer" version="^2.14" installed="2.15.1" location="./tools/php-cs-fixer" copy="true"/>
<phar name="phpdox" version="^0.11" installed="0.12.0" location="./tools/phpdox" copy="true"/>
<phar name="phploc" version="^4.0" installed="4.0.1" location="./tools/phploc" copy="true"/>
</phive>

View File

@@ -374,7 +374,14 @@ class Generator
]
);
return $this->getObject($classTemplate->render(), $className['className']);
return $this->getObject(
$classTemplate->render(),
$className['className'],
'',
$callOriginalConstructor,
$callAutoload,
$arguments
);
}
/**

View File

@@ -30,7 +30,7 @@ class Version
}
if (self::$version === null) {
$version = new VersionId('7.5.12', \dirname(__DIR__, 2));
$version = new VersionId('7.5.13', \dirname(__DIR__, 2));
self::$version = $version->getVersion();
}

View File

@@ -73,7 +73,7 @@ final class Test
/**
* @var string
*/
private const REGEX_REQUIRES_VERSION_CONSTRAINT = '/@requires\s+(?P<name>PHP(?:Unit)?)\s+(?P<constraint>[\d\t -.|~^]+)[ \t]*\r?$/m';
private const REGEX_REQUIRES_VERSION_CONSTRAINT = '/@requires\s+(?P<name>PHP(?:Unit)?)\s+(?P<constraint>[\d\t \-.|~^]+)[ \t]*\r?$/m';
/**
* @var string

View File

@@ -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;
}
}

View File

@@ -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.

View File

@@ -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)

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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)

View File

@@ -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)

View File

@@ -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']);
}
}

View File

@@ -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']);
}
}

View File

@@ -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']);
}
}

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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);