diff --git a/.gitignore b/.gitignore index bcf211b3..f1616236 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ composer.lock phpunit.xml phpcs.xml .phpcs.xml +.phpunit.cache +.phpunit.result.cache diff --git a/phpcs.xml.dist b/phpcs.xml.dist index e82b67bc..6da9ad35 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -18,7 +18,7 @@ */src/WP_CLI/JsonManipulator\.php$ */src/WP_CLI/Package/Compat/Min_Composer_1_10/NullIOMethodsTrait\.php$ */src/WP_CLI/Package/Compat/Min_Composer_2_3/NullIOMethodsTrait\.php$ - */tests/test-json-manipulator\.php$ + */tests/JsonManipulatorTest\.php$ diff --git a/phpunit.xml.dist b/phpunit.xml.dist index bcdd6b1c..dc984734 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,11 +1,20 @@ - - - - tests/ - tests/ - - + + + tests + + + + + src + + diff --git a/tests/test-composer-json.php b/tests/ComposerJsonTest.php similarity index 97% rename from tests/test-composer-json.php rename to tests/ComposerJsonTest.php index dcb214c0..82ef7d46 100644 --- a/tests/test-composer-json.php +++ b/tests/ComposerJsonTest.php @@ -28,10 +28,10 @@ public function set_up() { WP_CLI::set_logger( $this->logger ); // Enable exit exception. + $class_wp_cli_capture_exit = new \ReflectionProperty( 'WP_CLI', 'capture_exit' ); $class_wp_cli_capture_exit->setAccessible( true ); - $this->prev_capture_exit = $class_wp_cli_capture_exit->getValue(); - $class_wp_cli_capture_exit->setValue( true ); + $class_wp_cli_capture_exit->setValue( null, true ); $this->temp_dir = Utils\get_temp_dir() . uniqid( 'wp-cli-test-package-composer-json-', true ) . '/'; mkdir( $this->temp_dir ); @@ -44,7 +44,7 @@ public function tear_down() { // Restore exit exception. $class_wp_cli_capture_exit = new \ReflectionProperty( 'WP_CLI', 'capture_exit' ); $class_wp_cli_capture_exit->setAccessible( true ); - $class_wp_cli_capture_exit->setValue( $this->prev_capture_exit ); + $class_wp_cli_capture_exit->setValue( null, $this->prev_capture_exit ); rmdir( $this->temp_dir ); diff --git a/tests/test-json-manipulator.php b/tests/JsonManipulatorTest.php similarity index 99% rename from tests/test-json-manipulator.php rename to tests/JsonManipulatorTest.php index add2727a..026f7bec 100644 --- a/tests/test-json-manipulator.php +++ b/tests/JsonManipulatorTest.php @@ -26,7 +26,7 @@ public function testAddLink($json, $type, $package, $constraint, $expected) $this->assertEquals($expected, $manipulator->getContents()); } - public function linkProvider() + public static function linkProvider() { return array( array( @@ -1297,7 +1297,7 @@ public function testAddLinkAndSortPackages($json, $type, $package, $constraint, $this->assertEquals($expected, $manipulator->getContents()); } - public function providerAddLinkAndSortPackages() + public static function providerAddLinkAndSortPackages() { return array( array( @@ -1380,7 +1380,7 @@ public function testRemoveSubNode($json, $name, $expected, $expectedContent = nu } } - public function removeSubNodeProvider() + public static function removeSubNodeProvider() { return array( 'works on simple ones first' => array( @@ -2374,7 +2374,7 @@ public function testAddLinkCaseInsensitive($json, $type, $package, $constraint, $this->assertEquals($expected, $manipulator->getContents()); } - public function providerAddLinkCaseInsensitive() + public static function providerAddLinkCaseInsensitive() { return array( array( @@ -2441,7 +2441,7 @@ public function testAddSubNodeCase($json, $mainNode, $name, $caseInsensitive, $e $this->assertSame($expected, $manipulator->getContents()); } - public function providerAddSubNodeCase() + public static function providerAddSubNodeCase() { return array( array( @@ -2504,7 +2504,7 @@ public function testRemoveSubNodeCaseInsensitive($json, $mainNode, $name, $expec } } - public function providerRemoveSubNodeCaseInsensitive() + public static function providerRemoveSubNodeCaseInsensitive() { return array( array(