InterNACHI / modular

Modularize your Laravel application
MIT License
800 stars 65 forks source link

Remove unexpected formatOutput #69

Open hettiger opened 9 months ago

hettiger commented 9 months ago

Fixes #66

inxilpro commented 7 months ago

@hettiger what version of PHP and Pest are you using? The formatOutput flag shouldn't affect the XML that's produced at all. It just tells PHP to format the XML output…

hettiger commented 7 months ago

@hettiger what version of PHP and Pest are you using? The formatOutput flag shouldn't affect the XML that's produced at all. It just tells PHP to format the XML output…

Hi @inxilpro I'm using PHP 8.3 and Pest 2.

Reproduction steps:

  1. laravel new demo
  2. cd demo
  3. composer require internachi/modular
  4. php artisan modules:sync
  5. vendor/bin/pest
pest

   WARN  Test results may not be as expected because the XML configuration file did not pass validation:

  Line 29:
  - Element 'formatOutput': This element is not expected.

   PASS  Tests\Unit\ExampleTest
  ✓ that true is true                                                                                                                                                                                                           0.01s

   PASS  Tests\Feature\ExampleTest
  ✓ it returns a successful response                                                                                                                                                                                            0.15s

  Tests:    2 passed (2 assertions)
  Duration: 0.26s
diff --git a/phpunit.xml b/phpunit.xml
index 506b9a3..c4be529 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -1,9 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
-         bootstrap="vendor/autoload.php"
-         colors="true"
->
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
     <testsuites>
         <testsuite name="Unit">
             <directory>tests/Unit</directory>
@@ -11,7 +7,7 @@
         <testsuite name="Feature">
             <directory>tests/Feature</directory>
         </testsuite>
-    </testsuites>
+    <testsuite name="Modules"><directory suffix="Test.php">./app-modules/*/tests</directory></testsuite></testsuites>
     <source>
         <include>
             <directory>app</directory>
@@ -30,4 +26,4 @@
         <env name="SESSION_DRIVER" value="array"/>
         <env name="TELESCOPE_ENABLED" value="false"/>
     </php>
-</phpunit>
+<formatOutput>1</formatOutput></phpunit>
php -v
PHP 8.3.3 (cli) (built: Feb 16 2024 00:34:53) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.3, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.3, Copyright (c), by Zend Technologies

1818-        {
1819:            "name": "laravel/framework",
1820-            "version": "v11.2.0",
1821-            "source": {
1822-                "type": "git",
1823:                "url": "https://github.com/laravel/framework.git",
1824-                "reference": "a1750156b671f37cba702380107e2d22161c31e3"
1825-            },

7734-        {
7735:            "name": "pestphp/pest",
7736-            "version": "v2.34.7",
7737-            "source": {
7738-                "type": "git",
7739:                "url": "https://github.com/pestphp/pest.git",
7740-                "reference": "a7a3e4240e341d0fee1c54814ce18adc26ce5a76"
7741-            },

8711-        {
8712:            "name": "phpunit/phpunit",
8713-            "version": "10.5.17",
8714-            "source": {
8715-                "type": "git",
8716-                "url": "https://github.com/sebastianbergmann/phpunit.git",
8717-                "reference": "c1f736a473d21957ead7e94fcc029f571895abf5"

Of course i verified that removing the line $config->formatOutput = true; actually fixes the issue:

diff --git a/phpunit.xml b/phpunit.xml
index 506b9a3..af88ea5 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -1,9 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
-         bootstrap="vendor/autoload.php"
-         colors="true"
->
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
     <testsuites>
         <testsuite name="Unit">
             <directory>tests/Unit</directory>
@@ -11,7 +7,7 @@
         <testsuite name="Feature">
             <directory>tests/Feature</directory>
         </testsuite>
-    </testsuites>
+    <testsuite name="Modules"><directory suffix="Test.php">./app-modules/*/tests</directory></testsuite></testsuites>
     <source>
         <include>
             <directory>app</directory>
bartdenhoed commented 3 months ago

I have the same issue. Also using PHP 8.3 and Pest 2

binaryfire commented 5 days ago

Same issue here.