Skip to content

Commit

Permalink
Merge pull request #61 from Yoast/JRF/docs-various-updates
Browse files Browse the repository at this point in the history
Docs: various improvements
  • Loading branch information
jrfnl committed Sep 23, 2023
2 parents 7d83656 + 9f0dd80 commit 88ec1b8
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/WPIntegration/Autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class Autoload {
/**
* A list of the classes this autoloader handles.
*
* @var string[] => true
* @var array<string, true>
*/
private static $supported_classes = [
'PHPUnit\\Framework\\MockObject\\Builder\\NamespaceMatch' => true,
Expand Down
24 changes: 24 additions & 0 deletions src/WPIntegration/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ abstract class TestCase extends WP_UnitTestCase {

/**
* Wrapper method for the `set_up_before_class()` method for forward-compatibility with WP 5.9.
*
* @return void
*/
public static function setUpBeforeClass() {
parent::setUpBeforeClass();
Expand All @@ -67,6 +69,8 @@ public static function setUpBeforeClass() {

/**
* Wrapper method for the `tear_down_after_class()` method for forward-compatibility with WP 5.9.
*
* @return void
*/
public static function tearDownAfterClass() {
static::tear_down_after_class();
Expand All @@ -75,6 +79,8 @@ public static function tearDownAfterClass() {

/**
* Wrapper method for the `set_up()` method for forward-compatibility with WP 5.9.
*
* @return void
*/
public function setUp() {
parent::setUp();
Expand All @@ -83,6 +89,8 @@ public function setUp() {

/**
* Wrapper method for the `tear_down()` method for forward-compatibility with WP 5.9.
*
* @return void
*/
public function tearDown() {
$this->tear_down();
Expand All @@ -91,6 +99,8 @@ public function tearDown() {

/**
* Wrapper method for the `assert_pre_conditions()` method for forward-compatibility with WP 5.9.
*
* @return void
*/
protected function assertPreConditions() {
parent::assertPreConditions();
Expand All @@ -99,6 +109,8 @@ protected function assertPreConditions() {

/**
* Wrapper method for the `assert_post_conditions()` method for forward-compatibility with WP 5.9.
*
* @return void
*/
protected function assertPostConditions() {
parent::assertPostConditions();
Expand All @@ -107,31 +119,43 @@ protected function assertPostConditions() {

/**
* Placeholder method for forward-compatibility with WP 5.9.
*
* @return void
*/
public static function set_up_before_class() {}

/**
* Placeholder method for forward-compatibility with WP 5.9.
*
* @return void
*/
public static function tear_down_after_class() {}

/**
* Placeholder method for forward-compatibility with WP 5.9.
*
* @return void
*/
protected function set_up() {}

/**
* Placeholder method for forward-compatibility with WP 5.9.
*
* @return void
*/
protected function tear_down() {}

/**
* Placeholder method for forward-compatibility with WP 5.9.
*
* @return void
*/
protected function assert_pre_conditions() {}

/**
* Placeholder method for forward-compatibility with WP 5.9.
*
* @return void
*/
protected function assert_post_conditions() {}
}
4 changes: 2 additions & 2 deletions tests/BrainMonkey/TestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function testMakeDoubleForUnavailableClass( $class_name ) {
/**
* Data provider.
*
* @return array
* @return array<string, array<string>>
*/
public function dataMakeDoubleForUnavailableClass() {
return [
Expand Down Expand Up @@ -218,7 +218,7 @@ public function testMakeDoubleForUnavailableClassThrowsExceptionWithInvalidName(
/**
* Data provider.
*
* @return array
* @return array<string, array<string>>
*/
public function dataMakeDoubleForUnavailableClassThrowsExceptionWithInvalidName() {
return [
Expand Down
22 changes: 11 additions & 11 deletions tests/BrainMonkey/YoastTestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testStubGetBlogInfo( $show, $expected ) {
/**
* Data provider.
*
* @return array
* @return array<string, array<string, string>>
*/
public function dataStubGetBlogInfo() {
return [
Expand Down Expand Up @@ -125,9 +125,9 @@ public function testStubWpKsesPost() {
*
* @dataProvider dataStubWpParseArgs
*
* @param array $settings Value for settings to pass to the function.
* @param array $defaults Value for defaults to pass to the function.
* @param array $expected Expected return value.
* @param array<string, mixed> $settings Value for settings to pass to the function.
* @param array<string, mixed> $defaults Value for defaults to pass to the function.
* @param array<string, mixed> $expected Expected return value.
*
* @return void
*/
Expand All @@ -138,7 +138,7 @@ public function testStubWpParseArgs( $settings, $defaults, $expected ) {
/**
* Data provider.
*
* @return array
* @return array<string, array<string, array<string, mixed>>>
*/
public function dataStubWpParseArgs() {
return [
Expand Down Expand Up @@ -219,7 +219,7 @@ public function testStubWpStripAllTags( $text, $remove_breaks, $expected ) {
/**
* Data provider.
*
* @return array
* @return array<string, array<string, string|bool>>
*/
public function dataStubWpStripAllTags() {
return [
Expand Down Expand Up @@ -271,7 +271,7 @@ public function dataStubWpStripAllTags() {
*
* @dataProvider dataStubWpSlash
*
* @param string $input Value to pass to the function.
* @param mixed $input Value to pass to the function.
*
* @return void
*/
Expand All @@ -282,7 +282,7 @@ public function testStubWpSlash( $input ) {
/**
* Data provider.
*
* @return array
* @return array<string, array<string, mixed>>
*/
public function dataStubWpSlash() {
return [
Expand All @@ -308,8 +308,8 @@ public function dataStubWpSlash() {
*
* @dataProvider dataStubWpUnslash
*
* @param string $input Value to pass to the function.
* @param string $expected Expected return value.
* @param mixed $input Value to pass to the function.
* @param mixed $expected Expected return value.
*
* @return void
*/
Expand All @@ -320,7 +320,7 @@ public function testStubWpUnslash( $input, $expected ) {
/**
* Data provider.
*
* @return array
* @return array<string, array<string, mixed>>
*/
public function dataStubWpUnslash() {
return [
Expand Down
4 changes: 2 additions & 2 deletions tests/Helpers/ExpectOutputHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function testMatchingSubstringsWithMismatchedLineEndingsAmount( $expected
/**
* Data provider.
*
* @return array
* @return array<array<string>>
*/
public function dataMatchingSubstringsMismatchedLineEndings() {
return [
Expand Down Expand Up @@ -231,7 +231,7 @@ public function testNormalizeLineEndings( $input, $expected ) {
/**
* Data provider for the `testNormalizeLineEndings()` test.
*
* @return array
* @return array<string, array<string>>
*/
public function dataNormalizeLineEndings() {
return [
Expand Down

0 comments on commit 88ec1b8

Please sign in to comment.