From c7d0c0f12a0382d9324519614cc5d7bcc7cc8b63 Mon Sep 17 00:00:00 2001
From: Iman Ghafoori <imanghafoori1@gmail.com>
Date: Sat, 15 Jun 2024 11:31:29 +0330
Subject: [PATCH] Update phpunit.xml.dist

---
 .gitattributes                      |  3 +-
 .github/workflows/code_coverage.yml | 60 +++++++++++++++++++++++++++++
 .github/workflows/tests.yml         | 12 ++++--
 README.md                           |  2 +-
 composer.json                       |  2 +-
 phpunit.xml.dist                    | 22 -----------
 phpunit_conf/coverage.xml.dist      | 19 +++++++++
 phpunit_conf/phpunit_7.2.xml.dist   | 33 ++++++++++++++++
 phpunit_conf/phpunit_7.3.xml.dist   | 33 ++++++++++++++++
 phpunit_conf/phpunit_7.4.xml.dist   | 33 ++++++++++++++++
 phpunit_conf/phpunit_8.1.xml.dist   | 33 ++++++++++++++++
 phpunit_conf/phpunit_8.2.xml.dist   | 29 ++++++++++++++
 phpunit_conf/phpunit_8.3.xml.dist   | 19 +++++++++
 phpunit_conf/phpunit_8.xml.dist     | 33 ++++++++++++++++
 src/BladeDirective.php              |  3 ++
 src/RouteMacros.php                 |  3 ++
 src/WidgetGenerator.php             |  3 ++
 src/WidgetsServiceProvider.php      |  3 ++
 18 files changed, 315 insertions(+), 30 deletions(-)
 create mode 100644 .github/workflows/code_coverage.yml
 delete mode 100644 phpunit.xml.dist
 create mode 100644 phpunit_conf/coverage.xml.dist
 create mode 100644 phpunit_conf/phpunit_7.2.xml.dist
 create mode 100644 phpunit_conf/phpunit_7.3.xml.dist
 create mode 100644 phpunit_conf/phpunit_7.4.xml.dist
 create mode 100644 phpunit_conf/phpunit_8.1.xml.dist
 create mode 100644 phpunit_conf/phpunit_8.2.xml.dist
 create mode 100644 phpunit_conf/phpunit_8.3.xml.dist
 create mode 100644 phpunit_conf/phpunit_8.xml.dist

diff --git a/.gitattributes b/.gitattributes
index 08939b8..f8a2d17 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -6,10 +6,9 @@
 /.gitignore         export-ignore
 /.travis.yml        export-ignore
 /.styleci.yml       export-ignore
-/phpunit.xml.dist   export-ignore
-/phpunit.xml        export-ignore
 /readme.md          export-ignore
 /phpunit.bat        export-ignore
 /.scrutinizer.yml   export-ignore
 /tests              export-ignore
 /.editorconfig      export-ignore
+/phpunit_conf       export-ignore
diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml
new file mode 100644
index 0000000..3a98399
--- /dev/null
+++ b/.github/workflows/code_coverage.yml
@@ -0,0 +1,60 @@
+name: Code Coverage
+
+# Controls when the workflow will run
+on:
+  push:
+    branches: [master]
+  pull_request:
+    branches: [master]
+
+  # Allows you to run this workflow manually from the Actions tab
+  workflow_dispatch:
+
+# A workflow run is made up of one or more jobs that can run sequentially or in parallel
+jobs:
+  test:
+    # The type of runner that the job will run on
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: true
+      matrix:
+        os: [ubuntu-latest]
+        php: [8.3]
+        laravel: [10.*]
+    name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - OS ${{ matrix.os }}
+
+    steps:
+        - name: Checkout code
+          uses: actions/checkout@v4
+          with:
+            fetch-depth: 3
+        - name: Setup PHP v${{ matrix.php }}
+          uses: shivammathur/setup-php@v2
+          with:
+              php-version: ${{ matrix.php }}
+              extensions: mbstring, exif, iconv, tokenizer, fileinfo, xdebug
+              coverage: xdebug
+
+        - name: Install dependencies
+          run: |
+              composer require "laravel/framework=${{ matrix.laravel }}" --no-update
+              composer update --prefer-dist --no-interaction --no-progress
+
+        - name: PHPUnit
+          run: |
+            ./vendor/bin/phpunit --stop-on-failure --coverage-clover ./clover.xml -c ./phpunit_conf/coverage.xml.dist
+          env:
+            XDEBUG_MODE: coverage
+
+        #- name: Make code coverage badge
+        #  uses: timkrase/phpunit-coverage-badge@v1.2.1
+        #  with:
+        #    coverage_badge_path: output/coverage.svg
+        #    repo_token: ${{ secrets.GITHUB_TOKEN }}
+        #    push_badge: true
+        - name: Upload coverage results to Coveralls
+          env:
+            COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          run: |
+            composer global require php-coveralls/php-coveralls
+            php-coveralls --coverage_clover=./clover.xml --json_path=./coverall.xml -v 
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 81848ae..1539d80 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -20,7 +20,7 @@ jobs:
       matrix:
         os: [ubuntu-latest, windows-latest]
         php: [7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3]
