File manager - Edit - /home/autoph/public_html/projects/Rating-AutoHub/public/css/phpunit.zip
Back
PK ��Z4;= DF DF phpunit/phpunit.xsdnu �[��� <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:annotation> <xs:documentation source="https://phpunit.de/documentation.html"> This Schema file defines the rules by which the XML configuration file of PHPUnit 9.6 may be structured. </xs:documentation> <xs:appinfo source="https://phpunit.de/documentation.html"/> </xs:annotation> <xs:element name="phpunit" type="phpUnitType"> <xs:annotation> <xs:documentation>Root Element</xs:documentation> </xs:annotation> </xs:element> <xs:complexType name="coverageType"> <xs:all> <xs:element name="include" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:group ref="pathGroup"/> </xs:complexType> </xs:element> <xs:element name="exclude" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:group ref="pathGroup"/> </xs:complexType> </xs:element> <xs:element name="report" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:group ref="coverageReportGroup"/> </xs:complexType> </xs:element> </xs:all> <xs:attribute name="cacheDirectory" type="xs:anyURI"/> <xs:attribute name="pathCoverage" type="xs:boolean" default="false"/> <xs:attribute name="includeUncoveredFiles" type="xs:boolean" default="true"/> <xs:attribute name="processUncoveredFiles" type="xs:boolean" default="false"/> <xs:attribute name="ignoreDeprecatedCodeUnits" type="xs:boolean" default="false"/> <xs:attribute name="disableCodeCoverageIgnore" type="xs:boolean" default="false"/> </xs:complexType> <xs:complexType name="loggingType"> <xs:group ref="loggingGroup"/> </xs:complexType> <xs:complexType name="groupsType"> <xs:choice> <xs:sequence> <xs:element name="include" type="groupType"/> <xs:element name="exclude" type="groupType" minOccurs="0"/> </xs:sequence> <xs:sequence> <xs:element name="exclude" type="groupType"/> </xs:sequence> </xs:choice> </xs:complexType> <xs:complexType name="groupType"> <xs:sequence> <xs:element name="group" type="xs:string" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:complexType name="extensionsType"> <xs:sequence> <xs:element name="extension" type="objectType" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:complexType name="listenersType"> <xs:sequence> <xs:element name="listener" type="objectType" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:complexType name="objectType"> <xs:sequence> <xs:element name="arguments" minOccurs="0"> <xs:complexType> <xs:group ref="argumentsGroup"/> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="class" type="xs:string" use="required"/> <xs:attribute name="file" type="xs:anyURI"/> </xs:complexType> <xs:complexType name="arrayType"> <xs:sequence> <xs:element name="element" type="argumentType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:complexType name="argumentType"> <xs:group ref="argumentChoice"/> <xs:attribute name="key" use="required"/> </xs:complexType> <xs:group name="argumentsGroup"> <xs:sequence> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="array" type="arrayType" /> <xs:element name="integer" type="xs:integer" /> <xs:element name="string" type="xs:string" /> <xs:element name="double" type="xs:double" /> <xs:element name="null" /> <xs:element name="object" type="objectType" /> <xs:element name="file" type="xs:anyURI" /> <xs:element name="directory" type="xs:anyURI" /> <xs:element name="boolean" type="xs:boolean" /> </xs:choice> </xs:sequence> </xs:group> <xs:group name="argumentChoice"> <xs:choice> <xs:element name="array" type="arrayType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="integer" type="xs:integer" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="string" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="double" type="xs:double" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="null" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="object" type="objectType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="file" type="xs:anyURI" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="directory" type="xs:anyURI" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="boolean" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/> </xs:choice> </xs:group> <xs:simpleType name="columnsType"> <xs:union> <xs:simpleType> <xs:restriction base="xs:integer"/> </xs:simpleType> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="max"/> </xs:restriction> </xs:simpleType> </xs:union> </xs:simpleType> <xs:group name="pathGroup"> <xs:sequence> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="directory" type="directoryFilterType"/> <xs:element name="file" type="fileFilterType"/> </xs:choice> </xs:sequence> </xs:group> <xs:complexType name="directoryFilterType"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute type="xs:string" name="prefix" default=""/> <xs:attribute type="xs:string" name="suffix" default="Test.php"/> <xs:attributeGroup ref="phpVersionGroup"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:simpleType name="executionOrderType"> <xs:restriction base="xs:string"> <xs:enumeration value="default"/> <xs:enumeration value="defects"/> <xs:enumeration value="depends"/> <xs:enumeration value="depends,defects"/> <xs:enumeration value="depends,duration"/> <xs:enumeration value="depends,random"/> <xs:enumeration value="depends,reverse"/> <xs:enumeration value="depends,size"/> <xs:enumeration value="duration"/> <xs:enumeration value="no-depends"/> <xs:enumeration value="no-depends,defects"/> <xs:enumeration value="no-depends,duration"/> <xs:enumeration value="no-depends,random"/> <xs:enumeration value="no-depends,reverse"/> <xs:enumeration value="no-depends,size"/> <xs:enumeration value="random"/> <xs:enumeration value="reverse"/> <xs:enumeration value="size"/> </xs:restriction> </xs:simpleType> <xs:complexType name="fileFilterType"> <xs:simpleContent> <xs:extension base="xs:anyURI"> <xs:attributeGroup ref="phpVersionGroup"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:attributeGroup name="phpVersionGroup"> <xs:attribute name="phpVersion" type="xs:string" default="5.3.0"/> <xs:attribute name="phpVersionOperator" type="xs:string" default=">="/> </xs:attributeGroup> <xs:complexType name="phpType"> <xs:sequence> <xs:choice maxOccurs="unbounded"> <xs:element name="includePath" type="xs:anyURI" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="ini" type="namedValueType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="const" type="namedValueType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="var" type="namedValueType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="env" type="namedValueType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="post" type="namedValueType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="get" type="namedValueType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="cookie" type="namedValueType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="server" type="namedValueType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="files" type="namedValueType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="request" type="namedValueType" minOccurs="0" maxOccurs="unbounded"/> </xs:choice> </xs:sequence> </xs:complexType> <xs:complexType name="namedValueType"> <xs:attribute name="name" use="required" type="xs:string"/> <xs:attribute name="value" use="required" type="xs:anySimpleType"/> <xs:attribute name="verbatim" use="optional" type="xs:boolean"/> <xs:attribute name="force" use="optional" type="xs:boolean"/> </xs:complexType> <xs:complexType name="phpUnitType"> <xs:annotation> <xs:documentation>The main type specifying the document structure</xs:documentation> </xs:annotation> <xs:group ref="configGroup"/> <xs:attributeGroup ref="configAttributeGroup"/> </xs:complexType> <xs:attributeGroup name="configAttributeGroup"> <xs:attribute name="backupGlobals" type="xs:boolean" default="false"/> <xs:attribute name="backupStaticAttributes" type="xs:boolean" default="false"/> <xs:attribute name="bootstrap" type="xs:anyURI"/> <xs:attribute name="cacheResult" type="xs:boolean" default="true"/> <xs:attribute name="cacheResultFile" type="xs:anyURI"/> <xs:attribute name="colors" type="xs:boolean" default="false"/> <xs:attribute name="columns" type="columnsType" default="80"/> <xs:attribute name="convertDeprecationsToExceptions" type="xs:boolean" default="false"/> <xs:attribute name="convertErrorsToExceptions" type="xs:boolean" default="true"/> <xs:attribute name="convertNoticesToExceptions" type="xs:boolean" default="true"/> <xs:attribute name="convertWarningsToExceptions" type="xs:boolean" default="true"/> <xs:attribute name="forceCoversAnnotation" type="xs:boolean" default="false"/> <xs:attribute name="printerClass" type="xs:string" default="PHPUnit\TextUI\DefaultResultPrinter"/> <xs:attribute name="printerFile" type="xs:anyURI"/> <xs:attribute name="processIsolation" type="xs:boolean" default="false"/> <xs:attribute name="stopOnDefect" type="xs:boolean" default="false"/> <xs:attribute name="stopOnError" type="xs:boolean" default="false"/> <xs:attribute name="stopOnFailure" type="xs:boolean" default="false"/> <xs:attribute name="stopOnWarning" type="xs:boolean" default="false"/> <xs:attribute name="stopOnIncomplete" type="xs:boolean" default="false"/> <xs:attribute name="stopOnRisky" type="xs:boolean" default="false"/> <xs:attribute name="stopOnSkipped" type="xs:boolean" default="false"/> <xs:attribute name="failOnEmptyTestSuite" type="xs:boolean" default="false"/> <xs:attribute name="failOnIncomplete" type="xs:boolean" default="false"/> <xs:attribute name="failOnRisky" type="xs:boolean" default="false"/> <xs:attribute name="failOnSkipped" type="xs:boolean" default="false"/> <xs:attribute name="failOnWarning" type="xs:boolean" default="false"/> <xs:attribute name="beStrictAboutChangesToGlobalState" type="xs:boolean" default="false"/> <xs:attribute name="beStrictAboutOutputDuringTests" type="xs:boolean" default="false"/> <xs:attribute name="beStrictAboutResourceUsageDuringSmallTests" type="xs:boolean" default="false"/> <xs:attribute name="beStrictAboutTestsThatDoNotTestAnything" type="xs:boolean" default="true"/> <xs:attribute name="beStrictAboutTodoAnnotatedTests" type="xs:boolean" default="false"/> <xs:attribute name="beStrictAboutCoversAnnotation" type="xs:boolean" default="false"/> <xs:attribute name="defaultTimeLimit" type="xs:integer" default="0"/> <xs:attribute name="enforceTimeLimit" type="xs:boolean" default="false"/> <xs:attribute name="timeoutForSmallTests" type="xs:integer" default="1"/> <xs:attribute name="timeoutForMediumTests" type="xs:integer" default="10"/> <xs:attribute name="timeoutForLargeTests" type="xs:integer" default="60"/> <xs:attribute name="testSuiteLoaderClass" type="xs:string" default="PHPUnit\Runner\StandardTestSuiteLoader"/> <xs:attribute name="testSuiteLoaderFile" type="xs:anyURI"/> <xs:attribute name="defaultTestSuite" type="xs:string" default=""/> <xs:attribute name="verbose" type="xs:boolean" default="false"/> <xs:attribute name="testdox" type="xs:boolean" default="false"/> <xs:attribute name="stderr" type="xs:boolean" default="false"/> <xs:attribute name="reverseDefectList" type="xs:boolean" default="false"/> <xs:attribute name="registerMockObjectsFromTestArgumentsRecursively" type="xs:boolean" default="false"/> <xs:attribute name="extensionsDirectory" type="xs:anyURI"/> <xs:attribute name="executionOrder" type="executionOrderType" default="default"/> <xs:attribute name="resolveDependencies" type="xs:boolean" default="true"/> <xs:attribute name="noInteraction" type="xs:boolean" default="false"/> </xs:attributeGroup> <xs:group name="configGroup"> <xs:all> <xs:element ref="testSuiteFacet" minOccurs="0"/> <xs:element name="groups" type="groupsType" minOccurs="0"/> <xs:element name="testdoxGroups" type="groupsType" minOccurs="0"/> <xs:element name="coverage" type="coverageType" minOccurs="0"/> <xs:element name="logging" type="loggingType" minOccurs="0"/> <xs:element name="extensions" type="extensionsType" minOccurs="0"/> <xs:element name="listeners" type="listenersType" minOccurs="0"/> <xs:element name="php" type="phpType" minOccurs="0"/> </xs:all> </xs:group> <xs:element name="testSuiteFacet" abstract="true"/> <xs:element name="testsuite" type="testSuiteType" substitutionGroup="testSuiteFacet"/> <xs:element name="testsuites" type="testSuitesType" substitutionGroup="testSuiteFacet"/> <xs:complexType name="testSuitesType"> <xs:sequence> <xs:element name="testsuite" type="testSuiteType" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:complexType name="testSuiteType"> <xs:sequence> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:group ref="pathGroup"/> <xs:element name="exclude" type="xs:string"/> </xs:choice> </xs:sequence> <xs:attribute name="name" type="xs:string" use="required"/> </xs:complexType> <xs:group name="coverageReportGroup"> <xs:all> <xs:element name="clover" type="logToFileType" minOccurs="0"/> <xs:element name="cobertura" type="logToFileType" minOccurs="0"/> <xs:element name="crap4j" type="coverageReportCrap4JType" minOccurs="0" /> <xs:element name="html" type="coverageReportHtmlType" minOccurs="0" /> <xs:element name="php" type="logToFileType" minOccurs="0" /> <xs:element name="text" type="coverageReportTextType" minOccurs="0" /> <xs:element name="xml" type="logToDirectoryType" minOccurs="0" /> </xs:all> </xs:group> <xs:group name="loggingGroup"> <xs:all> <xs:element name="junit" type="logToFileType" minOccurs="0" /> <xs:element name="teamcity" type="logToFileType" minOccurs="0" /> <xs:element name="testdoxHtml" type="logToFileType" minOccurs="0" /> <xs:element name="testdoxText" type="logToFileType" minOccurs="0" /> <xs:element name="testdoxXml" type="logToFileType" minOccurs="0" /> <xs:element name="text" type="logToFileType" minOccurs="0"/> </xs:all> </xs:group> <xs:complexType name="logToFileType"> <xs:attribute name="outputFile" type="xs:anyURI" use="required"/> </xs:complexType> <xs:complexType name="logToDirectoryType"> <xs:attribute name="outputDirectory" type="xs:anyURI" use="required"/> </xs:complexType> <xs:complexType name="coverageReportCrap4JType"> <xs:attribute name="outputFile" type="xs:anyURI" use="required"/> <xs:attribute name="threshold" type="xs:integer"/> </xs:complexType> <xs:complexType name="coverageReportHtmlType"> <xs:attribute name="outputDirectory" type="xs:anyURI" use="required"/> <xs:attribute name="lowUpperBound" type="xs:integer" default="50"/> <xs:attribute name="highLowerBound" type="xs:integer" default="90"/> </xs:complexType> <xs:complexType name="coverageReportTextType"> <xs:attribute name="outputFile" type="xs:anyURI" use="required"/> <xs:attribute name="showUncoveredFiles" type="xs:boolean" default="false"/> <xs:attribute name="showOnlySummary" type="xs:boolean" default="false"/> </xs:complexType> </xs:schema> PK ��Z���& & phpunit/phpunitnu �[��� #!/usr/bin/env php <?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. */ if (!version_compare(PHP_VERSION, PHP_VERSION, '=')) { fwrite( STDERR, sprintf( '%s declares an invalid value for PHP_VERSION.' . PHP_EOL . 'This breaks fundamental functionality such as version_compare().' . PHP_EOL . 'Please use a different PHP interpreter.' . PHP_EOL, PHP_BINARY ) ); die(1); } if (version_compare('7.3.0', PHP_VERSION, '>')) { fwrite( STDERR, sprintf( 'This version of PHPUnit requires PHP >= 7.3.' . PHP_EOL . 'You are using PHP %s (%s).' . PHP_EOL, PHP_VERSION, PHP_BINARY ) ); die(1); } foreach (['dom', 'json', 'libxml', 'mbstring', 'tokenizer', 'xml', 'xmlwriter'] as $extension) { if (extension_loaded($extension)) { continue; } fwrite( STDERR, sprintf( 'PHPUnit requires the "%s" extension.' . PHP_EOL, $extension ) ); die(1); } if (!ini_get('date.timezone')) { ini_set('date.timezone', 'UTC'); } if (isset($GLOBALS['_composer_autoload_path'])) { define('PHPUNIT_COMPOSER_INSTALL', $GLOBALS['_composer_autoload_path']); unset($GLOBALS['_composer_autoload_path']); } else { foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) { if (file_exists($file)) { define('PHPUNIT_COMPOSER_INSTALL', $file); break; } } unset($file); } if (!defined('PHPUNIT_COMPOSER_INSTALL')) { fwrite( STDERR, 'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL . ' composer install' . PHP_EOL . PHP_EOL . 'You can learn all about Composer on https://getcomposer.org/.' . PHP_EOL ); die(1); } $options = getopt('', array('prepend:')); if (isset($options['prepend'])) { require $options['prepend']; } unset($options); require PHPUNIT_COMPOSER_INSTALL; PHPUnit\TextUI\Command::main(); PK ��Z��3� � phpunit/composer.jsonnu �[��� { "name": "phpunit/phpunit", "description": "The PHP Unit Testing framework.", "type": "library", "keywords": [ "phpunit", "xunit", "testing" ], "homepage": "https://phpunit.de/", "license": "BSD-3-Clause", "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues" }, "prefer-stable": true, "require": { "php": ">=7.3", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", "doctrine/instantiator": "^1.3.1 || ^2", "myclabs/deep-copy": "^1.10.1", "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", "phpunit/php-timer": "^5.0.2", "sebastian/cli-parser": "^1.0.1", "sebastian/code-unit": "^1.0.6", "sebastian/comparator": "^4.0.8", "sebastian/diff": "^4.0.3", "sebastian/environment": "^5.1.3", "sebastian/exporter": "^4.0.5", "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", "sebastian/type": "^3.2", "sebastian/version": "^3.0.2" }, "config": { "platform": { "php": "7.3.0" }, "optimize-autoloader": true, "sort-packages": true }, "suggest": { "ext-soap": "To be able to generate mocks based on WSDL files", "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "bin": [ "phpunit" ], "autoload": { "classmap": [ "src/" ], "files": [ "src/Framework/Assert/Functions.php" ] }, "autoload-dev": { "classmap": [ "tests/" ], "files": [ "tests/_files/CoverageNamespacedFunctionTest.php", "tests/_files/CoveredFunction.php", "tests/_files/NamespaceCoveredFunction.php" ] }, "extra": { "branch-alias": { "dev-master": "9.6-dev" } } } PK ��Z�=�߸6 �6 phpunit/ChangeLog-8.5.mdnu �[��� # Changes in PHPUnit 8.5 All notable changes of the PHPUnit 8.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles. ## [8.5.33] - 2023-02-27 ### Fixed * [#5186](https://github.com/sebastianbergmann/phpunit/issues/5186): SBOM does not validate ## [8.5.32] - 2023-01-26 ### Fixed * [#5120](https://github.com/sebastianbergmann/phpunit/issues/5120): Test Runner incorrectly treats `--testsuite` and `--list-tests` as not combinable options ## [8.5.31] - 2022-10-28 ### Fixed * [#5076](https://github.com/sebastianbergmann/phpunit/issues/5076): Test Runner does not warn about conflicting options ## [8.5.30] - 2022-09-25 ### Changed * The configuration generator now asks for a cache directory ### Fixed * [#4913](https://github.com/sebastianbergmann/phpunit/issues/4913): Failed `assert()` should show a backtrace * [#4966](https://github.com/sebastianbergmann/phpunit/issues/4966): `TestCase::assertSame()` (and related exact comparisons) must compare `float` exactly ## [8.5.29] - 2022-08-22 ### Changed * [#5033](https://github.com/sebastianbergmann/phpunit/issues/5033): Do not depend on phpspec/prophecy ## [8.5.28] - 2022-07-29 ### Fixed * [#5015](https://github.com/sebastianbergmann/phpunit/pull/5015): Ukraine banner unreadable on black background * [#5016](https://github.com/sebastianbergmann/phpunit/issues/5016): PHPUnit 8.5.27 does not work on PHP 7.2.0-7.2.18 and PHP 7.3.0-7.3.5 ## [8.5.27] - 2022-06-19 ### Fixed * [#4950](https://github.com/sebastianbergmann/phpunit/issues/4950): False error on `atMost()` invocation rule without call * [#4962](https://github.com/sebastianbergmann/phpunit/issues/4962): Ukraine banner unreadable on white background ## [8.5.26] - 2022-04-01 ### Fixed * [#4938](https://github.com/sebastianbergmann/phpunit/issues/4938): Test Double code generator does not handle `void` return type declaration on `__clone()` methods ## [8.5.25] - 2022-03-16 ### Fixed * [#4934](https://github.com/sebastianbergmann/phpunit/issues/4934): Code Coverage does not work with PHPUnit 8.5.24 PHAR on PHP 7 ## [8.5.24] - 2022-03-05 - #StandWithUkraine ### Changed * [#4874](https://github.com/sebastianbergmann/phpunit/pull/4874): `PHP_FLOAT_EPSILON` is now used instead of hardcoded `0.0000000001` in `PHPUnit\Framework\Constraint\IsIdentical` ### Fixed * When the HTML code coverage report's configured low upper bound is larger than the high lower bound then the default values are used instead ## [8.5.23] - 2022-01-21 ### Fixed * [#4799](https://github.com/sebastianbergmann/phpunit/pull/4799): Memory leaks in `PHPUnit\Framework\TestSuite` class * [#4857](https://github.com/sebastianbergmann/phpunit/pull/4857): Result of `debug_backtrace()` is not used correctly ## [8.5.22] - 2021-12-25 ### Changed * [#4812](https://github.com/sebastianbergmann/phpunit/issues/4812): Do not enforce time limits when a debugging session through DBGp is active * [#4835](https://github.com/sebastianbergmann/phpunit/issues/4835): Support for `$GLOBALS['_composer_autoload_path']` introduced in Composer 2.2 ### Fixed * [#4840](https://github.com/sebastianbergmann/phpunit/pull/4840): TestDox prettifying for class names does not correctly handle diacritics * [#4846](https://github.com/sebastianbergmann/phpunit/pull/4846): Composer proxy script is not ignored ## [8.5.21] - 2021-09-25 ### Changed * PHPUnit no longer converts PHP deprecations to exceptions by default (configure `convertDeprecationsToExceptions="true"` to enable this) * The PHPUnit XML configuration file generator now configures `convertDeprecationsToExceptions="true"` ### Fixed * [#4772](https://github.com/sebastianbergmann/phpunit/pull/4772): TestDox HTML report not displayed correctly when browser has custom colour settings ## [8.5.20] - 2021-08-31 ### Fixed * [#4751](https://github.com/sebastianbergmann/phpunit/issues/4751): Configuration validation fails when using brackets in glob pattern ## [8.5.19] - 2021-07-31 ### Fixed * [#4740](https://github.com/sebastianbergmann/phpunit/issues/4740): `phpunit.phar` does not work with PHP 8.1 ## [8.5.18] - 2021-07-19 ### Fixed * [#4720](https://github.com/sebastianbergmann/phpunit/issues/4720): PHPUnit does not verify its own PHP extension requirements ## [8.5.17] - 2021-06-23 ### Changed * PHPUnit now errors out on startup when `PHP_VERSION` contains a value that is not compatible with `version_compare()`, for instance `X.Y.Z-(to be removed in future macOS)` ## [8.5.16] - 2021-06-05 ### Changed * The test result cache (the storage for which is implemented in `PHPUnit\Runner\DefaultTestResultCache`) no longer uses PHP's `serialize()` and `unserialize()` functions for persistence. It now uses a versioned JSON format instead that is independent of PHP implementation details (see [#3581](https://github.com/sebastianbergmann/phpunit/issues/3581) and [#4662](https://github.com/sebastianbergmann/phpunit/pull/4662) for examples why this is a problem). When PHPUnit tries to load the test result cache from a file that does not exist, or from a file that does not contain data in JSON format, or from a file that contains data in a JSON format version other than the one used by the currently running PHPUnit version, then this is considered to be a "cache miss". An empty `DefaultTestResultCache` object is created in this case. This should also prevent PHPUnit from crashing when trying to load a test result cache file created by a different version of PHPUnit (see [#4580](https://github.com/sebastianbergmann/phpunit/issues/4580) for example). ### Fixed * [#4663](https://github.com/sebastianbergmann/phpunit/issues/4663): `TestCase::expectError()` works on PHP 7.3, but not on PHP >= 7.4 * [#4678](https://github.com/sebastianbergmann/phpunit/pull/4678): Stubbed methods with `iterable` return types should return empty array by default * [#4692](https://github.com/sebastianbergmann/phpunit/issues/4692): Annotations in single-line doc-comments are not handled correctly * [#4694](https://github.com/sebastianbergmann/phpunit/issues/4694): `TestCase::getMockFromWsdl()` does not work with PHP 8.1-dev ## [8.5.15] - 2021-03-17 ### Fixed * [#4591](https://github.com/sebastianbergmann/phpunit/issues/4591): TeamCity logger logs warnings as test failures ## [8.5.14] - 2021-01-17 ### Fixed * [#4535](https://github.com/sebastianbergmann/phpunit/issues/4535): `getMockFromWsdl()` does not handle methods that do not have parameters correctly * [#4572](https://github.com/sebastianbergmann/phpunit/issues/4572): Schema validation does not work with `%xx` sequences in path to `phpunit.xsd` * [#4575](https://github.com/sebastianbergmann/phpunit/issues/4575): PHPUnit 8.5 incompatibility with PHP 8.1 ## [8.5.13] - 2020-12-01 ### Fixed * Running tests in isolated processes did not work with PHP 8 on Windows ## [8.5.12] - 2020-11-30 ### Changed * Changed PHP version constraint in `composer.json` from `^7.2` to `>=7.2` to allow the installation of PHPUnit 8.5 on PHP 8. Please note that the code coverage functionality is not available for PHPUnit 8.5 on PHP 8. ### Fixed * [#4529](https://github.com/sebastianbergmann/phpunit/issues/4529): Debug mode of Xdebug 2 is not disabled for PHPT tests ## [8.5.11] - 2020-11-27 ### Changed * Bumped required version of `phpunit/php-code-coverage` ## [8.5.10] - 2020-11-27 ### Added * Support for Xdebug 3 ### Fixed * [#4516](https://github.com/sebastianbergmann/phpunit/issues/4516): `phpunit/phpunit-selenium` does not work with PHPUnit 8.5.9 ## [8.5.9] - 2020-11-10 ### Fixed * [#3965](https://github.com/sebastianbergmann/phpunit/issues/3965): Process Isolation throws exceptions when PHPDBG is used * [#4470](https://github.com/sebastianbergmann/phpunit/pull/4470): Infinite recursion when `--static-backup --strict-global-state` is used ## [8.5.8] - 2020-06-22 ### Fixed * [#4312](https://github.com/sebastianbergmann/phpunit/issues/4312): Fix for [#4299](https://github.com/sebastianbergmann/phpunit/issues/4299) breaks backward compatibility ## [8.5.7] - 2020-06-21 ### Fixed * [#4299](https://github.com/sebastianbergmann/phpunit/issues/4299): "No tests executed" does not always result in exit code `1` * [#4306](https://github.com/sebastianbergmann/phpunit/issues/4306): Exceptions during code coverage driver initialization are not handled correctly ## [8.5.6] - 2020-06-15 ### Fixed * [#4211](https://github.com/sebastianbergmann/phpunit/issues/4211): `phpdbg_*()` functions are scoped to `PHPUnit\phpdbg_*()` ## [8.5.5] - 2020-05-22 ### Fixed * [#4033](https://github.com/sebastianbergmann/phpunit/issues/4033): Unexpected behaviour when `$GLOBALS` is deleted ## [8.5.4] - 2020-04-23 ### Changed * Changed how `PHPUnit\TextUI\Command` passes warnings to `PHPUnit\TextUI\TestRunner` ## [8.5.3] - 2020-03-31 ### Fixed * [#4017](https://github.com/sebastianbergmann/phpunit/issues/4017): Do not suggest refactoring to something that is also deprecated * [#4133](https://github.com/sebastianbergmann/phpunit/issues/4133): `expectExceptionMessageRegExp()` has been removed in PHPUnit 9 without a deprecation warning being given in PHPUnit 8 * [#4139](https://github.com/sebastianbergmann/phpunit/issues/4139): Cannot double interfaces that declare a constructor with PHP 8 * [#4144](https://github.com/sebastianbergmann/phpunit/issues/4144): Empty objects are converted to empty arrays in JSON comparison failure diff ## [8.5.2] - 2020-01-08 ### Removed * `eval-stdin.php` has been removed, it was not used anymore since PHPUnit 7.2.7 ## [8.5.1] - 2019-12-25 ### Changed * `eval-stdin.php` can now only be executed with `cli` and `phpdbg` ### Fixed * [#3983](https://github.com/sebastianbergmann/phpunit/issues/3983): Deprecation warning given too eagerly ## [8.5.0] - 2019-12-06 ### Added * [#3911](https://github.com/sebastianbergmann/phpunit/issues/3911): Support combined use of `addMethods()` and `onlyMethods()` * [#3949](https://github.com/sebastianbergmann/phpunit/issues/3949): Introduce specialized assertions `assertFileEqualsCanonicalizing()`, `assertFileEqualsIgnoringCase()`, `assertStringEqualsFileCanonicalizing()`, `assertStringEqualsFileIgnoringCase()`, `assertFileNotEqualsCanonicalizing()`, `assertFileNotEqualsIgnoringCase()`, `assertStringNotEqualsFileCanonicalizing()`, and `assertStringNotEqualsFileIgnoringCase()` as alternative to using `assertFileEquals()` etc. with optional parameters ### Changed * [#3860](https://github.com/sebastianbergmann/phpunit/pull/3860): Deprecate invoking PHPUnit commandline test runner with just a class name * [#3950](https://github.com/sebastianbergmann/phpunit/issues/3950): Deprecate optional parameters of `assertFileEquals()` etc. * [#3955](https://github.com/sebastianbergmann/phpunit/issues/3955): Deprecate support for doubling multiple interfaces ### Fixed * [#3953](https://github.com/sebastianbergmann/phpunit/issues/3953): Code Coverage for test executed in isolation does not work when the PHAR is used * [#3967](https://github.com/sebastianbergmann/phpunit/issues/3967): Cannot double interface that extends interface that extends `\Throwable` * [#3968](https://github.com/sebastianbergmann/phpunit/pull/3968): Test class run in a separate PHP process are passing when `exit` called inside [8.5.33]: https://github.com/sebastianbergmann/phpunit/compare/8.5.32...8.5.33 [8.5.32]: https://github.com/sebastianbergmann/phpunit/compare/8.5.31...8.5.32 [8.5.31]: https://github.com/sebastianbergmann/phpunit/compare/8.5.30...8.5.31 [8.5.30]: https://github.com/sebastianbergmann/phpunit/compare/8.5.29...8.5.30 [8.5.29]: https://github.com/sebastianbergmann/phpunit/compare/8.5.28...8.5.29 [8.5.28]: https://github.com/sebastianbergmann/phpunit/compare/8.5.27...8.5.28 [8.5.27]: https://github.com/sebastianbergmann/phpunit/compare/8.5.26...8.5.27 [8.5.26]: https://github.com/sebastianbergmann/phpunit/compare/8.5.25...8.5.26 [8.5.25]: https://github.com/sebastianbergmann/phpunit/compare/8.5.24...8.5.25 [8.5.24]: https://github.com/sebastianbergmann/phpunit/compare/8.5.23...8.5.24 [8.5.23]: https://github.com/sebastianbergmann/phpunit/compare/8.5.22...8.5.23 [8.5.22]: https://github.com/sebastianbergmann/phpunit/compare/8.5.21...8.5.22 [8.5.21]: https://github.com/sebastianbergmann/phpunit/compare/8.5.20...8.5.21 [8.5.20]: https://github.com/sebastianbergmann/phpunit/compare/8.5.19...8.5.20 [8.5.19]: https://github.com/sebastianbergmann/phpunit/compare/8.5.18...8.5.19 [8.5.18]: https://github.com/sebastianbergmann/phpunit/compare/8.5.17...8.5.18 [8.5.17]: https://github.com/sebastianbergmann/phpunit/compare/8.5.16...8.5.17 [8.5.16]: https://github.com/sebastianbergmann/phpunit/compare/8.5.15...8.5.16 [8.5.15]: https://github.com/sebastianbergmann/phpunit/compare/8.5.14...8.5.15 [8.5.14]: https://github.com/sebastianbergmann/phpunit/compare/8.5.13...8.5.14 [8.5.13]: https://github.com/sebastianbergmann/phpunit/compare/8.5.12...8.5.13 [8.5.12]: https://github.com/sebastianbergmann/phpunit/compare/8.5.11...8.5.12 [8.5.11]: https://github.com/sebastianbergmann/phpunit/compare/8.5.10...8.5.11 [8.5.10]: https://github.com/sebastianbergmann/phpunit/compare/8.5.9...8.5.10 [8.5.9]: https://github.com/sebastianbergmann/phpunit/compare/8.5.8...8.5.9 [8.5.8]: https://github.com/sebastianbergmann/phpunit/compare/8.5.7...8.5.8 [8.5.7]: https://github.com/sebastianbergmann/phpunit/compare/8.5.6...8.5.7 [8.5.6]: https://github.com/sebastianbergmann/phpunit/compare/8.5.5...8.5.6 [8.5.5]: https://github.com/sebastianbergmann/phpunit/compare/8.5.4...8.5.5 [8.5.4]: https://github.com/sebastianbergmann/phpunit/compare/8.5.3...8.5.4 [8.5.3]: https://github.com/sebastianbergmann/phpunit/compare/8.5.2...8.5.3 [8.5.2]: https://github.com/sebastianbergmann/phpunit/compare/8.5.1...8.5.2 [8.5.1]: https://github.com/sebastianbergmann/phpunit/compare/8.5.0...8.5.1 [8.5.0]: https://github.com/sebastianbergmann/phpunit/compare/8.4.3...8.5.0 PK ��Z,�u~G) G) ! phpunit/src/Util/Log/TeamCity.phpnu �[��� <?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. */ namespace PHPUnit\Util\Log; use function class_exists; use function count; use function explode; use function get_class; use function getmypid; use function ini_get; use function is_bool; use function is_scalar; use function method_exists; use function print_r; use function round; use function str_replace; use function stripos; use PHPUnit\Framework\AssertionFailedError; use PHPUnit\Framework\ExceptionWrapper; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\Test; use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestFailure; use PHPUnit\Framework\TestResult; use PHPUnit\Framework\TestSuite; use PHPUnit\Framework\Warning; use PHPUnit\TextUI\DefaultResultPrinter; use PHPUnit\Util\Exception; use PHPUnit\Util\Filter; use ReflectionClass; use ReflectionException; use SebastianBergmann\Comparator\ComparisonFailure; use Throwable; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class TeamCity extends DefaultResultPrinter { /** * @var bool */ private $isSummaryTestCountPrinted = false; /** * @var string */ private $startedTestName; /** * @var false|int */ private $flowId; public function printResult(TestResult $result): void { $this->printHeader($result); $this->printFooter($result); } /** * An error occurred. */ public function addError(Test $test, Throwable $t, float $time): void { $this->printEvent( 'testFailed', [ 'name' => $test->getName(), 'message' => self::getMessage($t), 'details' => self::getDetails($t), 'duration' => self::toMilliseconds($time), ] ); } /** * A warning occurred. */ public function addWarning(Test $test, Warning $e, float $time): void { $this->write(self::getMessage($e) . PHP_EOL); } /** * A failure occurred. */ public function addFailure(Test $test, AssertionFailedError $e, float $time): void { $parameters = [ 'name' => $test->getName(), 'message' => self::getMessage($e), 'details' => self::getDetails($e), 'duration' => self::toMilliseconds($time), ]; if ($e instanceof ExpectationFailedException) { $comparisonFailure = $e->getComparisonFailure(); if ($comparisonFailure instanceof ComparisonFailure) { $expectedString = $comparisonFailure->getExpectedAsString(); if ($expectedString === null || empty($expectedString)) { $expectedString = self::getPrimitiveValueAsString($comparisonFailure->getExpected()); } $actualString = $comparisonFailure->getActualAsString(); if ($actualString === null || empty($actualString)) { $actualString = self::getPrimitiveValueAsString($comparisonFailure->getActual()); } if ($actualString !== null && $expectedString !== null) { $parameters['type'] = 'comparisonFailure'; $parameters['actual'] = $actualString; $parameters['expected'] = $expectedString; } } } $this->printEvent('testFailed', $parameters); } /** * Incomplete test. */ public function addIncompleteTest(Test $test, Throwable $t, float $time): void { $this->printIgnoredTest($test->getName(), $t, $time); } /** * Risky test. */ public function addRiskyTest(Test $test, Throwable $t, float $time): void { $this->addError($test, $t, $time); } /** * Skipped test. */ public function addSkippedTest(Test $test, Throwable $t, float $time): void { $testName = $test->getName(); if ($this->startedTestName !== $testName) { $this->startTest($test); $this->printIgnoredTest($testName, $t, $time); $this->endTest($test, $time); } else { $this->printIgnoredTest($testName, $t, $time); } } public function printIgnoredTest(string $testName, Throwable $t, float $time): void { $this->printEvent( 'testIgnored', [ 'name' => $testName, 'message' => self::getMessage($t), 'details' => self::getDetails($t), 'duration' => self::toMilliseconds($time), ] ); } /** * A testsuite started. */ public function startTestSuite(TestSuite $suite): void { if (stripos(ini_get('disable_functions'), 'getmypid') === false) { $this->flowId = getmypid(); } else { $this->flowId = false; } if (!$this->isSummaryTestCountPrinted) { $this->isSummaryTestCountPrinted = true; $this->printEvent( 'testCount', ['count' => count($suite)] ); } $suiteName = $suite->getName(); if (empty($suiteName)) { return; } $parameters = ['name' => $suiteName]; if (class_exists($suiteName, false)) { $fileName = self::getFileName($suiteName); $parameters['locationHint'] = "php_qn://{$fileName}::\\{$suiteName}"; } else { $split = explode('::', $suiteName); if (count($split) === 2 && class_exists($split[0]) && method_exists($split[0], $split[1])) { $fileName = self::getFileName($split[0]); $parameters['locationHint'] = "php_qn://{$fileName}::\\{$suiteName}"; $parameters['name'] = $split[1]; } } $this->printEvent('testSuiteStarted', $parameters); } /** * A testsuite ended. */ public function endTestSuite(TestSuite $suite): void { $suiteName = $suite->getName(); if (empty($suiteName)) { return; } $parameters = ['name' => $suiteName]; if (!class_exists($suiteName, false)) { $split = explode('::', $suiteName); if (count($split) === 2 && class_exists($split[0]) && method_exists($split[0], $split[1])) { $parameters['name'] = $split[1]; } } $this->printEvent('testSuiteFinished', $parameters); } /** * A test started. */ public function startTest(Test $test): void { $testName = $test->getName(); $this->startedTestName = $testName; $params = ['name' => $testName]; if ($test instanceof TestCase) { $className = get_class($test); $fileName = self::getFileName($className); $params['locationHint'] = "php_qn://{$fileName}::\\{$className}::{$testName}"; } $this->printEvent('testStarted', $params); } /** * A test ended. */ public function endTest(Test $test, float $time): void { parent::endTest($test, $time); $this->printEvent( 'testFinished', [ 'name' => $test->getName(), 'duration' => self::toMilliseconds($time), ] ); } protected function writeProgress(string $progress): void { } private function printEvent(string $eventName, array $params = []): void { $this->write("\n##teamcity[{$eventName}"); if ($this->flowId) { $params['flowId'] = $this->flowId; } foreach ($params as $key => $value) { $escapedValue = self::escapeValue((string) $value); $this->write(" {$key}='{$escapedValue}'"); } $this->write("]\n"); } private static function getMessage(Throwable $t): string { $message = ''; if ($t instanceof ExceptionWrapper) { if ($t->getClassName() !== '') { $message .= $t->getClassName(); } if ($message !== '' && $t->getMessage() !== '') { $message .= ' : '; } } return $message . $t->getMessage(); } private static function getDetails(Throwable $t): string { $stackTrace = Filter::getFilteredStacktrace($t); $previous = $t instanceof ExceptionWrapper ? $t->getPreviousWrapped() : $t->getPrevious(); while ($previous) { $stackTrace .= "\nCaused by\n" . TestFailure::exceptionToString($previous) . "\n" . Filter::getFilteredStacktrace($previous); $previous = $previous instanceof ExceptionWrapper ? $previous->getPreviousWrapped() : $previous->getPrevious(); } return ' ' . str_replace("\n", "\n ", $stackTrace); } private static function getPrimitiveValueAsString($value): ?string { if ($value === null) { return 'null'; } if (is_bool($value)) { return $value ? 'true' : 'false'; } if (is_scalar($value)) { return print_r($value, true); } return null; } private static function escapeValue(string $text): string { return str_replace( ['|', "'", "\n", "\r", ']', '['], ['||', "|'", '|n', '|r', '|]', '|['], $text ); } /** * @param string $className */ private static function getFileName($className): string { try { return (new ReflectionClass($className))->getFileName(); // @codeCoverageIgnoreStart } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), $e->getCode(), $e ); } // @codeCoverageIgnoreEnd } /** * @param float $time microseconds */ private static function toMilliseconds(float $time): int { return (int) round($time * 1000); } } PK ��Z��Fk- - phpunit/src/Util/Log/JUnit.phpnu �[��� <?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. */ namespace PHPUnit\Util\Log; use function class_exists; use function get_class; use function method_exists; use function sprintf; use function str_replace; use function trim; use DOMDocument; use DOMElement; use PHPUnit\Framework\AssertionFailedError; use PHPUnit\Framework\ExceptionWrapper; use PHPUnit\Framework\SelfDescribing; use PHPUnit\Framework\Test; use PHPUnit\Framework\TestFailure; use PHPUnit\Framework\TestListener; use PHPUnit\Framework\TestSuite; use PHPUnit\Framework\Warning; use PHPUnit\Util\Exception; use PHPUnit\Util\Filter; use PHPUnit\Util\Printer; use PHPUnit\Util\Xml; use ReflectionClass; use ReflectionException; use Throwable; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class JUnit extends Printer implements TestListener { /** * @var DOMDocument */ private $document; /** * @var DOMElement */ private $root; /** * @var bool */ private $reportRiskyTests = false; /** * @var DOMElement[] */ private $testSuites = []; /** * @var int[] */ private $testSuiteTests = [0]; /** * @var int[] */ private $testSuiteAssertions = [0]; /** * @var int[] */ private $testSuiteErrors = [0]; /** * @var int[] */ private $testSuiteWarnings = [0]; /** * @var int[] */ private $testSuiteFailures = [0]; /** * @var int[] */ private $testSuiteSkipped = [0]; /** * @var int[] */ private $testSuiteTimes = [0]; /** * @var int */ private $testSuiteLevel = 0; /** * @var DOMElement */ private $currentTestCase; /** * @param null|mixed $out */ public function __construct($out = null, bool $reportRiskyTests = false) { $this->document = new DOMDocument('1.0', 'UTF-8'); $this->document->formatOutput = true; $this->root = $this->document->createElement('testsuites'); $this->document->appendChild($this->root); parent::__construct($out); $this->reportRiskyTests = $reportRiskyTests; } /** * Flush buffer and close output. */ public function flush(): void { $this->write($this->getXML()); parent::flush(); } /** * An error occurred. */ public function addError(Test $test, Throwable $t, float $time): void { $this->doAddFault($test, $t, 'error'); $this->testSuiteErrors[$this->testSuiteLevel]++; } /** * A warning occurred. */ public function addWarning(Test $test, Warning $e, float $time): void { $this->doAddFault($test, $e, 'warning'); $this->testSuiteWarnings[$this->testSuiteLevel]++; } /** * A failure occurred. */ public function addFailure(Test $test, AssertionFailedError $e, float $time): void { $this->doAddFault($test, $e, 'failure'); $this->testSuiteFailures[$this->testSuiteLevel]++; } /** * Incomplete test. */ public function addIncompleteTest(Test $test, Throwable $t, float $time): void { $this->doAddSkipped(); } /** * Risky test. */ public function addRiskyTest(Test $test, Throwable $t, float $time): void { if (!$this->reportRiskyTests) { return; } $this->doAddFault($test, $t, 'error'); $this->testSuiteErrors[$this->testSuiteLevel]++; } /** * Skipped test. */ public function addSkippedTest(Test $test, Throwable $t, float $time): void { $this->doAddSkipped(); } /** * A testsuite started. */ public function startTestSuite(TestSuite $suite): void { $testSuite = $this->document->createElement('testsuite'); $testSuite->setAttribute('name', $suite->getName()); if (class_exists($suite->getName(), false)) { try { $class = new ReflectionClass($suite->getName()); $testSuite->setAttribute('file', $class->getFileName()); } catch (ReflectionException $e) { } } if ($this->testSuiteLevel > 0) { $this->testSuites[$this->testSuiteLevel]->appendChild($testSuite); } else { $this->root->appendChild($testSuite); } $this->testSuiteLevel++; $this->testSuites[$this->testSuiteLevel] = $testSuite; $this->testSuiteTests[$this->testSuiteLevel] = 0; $this->testSuiteAssertions[$this->testSuiteLevel] = 0; $this->testSuiteErrors[$this->testSuiteLevel] = 0; $this->testSuiteWarnings[$this->testSuiteLevel] = 0; $this->testSuiteFailures[$this->testSuiteLevel] = 0; $this->testSuiteSkipped[$this->testSuiteLevel] = 0; $this->testSuiteTimes[$this->testSuiteLevel] = 0; } /** * A testsuite ended. */ public function endTestSuite(TestSuite $suite): void { $this->testSuites[$this->testSuiteLevel]->setAttribute( 'tests', (string) $this->testSuiteTests[$this->testSuiteLevel] ); $this->testSuites[$this->testSuiteLevel]->setAttribute( 'assertions', (string) $this->testSuiteAssertions[$this->testSuiteLevel] ); $this->testSuites[$this->testSuiteLevel]->setAttribute( 'errors', (string) $this->testSuiteErrors[$this->testSuiteLevel] ); $this->testSuites[$this->testSuiteLevel]->setAttribute( 'warnings', (string) $this->testSuiteWarnings[$this->testSuiteLevel] ); $this->testSuites[$this->testSuiteLevel]->setAttribute( 'failures', (string) $this->testSuiteFailures[$this->testSuiteLevel] ); $this->testSuites[$this->testSuiteLevel]->setAttribute( 'skipped', (string) $this->testSuiteSkipped[$this->testSuiteLevel] ); $this->testSuites[$this->testSuiteLevel]->setAttribute( 'time', sprintf('%F', $this->testSuiteTimes[$this->testSuiteLevel]) ); if ($this->testSuiteLevel > 1) { $this->testSuiteTests[$this->testSuiteLevel - 1] += $this->testSuiteTests[$this->testSuiteLevel]; $this->testSuiteAssertions[$this->testSuiteLevel - 1] += $this->testSuiteAssertions[$this->testSuiteLevel]; $this->testSuiteErrors[$this->testSuiteLevel - 1] += $this->testSuiteErrors[$this->testSuiteLevel]; $this->testSuiteWarnings[$this->testSuiteLevel - 1] += $this->testSuiteWarnings[$this->testSuiteLevel]; $this->testSuiteFailures[$this->testSuiteLevel - 1] += $this->testSuiteFailures[$this->testSuiteLevel]; $this->testSuiteSkipped[$this->testSuiteLevel - 1] += $this->testSuiteSkipped[$this->testSuiteLevel]; $this->testSuiteTimes[$this->testSuiteLevel - 1] += $this->testSuiteTimes[$this->testSuiteLevel]; } $this->testSuiteLevel--; } /** * A test started. */ public function startTest(Test $test): void { $usesDataprovider = false; if (method_exists($test, 'usesDataProvider')) { $usesDataprovider = $test->usesDataProvider(); } $testCase = $this->document->createElement('testcase'); $testCase->setAttribute('name', $test->getName()); try { $class = new ReflectionClass($test); // @codeCoverageIgnoreStart } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), $e->getCode(), $e ); } // @codeCoverageIgnoreEnd $methodName = $test->getName(!$usesDataprovider); if ($class->hasMethod($methodName)) { try { $method = $class->getMethod($methodName); // @codeCoverageIgnoreStart } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), $e->getCode(), $e ); } // @codeCoverageIgnoreEnd $testCase->setAttribute('class', $class->getName()); $testCase->setAttribute('classname', str_replace('\\', '.', $class->getName())); $testCase->setAttribute('file', $class->getFileName()); $testCase->setAttribute('line', (string) $method->getStartLine()); } $this->currentTestCase = $testCase; } /** * A test ended. */ public function endTest(Test $test, float $time): void { $numAssertions = 0; if (method_exists($test, 'getNumAssertions')) { $numAssertions = $test->getNumAssertions(); } $this->testSuiteAssertions[$this->testSuiteLevel] += $numAssertions; $this->currentTestCase->setAttribute( 'assertions', (string) $numAssertions ); $this->currentTestCase->setAttribute( 'time', sprintf('%F', $time) ); $this->testSuites[$this->testSuiteLevel]->appendChild( $this->currentTestCase ); $this->testSuiteTests[$this->testSuiteLevel]++; $this->testSuiteTimes[$this->testSuiteLevel] += $time; $testOutput = ''; if (method_exists($test, 'hasOutput') && method_exists($test, 'getActualOutput')) { $testOutput = $test->hasOutput() ? $test->getActualOutput() : ''; } if (!empty($testOutput)) { $systemOut = $this->document->createElement( 'system-out', Xml::prepareString($testOutput) ); $this->currentTestCase->appendChild($systemOut); } $this->currentTestCase = null; } /** * Returns the XML as a string. */ public function getXML(): string { return $this->document->saveXML(); } private function doAddFault(Test $test, Throwable $t, string $type): void { if ($this->currentTestCase === null) { return; } if ($test instanceof SelfDescribing) { $buffer = $test->toString() . "\n"; } else { $buffer = ''; } $buffer .= trim( TestFailure::exceptionToString($t) . "\n" . Filter::getFilteredStacktrace($t) ); $fault = $this->document->createElement( $type, Xml::prepareString($buffer) ); if ($t instanceof ExceptionWrapper) { $fault->setAttribute('type', $t->getClassName()); } else { $fault->setAttribute('type', get_class($t)); } $this->currentTestCase->appendChild($fault); } private function doAddSkipped(): void { if ($this->currentTestCase === null) { return; } $skipped = $this->document->createElement('skipped'); $this->currentTestCase->appendChild($skipped); $this->testSuiteSkipped[$this->testSuiteLevel]++; } } PK ��Z��)s� � phpunit/src/Util/FileLoader.phpnu �[��� <?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. */ namespace PHPUnit\Util; use const DIRECTORY_SEPARATOR; use function array_diff; use function array_keys; use function fopen; use function get_defined_vars; use function sprintf; use function stream_resolve_include_path; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class FileLoader { /** * Checks if a PHP sourcecode file is readable. The sourcecode file is loaded through the load() method. * * As a fallback, PHP looks in the directory of the file executing the stream_resolve_include_path function. * We do not want to load the Test.php file here, so skip it if it found that. * PHP prioritizes the include_path setting, so if the current directory is in there, it will first look in the * current working directory. * * @throws Exception */ public static function checkAndLoad(string $filename): string { $includePathFilename = stream_resolve_include_path($filename); $localFile = __DIR__ . DIRECTORY_SEPARATOR . $filename; if (!$includePathFilename || $includePathFilename === $localFile || !self::isReadable($includePathFilename)) { throw new Exception( sprintf('Cannot open file "%s".' . "\n", $filename) ); } self::load($includePathFilename); return $includePathFilename; } /** * Loads a PHP sourcefile. */ public static function load(string $filename): void { $oldVariableNames = array_keys(get_defined_vars()); /** * @noinspection PhpIncludeInspection * * @psalm-suppress UnresolvableInclude */ include_once $filename; $newVariables = get_defined_vars(); foreach (array_diff(array_keys($newVariables), $oldVariableNames) as $variableName) { if ($variableName !== 'oldVariableNames') { $GLOBALS[$variableName] = $newVariables[$variableName]; } } } /** * @see https://github.com/sebastianbergmann/phpunit/pull/2751 */ private static function isReadable(string $filename): bool { return @fopen($filename, 'r') !== false; } } PK ��Z/�O� � * phpunit/src/Util/PHP/DefaultPhpProcess.phpnu �[��� <?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. */ namespace PHPUnit\Util\PHP; use function array_merge; use function fclose; use function file_put_contents; use function fread; use function fwrite; use function is_array; use function is_resource; use function proc_close; use function proc_open; use function proc_terminate; use function rewind; use function sprintf; use function stream_get_contents; use function stream_select; use function sys_get_temp_dir; use function tempnam; use function unlink; use PHPUnit\Framework\Exception; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ class DefaultPhpProcess extends AbstractPhpProcess { /** * @var string */ protected $tempFile; /** * Runs a single job (PHP code) using a separate PHP process. * * @throws Exception */ public function runJob(string $job, array $settings = []): array { if ($this->stdin || $this->useTemporaryFile()) { if (!($this->tempFile = tempnam(sys_get_temp_dir(), 'PHPUnit')) || file_put_contents($this->tempFile, $job) === false) { throw new Exception( 'Unable to write temporary file' ); } $job = $this->stdin; } return $this->runProcess($job, $settings); } /** * Returns an array of file handles to be used in place of pipes. */ protected function getHandles(): array { return []; } /** * Handles creating the child process and returning the STDOUT and STDERR. * * @throws Exception */ protected function runProcess(string $job, array $settings): array { $handles = $this->getHandles(); $env = null; if ($this->env) { $env = $_SERVER ?? []; unset($env['argv'], $env['argc']); $env = array_merge($env, $this->env); foreach ($env as $envKey => $envVar) { if (is_array($envVar)) { unset($env[$envKey]); } } } $pipeSpec = [ 0 => $handles[0] ?? ['pipe', 'r'], 1 => $handles[1] ?? ['pipe', 'w'], 2 => $handles[2] ?? ['pipe', 'w'], ]; $process = proc_open( $this->getCommand($settings, $this->tempFile), $pipeSpec, $pipes, null, $env ); if (!is_resource($process)) { throw new Exception( 'Unable to spawn worker process' ); } if ($job) { $this->process($pipes[0], $job); } fclose($pipes[0]); $stderr = $stdout = ''; if ($this->timeout) { unset($pipes[0]); while (true) { $r = $pipes; $w = null; $e = null; $n = @stream_select($r, $w, $e, $this->timeout); if ($n === false) { break; } if ($n === 0) { proc_terminate($process, 9); throw new Exception( sprintf( 'Job execution aborted after %d seconds', $this->timeout ) ); } if ($n > 0) { foreach ($r as $pipe) { $pipeOffset = 0; foreach ($pipes as $i => $origPipe) { if ($pipe === $origPipe) { $pipeOffset = $i; break; } } if (!$pipeOffset) { break; } $line = fread($pipe, 8192); if ($line === '' || $line === false) { fclose($pipes[$pipeOffset]); unset($pipes[$pipeOffset]); } elseif ($pipeOffset === 1) { $stdout .= $line; } else { $stderr .= $line; } } if (empty($pipes)) { break; } } } } else { if (isset($pipes[1])) { $stdout = stream_get_contents($pipes[1]); fclose($pipes[1]); } if (isset($pipes[2])) { $stderr = stream_get_contents($pipes[2]); fclose($pipes[2]); } } if (isset($handles[1])) { rewind($handles[1]); $stdout = stream_get_contents($handles[1]); fclose($handles[1]); } if (isset($handles[2])) { rewind($handles[2]); $stderr = stream_get_contents($handles[2]); fclose($handles[2]); } proc_close($process); $this->cleanup(); return ['stdout' => $stdout, 'stderr' => $stderr]; } /** * @param resource $pipe */ protected function process($pipe, string $job): void { fwrite($pipe, $job); } protected function cleanup(): void { if ($this->tempFile) { unlink($this->tempFile); } } protected function useTemporaryFile(): bool { return false; } } PK ��Zcϑ� * phpunit/src/Util/PHP/WindowsPhpProcess.phpnu �[��� <?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. */ namespace PHPUnit\Util\PHP; use const PHP_MAJOR_VERSION; use function tmpfile; use PHPUnit\Framework\Exception; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit * * @see https://bugs.php.net/bug.php?id=51800 */ final class WindowsPhpProcess extends DefaultPhpProcess { public function getCommand(array $settings, string $file = null): string { if (PHP_MAJOR_VERSION < 8) { return '"' . parent::getCommand($settings, $file) . '"'; } return parent::getCommand($settings, $file); } /** * @throws Exception */ protected function getHandles(): array { if (false === $stdout_handle = tmpfile()) { throw new Exception( 'A temporary file could not be created; verify that your TEMP environment variable is writable' ); } return [ 1 => $stdout_handle, ]; } protected function useTemporaryFile(): bool { return true; } } PK ��Zw����+ �+ + phpunit/src/Util/PHP/AbstractPhpProcess.phpnu �[��� <?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. */ namespace PHPUnit\Util\PHP; use const DIRECTORY_SEPARATOR; use const PHP_SAPI; use function array_keys; use function array_merge; use function assert; use function escapeshellarg; use function ini_get_all; use function restore_error_handler; use function set_error_handler; use function sprintf; use function str_replace; use function strpos; use function strrpos; use function substr; use function trim; use function unserialize; use __PHP_Incomplete_Class; use ErrorException; use PHPUnit\Framework\AssertionFailedError; use PHPUnit\Framework\Exception; use PHPUnit\Framework\SyntheticError; use PHPUnit\Framework\Test; use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestFailure; use PHPUnit\Framework\TestResult; use SebastianBergmann\Environment\Runtime; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ abstract class AbstractPhpProcess { /** * @var Runtime */ protected $runtime; /** * @var bool */ protected $stderrRedirection = false; /** * @var string */ protected $stdin = ''; /** * @var string */ protected $args = ''; /** * @var array<string, string> */ protected $env = []; /** * @var int */ protected $timeout = 0; public static function factory(): self { if (DIRECTORY_SEPARATOR === '\\') { return new WindowsPhpProcess; } return new DefaultPhpProcess; } public function __construct() { $this->runtime = new Runtime; } /** * Defines if should use STDERR redirection or not. * * Then $stderrRedirection is TRUE, STDERR is redirected to STDOUT. */ public function setUseStderrRedirection(bool $stderrRedirection): void { $this->stderrRedirection = $stderrRedirection; } /** * Returns TRUE if uses STDERR redirection or FALSE if not. */ public function useStderrRedirection(): bool { return $this->stderrRedirection; } /** * Sets the input string to be sent via STDIN. */ public function setStdin(string $stdin): void { $this->stdin = $stdin; } /** * Returns the input string to be sent via STDIN. */ public function getStdin(): string { return $this->stdin; } /** * Sets the string of arguments to pass to the php job. */ public function setArgs(string $args): void { $this->args = $args; } /** * Returns the string of arguments to pass to the php job. */ public function getArgs(): string { return $this->args; } /** * Sets the array of environment variables to start the child process with. * * @param array<string, string> $env */ public function setEnv(array $env): void { $this->env = $env; } /** * Returns the array of environment variables to start the child process with. */ public function getEnv(): array { return $this->env; } /** * Sets the amount of seconds to wait before timing out. */ public function setTimeout(int $timeout): void { $this->timeout = $timeout; } /** * Returns the amount of seconds to wait before timing out. */ public function getTimeout(): int { return $this->timeout; } /** * Runs a single test in a separate PHP process. * * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException */ public function runTestJob(string $job, Test $test, TestResult $result): void { $result->startTest($test); $_result = $this->runJob($job); $this->processChildResult( $test, $result, $_result['stdout'], $_result['stderr'] ); } /** * Returns the command based into the configurations. */ public function getCommand(array $settings, string $file = null): string { $command = $this->runtime->getBinary(); if ($this->runtime->hasPCOV()) { $settings = array_merge( $settings, $this->runtime->getCurrentSettings( array_keys(ini_get_all('pcov')) ) ); } elseif ($this->runtime->hasXdebug()) { $settings = array_merge( $settings, $this->runtime->getCurrentSettings( array_keys(ini_get_all('xdebug')) ) ); } $command .= $this->settingsToParameters($settings); if (PHP_SAPI === 'phpdbg') { $command .= ' -qrr'; if (!$file) { $command .= 's='; } } if ($file) { $command .= ' ' . escapeshellarg($file); } if ($this->args) { if (!$file) { $command .= ' --'; } $command .= ' ' . $this->args; } if ($this->stderrRedirection) { $command .= ' 2>&1'; } return $command; } /** * Runs a single job (PHP code) using a separate PHP process. */ abstract public function runJob(string $job, array $settings = []): array; protected function settingsToParameters(array $settings): string { $buffer = ''; foreach ($settings as $setting) { $buffer .= ' -d ' . escapeshellarg($setting); } return $buffer; } /** * Processes the TestResult object from an isolated process. * * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException */ private function processChildResult(Test $test, TestResult $result, string $stdout, string $stderr): void { $time = 0; if (!empty($stderr)) { $result->addError( $test, new Exception(trim($stderr)), $time ); } else { set_error_handler( /** * @throws ErrorException */ static function ($errno, $errstr, $errfile, $errline): void { throw new ErrorException($errstr, $errno, $errno, $errfile, $errline); } ); try { if (strpos($stdout, "#!/usr/bin/env php\n") === 0) { $stdout = substr($stdout, 19); } $childResult = unserialize(str_replace("#!/usr/bin/env php\n", '', $stdout)); restore_error_handler(); if ($childResult === false) { $result->addFailure( $test, new AssertionFailedError('Test was run in child process and ended unexpectedly'), $time ); } } catch (ErrorException $e) { restore_error_handler(); $childResult = false; $result->addError( $test, new Exception(trim($stdout), 0, $e), $time ); } if ($childResult !== false) { if (!empty($childResult['output'])) { $output = $childResult['output']; } /* @var TestCase $test */ $test->setResult($childResult['testResult']); $test->addToAssertionCount($childResult['numAssertions']); $childResult = $childResult['result']; assert($childResult instanceof TestResult); if ($result->getCollectCodeCoverageInformation()) { $result->getCodeCoverage()->merge( $childResult->getCodeCoverage() ); } $time = $childResult->time(); $notImplemented = $childResult->notImplemented(); $risky = $childResult->risky(); $skipped = $childResult->skipped(); $errors = $childResult->errors(); $warnings = $childResult->warnings(); $failures = $childResult->failures(); if (!empty($notImplemented)) { $result->addError( $test, $this->getException($notImplemented[0]), $time ); } elseif (!empty($risky)) { $result->addError( $test, $this->getException($risky[0]), $time ); } elseif (!empty($skipped)) { $result->addError( $test, $this->getException($skipped[0]), $time ); } elseif (!empty($errors)) { $result->addError( $test, $this->getException($errors[0]), $time ); } elseif (!empty($warnings)) { $result->addWarning( $test, $this->getException($warnings[0]), $time ); } elseif (!empty($failures)) { $result->addFailure( $test, $this->getException($failures[0]), $time ); } } } $result->endTest($test, $time); if (!empty($output)) { print $output; } } /** * Gets the thrown exception from a PHPUnit\Framework\TestFailure. * * @see https://github.com/sebastianbergmann/phpunit/issues/74 */ private function getException(TestFailure $error): Exception { $exception = $error->thrownException(); if ($exception instanceof __PHP_Incomplete_Class) { $exceptionArray = []; foreach ((array) $exception as $key => $value) { $key = substr($key, strrpos($key, "\0") + 1); $exceptionArray[$key] = $value; } $exception = new SyntheticError( sprintf( '%s: %s', $exceptionArray['_PHP_Incomplete_Class_Name'], $exceptionArray['message'] ), $exceptionArray['code'], $exceptionArray['file'], $exceptionArray['line'], $exceptionArray['trace'] ); } return $exception; } } PK ��Z+U ` ` / phpunit/src/Util/PHP/Template/TestCaseClass.tplnu �[��� <?php use SebastianBergmann\CodeCoverage\CodeCoverage; use SebastianBergmann\CodeCoverage\Driver\Selector; use PHPUnit\TextUI\XmlConfiguration\Loader; use PHPUnit\TextUI\XmlConfiguration\PhpHandler; if (!defined('STDOUT')) { // php://stdout does not obey output buffering. Any output would break // unserialization of child process results in the parent process. define('STDOUT', fopen('php://temp', 'w+b')); define('STDERR', fopen('php://stderr', 'wb')); } {iniSettings} ini_set('display_errors', 'stderr'); set_include_path('{include_path}'); $composerAutoload = {composerAutoload}; $phar = {phar}; ob_start(); if ($composerAutoload) { require_once $composerAutoload; define('PHPUNIT_COMPOSER_INSTALL', $composerAutoload); } else if ($phar) { require $phar; } function __phpunit_run_isolated_test() { if (!class_exists('{className}')) { require_once '{filename}'; } $result = new PHPUnit\Framework\TestResult; if ({collectCodeCoverageInformation}) { $filter = unserialize('{codeCoverageFilter}'); $codeCoverage = new CodeCoverage( (new Selector)->{driverMethod}($filter), $filter ); if ({cachesStaticAnalysis}) { $codeCoverage->cacheStaticAnalysis(unserialize('{codeCoverageCacheDirectory}')); } $result->setCodeCoverage($codeCoverage); } $result->beStrictAboutTestsThatDoNotTestAnything({isStrictAboutTestsThatDoNotTestAnything}); $result->beStrictAboutOutputDuringTests({isStrictAboutOutputDuringTests}); $result->enforceTimeLimit({enforcesTimeLimit}); $result->beStrictAboutTodoAnnotatedTests({isStrictAboutTodoAnnotatedTests}); $result->beStrictAboutResourceUsageDuringSmallTests({isStrictAboutResourceUsageDuringSmallTests}); $test = new {className}('{name}', unserialize('{data}'), '{dataName}'); $test->setDependencyInput(unserialize('{dependencyInput}')); $test->setInIsolation(TRUE); ob_end_clean(); $test->run($result); $output = ''; if (!$test->hasExpectationOnOutput()) { $output = $test->getActualOutput(); } ini_set('xdebug.scream', '0'); @rewind(STDOUT); /* @ as not every STDOUT target stream is rewindable */ if ($stdout = @stream_get_contents(STDOUT)) { $output = $stdout . $output; $streamMetaData = stream_get_meta_data(STDOUT); if (!empty($streamMetaData['stream_type']) && 'STDIO' === $streamMetaData['stream_type']) { @ftruncate(STDOUT, 0); @rewind(STDOUT); } } print serialize( [ 'testResult' => $test->getResult(), 'numAssertions' => $test->getNumAssertions(), 'result' => $result, 'output' => $output ] ); } $configurationFilePath = '{configurationFilePath}'; if ('' !== $configurationFilePath) { $configuration = (new Loader)->load($configurationFilePath); (new PhpHandler)->handle($configuration->php()); unset($configuration); } function __phpunit_error_handler($errno, $errstr, $errfile, $errline) { return true; } set_error_handler('__phpunit_error_handler'); {constants} {included_files} {globals} restore_error_handler(); if (isset($GLOBALS['__PHPUNIT_BOOTSTRAP'])) { require_once $GLOBALS['__PHPUNIT_BOOTSTRAP']; unset($GLOBALS['__PHPUNIT_BOOTSTRAP']); } __phpunit_run_isolated_test(); PK ��Zh"�� � . phpunit/src/Util/PHP/Template/PhptTestCase.tplnu �[��� <?php use SebastianBergmann\CodeCoverage\CodeCoverage; use SebastianBergmann\CodeCoverage\Driver\Selector; use SebastianBergmann\CodeCoverage\Filter; $composerAutoload = {composerAutoload}; $phar = {phar}; ob_start(); $GLOBALS['__PHPUNIT_ISOLATION_EXCLUDE_LIST'][] = '{job}'; if ($composerAutoload) { require_once $composerAutoload; define('PHPUNIT_COMPOSER_INSTALL', $composerAutoload); } else if ($phar) { require $phar; } {globals} $coverage = null; if (isset($GLOBALS['__PHPUNIT_BOOTSTRAP'])) { require_once $GLOBALS['__PHPUNIT_BOOTSTRAP']; } if (class_exists('SebastianBergmann\CodeCoverage\CodeCoverage')) { $filter = new Filter; $coverage = new CodeCoverage( (new Selector)->{driverMethod}($filter), $filter ); if ({codeCoverageCacheDirectory}) { $coverage->cacheStaticAnalysis({codeCoverageCacheDirectory}); } $coverage->start(__FILE__); } register_shutdown_function( function() use ($coverage) { $output = null; if ($coverage) { $output = $coverage->stop(); } file_put_contents('{coverageFile}', serialize($output)); } ); ob_end_clean(); require '{job}'; PK ��Z�w^ȯ � 0 phpunit/src/Util/PHP/Template/TestCaseMethod.tplnu �[��� <?php use PHPUnit\Framework\TestCase; use SebastianBergmann\CodeCoverage\CodeCoverage; use SebastianBergmann\CodeCoverage\Driver\Selector; use PHPUnit\TextUI\XmlConfiguration\Loader; use PHPUnit\TextUI\XmlConfiguration\PhpHandler; if (!defined('STDOUT')) { // php://stdout does not obey output buffering. Any output would break // unserialization of child process results in the parent process. define('STDOUT', fopen('php://temp', 'w+b')); define('STDERR', fopen('php://stderr', 'wb')); } {iniSettings} ini_set('display_errors', 'stderr'); set_include_path('{include_path}'); $composerAutoload = {composerAutoload}; $phar = {phar}; ob_start(); if ($composerAutoload) { require_once $composerAutoload; define('PHPUNIT_COMPOSER_INSTALL', $composerAutoload); } else if ($phar) { require $phar; } function __phpunit_run_isolated_test() { if (!class_exists('{className}')) { require_once '{filename}'; } $result = new PHPUnit\Framework\TestResult; if ({collectCodeCoverageInformation}) { $filter = unserialize('{codeCoverageFilter}'); $codeCoverage = new CodeCoverage( (new Selector)->{driverMethod}($filter), $filter ); if ({cachesStaticAnalysis}) { $codeCoverage->cacheStaticAnalysis(unserialize('{codeCoverageCacheDirectory}')); } $result->setCodeCoverage($codeCoverage); } $result->beStrictAboutTestsThatDoNotTestAnything({isStrictAboutTestsThatDoNotTestAnything}); $result->beStrictAboutOutputDuringTests({isStrictAboutOutputDuringTests}); $result->enforceTimeLimit({enforcesTimeLimit}); $result->beStrictAboutTodoAnnotatedTests({isStrictAboutTodoAnnotatedTests}); $result->beStrictAboutResourceUsageDuringSmallTests({isStrictAboutResourceUsageDuringSmallTests}); $test = new {className}('{methodName}', unserialize('{data}'), '{dataName}'); \assert($test instanceof TestCase); $test->setDependencyInput(unserialize('{dependencyInput}')); $test->setInIsolation(true); ob_end_clean(); $test->run($result); $output = ''; if (!$test->hasExpectationOnOutput()) { $output = $test->getActualOutput(); } ini_set('xdebug.scream', '0'); @rewind(STDOUT); /* @ as not every STDOUT target stream is rewindable */ if ($stdout = @stream_get_contents(STDOUT)) { $output = $stdout . $output; $streamMetaData = stream_get_meta_data(STDOUT); if (!empty($streamMetaData['stream_type']) && 'STDIO' === $streamMetaData['stream_type']) { @ftruncate(STDOUT, 0); @rewind(STDOUT); } } print serialize( [ 'testResult' => $test->getResult(), 'numAssertions' => $test->getNumAssertions(), 'result' => $result, 'output' => $output ] ); } $configurationFilePath = '{configurationFilePath}'; if ('' !== $configurationFilePath) { $configuration = (new Loader)->load($configurationFilePath); (new PhpHandler)->handle($configuration->php()); unset($configuration); } function __phpunit_error_handler($errno, $errstr, $errfile, $errline) { return true; } set_error_handler('__phpunit_error_handler'); {constants} {included_files} {globals} restore_error_handler(); if (isset($GLOBALS['__PHPUNIT_BOOTSTRAP'])) { require_once $GLOBALS['__PHPUNIT_BOOTSTRAP']; unset($GLOBALS['__PHPUNIT_BOOTSTRAP']); } __phpunit_run_isolated_test(); PK ��Z�4�/� � ( phpunit/src/Util/XmlTestListRenderer.phpnu �[��� <?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. */ namespace PHPUnit\Util; use function get_class; use function implode; use function str_replace; use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestSuite; use PHPUnit\Runner\PhptTestCase; use RecursiveIteratorIterator; use XMLWriter; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class XmlTestListRenderer { /** * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException */ public function render(TestSuite $suite): string { $writer = new XMLWriter; $writer->openMemory(); $writer->setIndent(true); $writer->startDocument('1.0', 'UTF-8'); $writer->startElement('tests'); $currentTestCase = null; foreach (new RecursiveIteratorIterator($suite->getIterator()) as $test) { if ($test instanceof TestCase) { if (get_class($test) !== $currentTestCase) { if ($currentTestCase !== null) { $writer->endElement(); } $writer->startElement('testCaseClass'); $writer->writeAttribute('name', get_class($test)); $currentTestCase = get_class($test); } $writer->startElement('testCaseMethod'); $writer->writeAttribute('name', $test->getName(false)); $writer->writeAttribute('groups', implode(',', $test->getGroups())); if (!empty($test->getDataSetAsString(false))) { $writer->writeAttribute( 'dataSet', str_replace( ' with data set ', '', $test->getDataSetAsString(false) ) ); } $writer->endElement(); } elseif ($test instanceof PhptTestCase) { if ($currentTestCase !== null) { $writer->endElement(); $currentTestCase = null; } $writer->startElement('phptFile'); $writer->writeAttribute('path', $test->getName()); $writer->endElement(); } } if ($currentTestCase !== null) { $writer->endElement(); } $writer->endElement(); $writer->endDocument(); return $writer->outputMemory(); } } PK ��Z�Cԓ� � phpunit/src/Util/Xml.phpnu �[��� <?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. */ namespace PHPUnit\Util; use const ENT_QUOTES; use function assert; use function class_exists; use function htmlspecialchars; use function mb_convert_encoding; use function ord; use function preg_replace; use function settype; use function strlen; use DOMCharacterData; use DOMDocument; use DOMElement; use DOMNode; use DOMText; use ReflectionClass; use ReflectionException; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class Xml { /** * @deprecated Only used by assertEqualXMLStructure() */ public static function import(DOMElement $element): DOMElement { return (new DOMDocument)->importNode($element, true); } /** * @deprecated Only used by assertEqualXMLStructure() */ public static function removeCharacterDataNodes(DOMNode $node): void { if ($node->hasChildNodes()) { for ($i = $node->childNodes->length - 1; $i >= 0; $i--) { if (($child = $node->childNodes->item($i)) instanceof DOMCharacterData) { $node->removeChild($child); } } } } /** * Escapes a string for the use in XML documents. * * Any Unicode character is allowed, excluding the surrogate blocks, FFFE, * and FFFF (not even as character reference). * * @see https://www.w3.org/TR/xml/#charsets */ public static function prepareString(string $string): string { return preg_replace( '/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]/', '', htmlspecialchars( self::convertToUtf8($string), ENT_QUOTES ) ); } /** * "Convert" a DOMElement object into a PHP variable. */ public static function xmlToVariable(DOMElement $element) { $variable = null; switch ($element->tagName) { case 'array': $variable = []; foreach ($element->childNodes as $entry) { if (!$entry instanceof DOMElement || $entry->tagName !== 'element') { continue; } $item = $entry->childNodes->item(0); if ($item instanceof DOMText) { $item = $entry->childNodes->item(1); } $value = self::xmlToVariable($item); if ($entry->hasAttribute('key')) { $variable[(string) $entry->getAttribute('key')] = $value; } else { $variable[] = $value; } } break; case 'object': $className = $element->getAttribute('class'); if ($element->hasChildNodes()) { $arguments = $element->childNodes->item(0)->childNodes; $constructorArgs = []; foreach ($arguments as $argument) { if ($argument instanceof DOMElement) { $constructorArgs[] = self::xmlToVariable($argument); } } try { assert(class_exists($className)); $variable = (new ReflectionClass($className))->newInstanceArgs($constructorArgs); // @codeCoverageIgnoreStart } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), $e->getCode(), $e ); } // @codeCoverageIgnoreEnd } else { $variable = new $className; } break; case 'boolean': $variable = $element->textContent === 'true'; break; case 'integer': case 'double': case 'string': $variable = $element->textContent; settype($variable, $element->tagName); break; } return $variable; } private static function convertToUtf8(string $string): string { if (!self::isUtf8($string)) { $string = mb_convert_encoding($string, 'UTF-8'); } return $string; } private static function isUtf8(string $string): bool { $length = strlen($string); for ($i = 0; $i < $length; $i++) { if (ord($string[$i]) < 0x80) { $n = 0; } elseif ((ord($string[$i]) & 0xE0) === 0xC0) { $n = 1; } elseif ((ord($string[$i]) & 0xF0) === 0xE0) { $n = 2; } elseif ((ord($string[$i]) & 0xF0) === 0xF0) { $n = 3; } else { return false; } for ($j = 0; $j < $n; $j++) { if ((++$i === $length) || ((ord($string[$i]) & 0xC0) !== 0x80)) { return false; } } } return true; } } PK ��Z/k��- - phpunit/src/Util/Filesystem.phpnu �[��� <?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. */ namespace PHPUnit\Util; use const DIRECTORY_SEPARATOR; use function is_dir; use function mkdir; use function str_replace; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class Filesystem { /** * Maps class names to source file names. * * - PEAR CS: Foo_Bar_Baz -> Foo/Bar/Baz.php * - Namespace: Foo\Bar\Baz -> Foo/Bar/Baz.php */ public static function classNameToFilename(string $className): string { return str_replace( ['_', '\\'], DIRECTORY_SEPARATOR, $className ) . '.php'; } public static function createDirectory(string $directory): bool { return !(!is_dir($directory) && !@mkdir($directory, 0777, true) && !is_dir($directory)); } } PK ��ZtqHH� � phpunit/src/Util/Color.phpnu �[��� <?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. */ namespace PHPUnit\Util; use const DIRECTORY_SEPARATOR; use function array_keys; use function array_map; use function array_values; use function count; use function explode; use function implode; use function min; use function preg_replace; use function preg_replace_callback; use function sprintf; use function strtr; use function trim; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class Color { /** * @var array<string,string> */ private const WHITESPACE_MAP = [ ' ' => '·', "\t" => '⇥', ]; /** * @var array<string,string> */ private const WHITESPACE_EOL_MAP = [ ' ' => '·', "\t" => '⇥', "\n" => '↵', "\r" => '⟵', ]; /** * @var array<string,string> */ private static $ansiCodes = [ 'reset' => '0', 'bold' => '1', 'dim' => '2', 'dim-reset' => '22', 'underlined' => '4', 'fg-default' => '39', 'fg-black' => '30', 'fg-red' => '31', 'fg-green' => '32', 'fg-yellow' => '33', 'fg-blue' => '34', 'fg-magenta' => '35', 'fg-cyan' => '36', 'fg-white' => '37', 'bg-default' => '49', 'bg-black' => '40', 'bg-red' => '41', 'bg-green' => '42', 'bg-yellow' => '43', 'bg-blue' => '44', 'bg-magenta' => '45', 'bg-cyan' => '46', 'bg-white' => '47', ]; public static function colorize(string $color, string $buffer): string { if (trim($buffer) === '') { return $buffer; } $codes = array_map('\trim', explode(',', $color)); $styles = []; foreach ($codes as $code) { if (isset(self::$ansiCodes[$code])) { $styles[] = self::$ansiCodes[$code] ?? ''; } } if (empty($styles)) { return $buffer; } return self::optimizeColor(sprintf("\x1b[%sm", implode(';', $styles)) . $buffer . "\x1b[0m"); } public static function colorizePath(string $path, ?string $prevPath = null, bool $colorizeFilename = false): string { if ($prevPath === null) { $prevPath = ''; } $path = explode(DIRECTORY_SEPARATOR, $path); $prevPath = explode(DIRECTORY_SEPARATOR, $prevPath); for ($i = 0; $i < min(count($path), count($prevPath)); $i++) { if ($path[$i] == $prevPath[$i]) { $path[$i] = self::dim($path[$i]); } } if ($colorizeFilename) { $last = count($path) - 1; $path[$last] = preg_replace_callback( '/([\-_\.]+|phpt$)/', static function ($matches) { return self::dim($matches[0]); }, $path[$last] ); } return self::optimizeColor(implode(self::dim(DIRECTORY_SEPARATOR), $path)); } public static function dim(string $buffer): string { if (trim($buffer) === '') { return $buffer; } return "\e[2m{$buffer}\e[22m"; } public static function visualizeWhitespace(string $buffer, bool $visualizeEOL = false): string { $replaceMap = $visualizeEOL ? self::WHITESPACE_EOL_MAP : self::WHITESPACE_MAP; return preg_replace_callback('/\s+/', static function ($matches) use ($replaceMap) { return self::dim(strtr($matches[0], $replaceMap)); }, $buffer); } private static function optimizeColor(string $buffer): string { $patterns = [ "/\e\\[22m\e\\[2m/" => '', "/\e\\[([^m]*)m\e\\[([1-9][0-9;]*)m/" => "\e[$1;$2m", "/(\e\\[[^m]*m)+(\e\\[0m)/" => '$2', ]; return preg_replace(array_keys($patterns), array_values($patterns), $buffer); } } PK ��ZͼQ � � '