-
Notifications
You must be signed in to change notification settings - Fork 13
Comparing changes
Open a pull request
base repository: Yoast/PHPUnit-Polyfills
base: 0.1.0
head repository: Yoast/PHPUnit-Polyfills
compare: 0.2.0
- 16 commits
- 46 files changed
- 1 contributor
Commits on Nov 13, 2020
-
... and remove the `composer self-update` from the Travis script as it's no longer needed. YoastCS 2.1.0 requires the DealerDirect Composer PHPCS plugin at version `0.7.0`, which is compatible with Composer 2.0. Refs: * https://github.com/Yoast/yoastcs/releases/tag/2.1.0
Configuration menu - View commit details
-
Copy full SHA for be95a38 - Browse repository at this point
Copy the full SHA be95a38View commit details -
Configuration menu - View commit details
-
Copy full SHA for e6093f6 - Browse repository at this point
Copy the full SHA e6093f6View commit details -
Configuration menu - View commit details
-
Copy full SHA for b8507ce - Browse repository at this point
Copy the full SHA b8507ceView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3b9d3a4 - Browse repository at this point
Copy the full SHA 3b9d3a4View commit details
Commits on Nov 25, 2020
-
Configuration menu - View commit details
-
Copy full SHA for ab009b9 - Browse repository at this point
Copy the full SHA ab009b9View commit details -
Autoloader: add "default" case
.. to simplify handling of those files which don't need PHPUnit version based loading. The `default` case translates the class name to the file path based on PSR4 and loads them, without using hard-coded class names nor file paths.
Configuration menu - View commit details
-
Copy full SHA for 5960fb6 - Browse repository at this point
Copy the full SHA 5960fb6View commit details -
Composer: more specific PHPUnit requirements
This ensures that the "forward compatible" namespaced versions of common PHPUnit classes/interfaces are available. PHP 6.0 introduced namespaces to PHPUnit. The last few version(s) of PHPUnit 4.x and 5.x, contain both non-namespaced and namespaced versions of the most commonly referred to classes used by test suites. By being strict about the minimum supported versions of PHPUnit 4.x and 5.x, we can be sure that the namespaced versions of the files are available when we need them and that we don't need to create `class_alias()`-es for these.
Configuration menu - View commit details
-
Copy full SHA for 17b7095 - Browse repository at this point
Copy the full SHA 17b7095View commit details -
TestCase: add support for
assert(Pre|Post)Conditions()fixture methodsAdd cross-version handling of the `assertPreConditions()` and `assertPostConditions()` methods via snake_case methods to the `Yoast\PHPUnitPolyfills\TestCases\TestCase`. Includes unit tests. Includes improving the documentation within the class. Note: these methods are not included in the `XTestCase` as there are no annotations available to handle these methods.
Configuration menu - View commit details
-
Copy full SHA for e5a2e38 - Browse repository at this point
Copy the full SHA e5a2e38View commit details -
New
Helpers\AssertAttributeHelperThe PHPUnit `assertAttribute*()` methods were deprecated in PHPUnit 8.x and removed in PHPUnit 9.0. Public properties can still be tested by accessing them directly. Protected and private properties can no longer be tested using PHPUnit native functionality. The reasoning for the removal of these assertion methods is that _private and protected properties are an implementation detail and should not be tested directly, but via methods in the class_. It is strongly recommended to refactor tests, and if needs be, classes to adhere to this. However, if for some reason the value of protected or private properties still needs to be tested, this helper can be used to get access to their properties and value. Includes tests. Fixes 2
Configuration menu - View commit details
-
Copy full SHA for 45c6489 - Browse repository at this point
Copy the full SHA 45c6489View commit details -
Add a cross-version compatible TestListenerDefaultImplementation
The method signatures in the PHPUnit `TestListener` interface have changed a number of times across versions, including adding scalar parameter (PHP 7.0+) and `void` return type (PHP 7.1+) declarations. Additionally, the use of the TestListener principle has been deprecated in PHPUnit 7 in favour of using the [TestRunner hook interfaces](https://phpunit.readthedocs.io/en/9.3/extending-phpunit.html#extending-the-testrunner). If a test suite does not need to support PHPUnit < 7, it is strongly recommended to use the TestRunner hook interfaces extensions instead. However, for test suites that still need to support PHPUnit 6 or lower, implementing the `TestListener` interface is the only viable option. This commit adds a `Yoast\PHPUnitPolyfills\TestListeners\TestListenerDefaultImplementation` trait which overcomes the signature mismatches by having multiple versions and loading the correct one depending on the PHPUnit version being used. Similar to the `TestCase` implementation, snake_case methods without type declarations are used to get round the signature mismatches. The snake_case methods will automatically be called. Includes tests for this TestListener implementation. Includes making an allowance for the `float` parameter and `void` return type in the PHPUnit 7+ specific testlistener trait in: * the PHPCS config. * the Parallel Lint command.
Configuration menu - View commit details
-
Copy full SHA for 2f1a5e9 - Browse repository at this point
Copy the full SHA 2f1a5e9View commit details -
Remove use of constant scalar expressions
... and allow this package to be installed on PHP 5.5.
Configuration menu - View commit details
-
Copy full SHA for 83ba7e3 - Browse repository at this point
Copy the full SHA 83ba7e3View commit details -
AssertNumericType trait: polyfill the Assert::assertInfinite() et al …
…methods PHPUnit 5.0.0 introduced the new `Assert::assertFinite()`, `Assert::assertInfinite()` and `Assert::assertNan()` methods. This commit: * Adds two traits with the same name. One to polyfill the methods when not available in PHPUnit. The other - an empty trait - to allow for `use`-ing the trait in PHPUnit versions in which the methods are already natively available. * Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used. * An availability test for the functionality polyfilled. Note: the methods use `static::` to call the PHPUnit native functionality. This allows for existing method overloads in a child class of the PHPUnit native `TestCase` to be respected.Configuration menu - View commit details
-
Copy full SHA for 057a83d - Browse repository at this point
Copy the full SHA 057a83dView commit details -
ExpectException trait: polyfill the expectException*() et al methods
PHPUnit 5.2.0 introduced the new `TestCase::expectException()`, `TestCase::expectExceptionCode()`,`TestCase::expectExceptionMessage()` and `TestCase::expectExceptionMessageRegExp()` methods as a replacement for the `Testcase::setExpectedException() method which was deprecated in PHPUnit 5.2.0 and the `Testcase::setExpectedExceptionRegExp()` method which was deprecated in 5.6.0. Both these methods were removed in PHPUnit 6.0.0. This commit: * Adds two traits with the same name. One to polyfill the methods when not available in PHPUnit. The other - an empty trait - to allow for `use`-ing the trait in PHPUnit versions in which the methods are already natively available. * Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used. * An availability test and partial functionality test for the functionality polyfilled. Includes: * Adding the new polyfill to the existing `TestCases` classes. * Adding the new polyfill to select test files to allow those to run and pass on PHPUnit 4.8.x. * Making an allowance in the PHPCS ruleset for an exception quirk which PHPCS can't handle correctly.Configuration menu - View commit details
-
Copy full SHA for b537298 - Browse repository at this point
Copy the full SHA b537298View commit details -
AssertFileDirectory trait: polyfill the Assert::assertIsReadable() et…
… al methods PHPUnit 5.6.0 introduced the new `Assert::assertIsReadable()`, `Assert::assertNotIsReadable()`, `Assert::assertIsWritable()`, `Assert::assertNotIsWritable()`, `Assert::assertDirectoryExists()`, `Assert::assertDirectoryNotExists()`, `Assert::assertDirectoryIsReadable()`, `Assert::assertDirectoryNotIsReadable()`, `Assert::assertDirectoryIsWritable()`, `Assert::assertDirectoryNotIsWritable()`, `Assert::assertFileIsReadable()`, `Assert::assertFileNotIsReadable()`, `Assert::assertFileIsWritable()`, and `Assert::assertFileNotIsWritable()` methods. This commit: * Adds two traits with the same name. One to polyfill the methods when not available in PHPUnit. The other - an empty trait - to allow for `use`-ing the trait in PHPUnit versions in which the methods are already natively available. * Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used. * An availability test for the functionality polyfilled. Note: the methods use `static::` to call the PHPUnit native functionality. This allows for existing method overloads in a child class of the PHPUnit native `TestCase` to be respected. Includes: * Adding the new polyfill to the existing `TestCases` classes. * Adding the new polyfill to select test files to allow those to run and pass on PHPUnit 4.8.x. * Making an allowance in the PHPCS ruleset for an exception quirk which PHPCS can't handle correctly.Configuration menu - View commit details
-
Copy full SHA for 347c768 - Browse repository at this point
Copy the full SHA 347c768View commit details -
Allow installation in combination with PHPUnit 4.8.36
To allow for testing on PHP 5.5, PHPUnit 4 is needed. PHPUnit 4.8.36 is the only version in the 4.x series which contains the forward-compatible layer with the namespaced versions of common PHPUnit classes. With the additional polyfills which have been put in place, installation of this package on PHP 5.5 in combination with PHPUnit 4.8.36 is now supported. Includes annotating this change in all the relevant places. Includes adding a new build to the Travis matrix to also run all tests against PHP 5.5 / PHPUnit 4.8.36.
Configuration menu - View commit details
-
Copy full SHA for 701f40c - Browse repository at this point
Copy the full SHA 701f40cView commit details -
Configuration menu - View commit details
-
Copy full SHA for c48e4cf - Browse repository at this point
Copy the full SHA c48e4cfView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff 0.1.0...0.2.0