-        laravel: [6.*, 7.*, 8.*, 9.*, 10.*, 11.*]
+        laravel: [6.*, 7.*, 8.*, 9.*, 10.*]
         exclude:
           - php: 7.2
             laravel: 8.*
@@ -62,12 +62,15 @@ jobs:
             laravel: 11.*
           - php: 8.0
             laravel: 11.*
+          - php: 8.1
+            laravel: 11.*
     name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - OS ${{ matrix.os }}
 
     steps:
         - name: Checkout code
           uses: actions/checkout@v2
-
+          with:
+            fetch-depth: 1
         - name: Setup PHP
           uses: shivammathur/setup-php@v2
           with:
@@ -79,5 +82,6 @@ jobs:
           run: |
               composer require "laravel/framework=${{ matrix.laravel }}" --no-update
               composer update --prefer-dist --no-interaction --no-progress
-        - name: Run tests
-          run: vendor/bin/phpunit
+        - name: PHPUnit
+          run: |
+            ./vendor/bin/phpunit --stop-on-failure -c ./phpunit_conf/phpunit_${{ matrix.php }}.xml.dist
\ No newline at end of file
diff --git a/README.md b/README.md
index f13d6be..6c7291e 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ Laravel Widgetize
 [![Latest Stable Version](https://poser.pugx.org/imanghafoori/laravel-widgetize/v/stable)](https://packagist.org/packages/imanghafoori/laravel-widgetize)
 [![Awesome Laravel](https://img.shields.io/badge/Awesome-Laravel-brightgreen.svg)](https://github.com/chiraggude/awesome-laravel)
 [![Monthly Downloads](https://poser.pugx.org/imanghafoori/laravel-widgetize/d/monthly)](https://packagist.org/packages/imanghafoori/laravel-widgetize/stats)
-[![Code Coverage](https://scrutinizer-ci.com/g/imanghafoori1/laravel-widgetize/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/imanghafoori1/laravel-widgetize/?branch=master)
+[![Coverage Status](https://coveralls.io/repos/github/imanghafoori1/laravel-widgetize/badge.svg?branch=master)](https://coveralls.io/github/imanghafoori1/laravel-widgetize?branch=master)
 [![tests](https://github.com/imanghafoori1/laravel-widgetize/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/imanghafoori1/laravel-widgetize/actions/workflows/tests.yml)
 [![Imports](https://github.com/imanghafoori1/laravel-widgetize/actions/workflows/imports.yml/badge.svg?branch=master)](https://github.com/imanghafoori1/laravel-widgetize/actions/workflows/imports.yml)
 </p>
diff --git a/composer.json b/composer.json
index 6053ab3..2617ece 100644
--- a/composer.json
+++ b/composer.json
@@ -20,7 +20,7 @@
         }
     },
     "require-dev": {
-        "orchestra/testbench": "~3.0|~4.0|~5.0|~6.0|~7.0|~8.0",
+        "orchestra/testbench": "~3.0|~4.0|~5.0|~6.0|~7.0|~8.0|~9.0|~10.0",
         "imanghafoori/php-imports-analyzer": "1.0.*",
         "barryvdh/laravel-debugbar": ">=v1.0.0",
         "mockery/mockery": ">=0.9"
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
deleted file mode 100644
index b0bcbd5..0000000
--- a/phpunit.xml.dist
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<phpunit
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        backupGlobals="false"
-        bootstrap="vendor/autoload.php"
-        colors="true"
-        processIsolation="false"
-        stopOnError="false"
-        stopOnFailure="false"
-        xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
->
-  <testsuites>
-    <testsuite name="Package Test Suite">
-      <directory suffix="Test.php">./tests/</directory>
-    </testsuite>
-  </testsuites>
-  <php>
-    <env name="APP_ENV" value="testing"/>
-    <env name="CACHE_DRIVER" value="array"/>
-    <env name="SESSION_DRIVER" value="array"/>
-  </php>
-</phpunit>
diff --git a/phpunit_conf/coverage.xml.dist b/phpunit_conf/coverage.xml.dist
new file mode 100644
index 0000000..3baca35
--- /dev/null
+++ b/phpunit_conf/coverage.xml.dist
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="./../vendor/autoload.php" executionOrder="depends,defects" beStrictAboutOutputDuringTests="true" failOnRisky="true" failOnWarning="true" backupGlobals="false" colors="true" processIsolation="false" stopOnError="false" stopOnFailure="false" cacheDirectory=".phpunit.cache">
+  <testsuites>
+    <testsuite name="default">
+      <directory>./../tests</directory>
+    </testsuite>
+  </testsuites>
+  <php>
+    <env name="APP_ENV" value="testing"/>
+    <env name="CACHE_DRIVER" value="array"/>
+    <env name="SESSION_DRIVER" value="array"/>
+  </php>
+  <source>
+    <include>
+      <directory suffix=".php">./../src</directory>
+    </include>
+    <exclude/>
+  </source>
+</phpunit>
diff --git a/phpunit_conf/phpunit_7.2.xml.dist b/phpunit_conf/phpunit_7.2.xml.dist
new file mode 100644
index 0000000..6867756
--- /dev/null
+++ b/phpunit_conf/phpunit_7.2.xml.dist
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
+         bootstrap="./../vendor/autoload.php"
+         executionOrder="depends,defects"
+         beStrictAboutOutputDuringTests="true"
+         failOnRisky="true"
+         failOnWarning="true"
+		 backupGlobals="false"
+		 colors="true"
+		 processIsolation="false"
+		 stopOnError="false"
+		 stopOnFailure="false"
+         >
+
+    <testsuites>
+        <testsuite name="default">
+            <directory>./../tests</directory>
+        </testsuite>
+    </testsuites>
+
+	 <filter>
+		<whitelist processUncoveredFilesFromWhitelist="true">
+			<directory suffix=".php">./../src</directory>
+			<exclude></exclude>
+		</whitelist>
+	 </filter>
+	  <php>
+        <env name="APP_ENV" value="testing"/>
+        <env name="CACHE_DRIVER" value="array"/>
+        <env name="SESSION_DRIVER" value="array"/>
+      </php>
+</phpunit>
diff --git a/phpunit_conf/phpunit_7.3.xml.dist b/phpunit_conf/phpunit_7.3.xml.dist
new file mode 100644
index 0000000..6867756
--- /dev/null
+++ b/phpunit_conf/phpunit_7.3.xml.dist
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
+         bootstrap="./../vendor/autoload.php"
+         executionOrder="depends,defects"
+         beStrictAboutOutputDuringTests="true"
+         failOnRisky="true"
+         failOnWarning="true"
+		 backupGlobals="false"
+		 colors="true"
+		 processIsolation="false"
+		 stopOnError="false"
+		 stopOnFailure="false"
+         >
+
+    <testsuites>
+        <testsuite name="default">
+            <directory>./../tests</directory>
+        </testsuite>
+    </testsuites>
+
+	 <filter>
+		<whitelist processUncoveredFilesFromWhitelist="true">
+			<directory suffix=".php">./../src</directory>
+			<exclude></exclude>
+		</whitelist>
+	 </filter>
+	  <php>
+        <env name="APP_ENV" value="testing"/>
+        <env name="CACHE_DRIVER" value="array"/>
+        <env name="SESSION_DRIVER" value="array"/>
+      </php>
+</phpunit>
diff --git a/phpunit_conf/phpunit_7.4.xml.dist b/phpunit_conf/phpunit_7.4.xml.dist
new file mode 100644
index 0000000..6867756
--- /dev/null
+++ b/phpunit_conf/phpunit_7.4.xml.dist
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
+         bootstrap="./../vendor/autoload.php"
+         executionOrder="depends,defects"
+         beStrictAboutOutputDuringTests="true"
+         failOnRisky="true"
+         failOnWarning="true"
+		 backupGlobals="false"
+		 colors="true"
+		 processIsolation="false"
+		 stopOnError="false"
+		 stopOnFailure="false"
+         >
+
+    <testsuites>
+        <testsuite name="default">
+            <directory>./../tests</directory>
+        </testsuite>
+    </testsuites>
+
+	 <filter>
+		<whitelist processUncoveredFilesFromWhitelist="true">
+			<directory suffix=".php">./../src</directory>
+			<exclude></exclude>
+		</whitelist>
+	 </filter>
+	  <php>
+        <env name="APP_ENV" value="testing"/>
+        <env name="CACHE_DRIVER" value="array"/>
+        <env name="SESSION_DRIVER" value="array"/>
+      </php>
+</phpunit>
diff --git a/phpunit_conf/phpunit_8.1.xml.dist b/phpunit_conf/phpunit_8.1.xml.dist
new file mode 100644
index 0000000..03086a5
--- /dev/null
+++ b/phpunit_conf/phpunit_8.1.xml.dist
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
+         bootstrap="./../vendor/autoload.php"
+         executionOrder="depends,defects"
+         beStrictAboutOutputDuringTests="true"
+         failOnRisky="true"
+         failOnWarning="true"
+		 backupGlobals="false"
+		 colors="true"
+		 processIsolation="false"
+		 stopOnError="false"
+		 stopOnFailure="false"
+         >
+
+    <testsuites>
+        <testsuite name="default">
+            <directory>./../tests</directory>
+        </testsuite>
+    </testsuites>
+
+	 <filter>
+		<whitelist processUncoveredFilesFromWhitelist="true">
+			<directory suffix=".php">./../src</directory>
+			<exclude></exclude>
+		</whitelist>
+	 </filter>
+	  <php>
+        <env name="APP_ENV" value="testing"/>
+        <env name="CACHE_DRIVER" value="array"/>
+        <env name="SESSION_DRIVER" value="array"/>
+      </php>
+</phpunit>
\ No newline at end of file
diff --git a/phpunit_conf/phpunit_8.2.xml.dist b/phpunit_conf/phpunit_8.2.xml.dist
new file mode 100644
index 0000000..b56b771
--- /dev/null
+++ b/phpunit_conf/phpunit_8.2.xml.dist
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
+         bootstrap="./../vendor/autoload.php"
+         cacheDirectory=".phpunit.cache"
+         executionOrder="depends,defects"
+         requireCoverageMetadata="false"
+         beStrictAboutCoverageMetadata="false"
+         beStrictAboutOutputDuringTests="true"
+         failOnRisky="true"
+         failOnWarning="true"
+         >
+
+    <testsuites>
+        <testsuite name="default">
+            <directory>./../tests</directory>
+        </testsuite>
+    </testsuites>
+    <source restrictDeprecations="true" restrictNotices="true" restrictWarnings="true">
+        <include>
+            <directory>./../src</directory>
+        </include>
+    </source>
+	  <php>
+        <env name="APP_ENV" value="testing"/>
+        <env name="CACHE_DRIVER" value="array"/>
+        <env name="SESSION_DRIVER" value="array"/>
+      </php>
+</phpunit>
\ No newline at end of file
diff --git a/phpunit_conf/phpunit_8.3.xml.dist b/phpunit_conf/phpunit_8.3.xml.dist
new file mode 100644
index 0000000..3baca35
--- /dev/null
+++ b/phpunit_conf/phpunit_8.3.xml.dist
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="./../vendor/autoload.php" executionOrder="depends,defects" beStrictAboutOutputDuringTests="true" failOnRisky="true" failOnWarning="true" backupGlobals="false" colors="true" processIsolation="false" stopOnError="false" stopOnFailure="false" cacheDirectory=".phpunit.cache">
+  <testsuites>
+    <testsuite name="default">
+      <directory>./../tests</directory>
+    </testsuite>
+  </testsuites>
+  <php>
+    <env name="APP_ENV" value="testing"/>
+    <env name="CACHE_DRIVER" value="array"/>
+    <env name="SESSION_DRIVER" value="array"/>
+  </php>
+  <source>
+    <include>
+      <directory suffix=".php">./../src</directory>
+    </include>
+    <exclude/>
+  </source>
+</phpunit>
diff --git a/phpunit_conf/phpunit_8.xml.dist b/phpunit_conf/phpunit_8.xml.dist
new file mode 100644
index 0000000..03086a5
--- /dev/null
+++ b/phpunit_conf/phpunit_8.xml.dist
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
+         bootstrap="./../vendor/autoload.php"
+         executionOrder="depends,defects"
+         beStrictAboutOutputDuringTests="true"
+         failOnRisky="true"
+         failOnWarning="true"
+		 backupGlobals="false"
+		 colors="true"
+		 processIsolation="false"
+		 stopOnError="false"
+		 stopOnFailure="false"
+         >
+
+    <testsuites>
+        <testsuite name="default">
+            <directory>./../tests</directory>
+        </testsuite>
+    </testsuites>
+
+	 <filter>
+		<whitelist processUncoveredFilesFromWhitelist="true">
+			<directory suffix=".php">./../src</directory>
+			<exclude></exclude>
+		</whitelist>
+	 </filter>
+	  <php>
+        <env name="APP_ENV" value="testing"/>
+        <env name="CACHE_DRIVER" value="array"/>
+        <env name="SESSION_DRIVER" value="array"/>
+      </php>
+</phpunit>
\ No newline at end of file
diff --git a/src/BladeDirective.php b/src/BladeDirective.php
index d3678d7..b090c77 100644
--- a/src/BladeDirective.php
+++ b/src/BladeDirective.php
@@ -4,6 +4,9 @@
 
 use Illuminate\Support\Facades\Blade;
 
+/**
+ * @codeCoverageIgnore
+ */
 class BladeDirective
 {
     private static $expression;
diff --git a/src/RouteMacros.php b/src/RouteMacros.php
index b1bb545..8023b6f 100644
--- a/src/RouteMacros.php
+++ b/src/RouteMacros.php
@@ -4,6 +4,9 @@
 
 use Illuminate\Support\Facades\Route;
 
+/**
+ * @codeCoverageIgnore
+ */
 class RouteMacros
 {
     public function registerMacros()
diff --git a/src/WidgetGenerator.php b/src/WidgetGenerator.php
index ad5ff7c..288c0a0 100644
--- a/src/WidgetGenerator.php
+++ b/src/WidgetGenerator.php
@@ -5,6 +5,9 @@
 use Illuminate\Console\GeneratorCommand as LaravelGeneratorCommand;
 use Symfony\Component\Console\Input\InputOption;
 
+/**
+ * @codeCoverageIgnore
+ */
 class WidgetGenerator extends LaravelGeneratorCommand
 {
     /**
diff --git a/src/WidgetsServiceProvider.php b/src/WidgetsServiceProvider.php
index 0ab7047..f29eb98 100644
--- a/src/WidgetsServiceProvider.php
+++ b/src/WidgetsServiceProvider.php
@@ -5,6 +5,9 @@
 use DebugBar\DataCollector\MessagesCollector;
 use Illuminate\Support\ServiceProvider;
 
+/**
+ * @codeCoverageIgnore
+ */
 class WidgetsServiceProvider extends ServiceProvider
 {
     /**