Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Doctrine2 with Doctrine in Codeception recipe #1600

Merged

Conversation

W0rma
Copy link
Contributor

@W0rma W0rma commented Mar 4, 2024

@symfony-recipes-bot symfony-recipes-bot enabled auto-merge (squash) March 4, 2024 06:39
Copy link

github-actions bot commented Mar 4, 2024

Thanks for the PR 😍

How to test these changes in your application

  1. Define the SYMFONY_ENDPOINT environment variable:

    # On Unix-like (BSD, Linux and macOS)
    export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes-contrib/flex/pull-1600/index.json
    # On Windows
    SET SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes-contrib/flex/pull-1600/index.json
  2. Install the package(s) related to this recipe:

    composer req 'symfony/flex:^1.16'
    composer req 'codeception/codeception:^5.0'
  3. Don't forget to unset the SYMFONY_ENDPOINT environment variable when done:

    # On Unix-like (BSD, Linux and macOS)
    unset SYMFONY_ENDPOINT
    # On Windows
    SET SYMFONY_ENDPOINT=

Diff between recipe versions

In order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes.
I'm going keep this comment up to date with any updates of the attached patch.

codeception/codeception

2.3 vs 5.0
diff --git a/codeception/codeception/2.3/codeception.yml b/codeception/codeception/5.0/codeception.yml
index 3007d95c..8b422dcb 100644
--- a/codeception/codeception/2.3/codeception.yml
+++ b/codeception/codeception/5.0/codeception.yml
@@ -1,9 +1,10 @@
 namespace: App\Tests
+support_namespace: Support
 paths:
     tests: tests
     output: tests/_output
-    data: tests/_data
-    support: tests/_support
+    data: tests/Support/Data
+    support: tests/Support
     envs: tests/_envs
 actor_suffix: Tester
 extensions:
@@ -11,3 +12,8 @@ extensions:
         - Codeception\Extension\RunFailed
 params:
     - .env
+    - .env.test
+settings:
+    shuffle: true
+    colors: true
+    report_useless_tests: true
diff --git a/codeception/codeception/2.3/post-install.txt b/codeception/codeception/5.0/post-install.txt
index 59f6b133..3bff19f4 100644
--- a/codeception/codeception/2.3/post-install.txt
+++ b/codeception/codeception/5.0/post-install.txt
@@ -1,14 +1,13 @@
-File codeception.yml created        <- global configuration
-tests/unit created                  <- unit tests
-tests/unit.suite.yml written        <- unit tests suite configuration
-tests/functional created            <- functional tests
-tests/functional.suite.yml written  <- functional tests suite configuration
-tests/acceptance created            <- acceptance tests
-tests/acceptance.suite.yml written  <- acceptance tests suite configuration
-Codeception is installed for acceptance, functional, and unit testing
-Next steps:
-1. Edit tests/acceptance.suite.yml to set the url of your application. Change PhpBrowser to WebDriver to enable browser testing.
-2. Edit tests/functional.suite.yml to enable Doctrine module if needed.
-3. Create your first acceptance test using vendor/bin/codecept g:cest Acceptance First
-4. Write your first test in tests/acceptance/FirstCest.php
-5. Run tests using: vendor/bin/codecept run
+codeception.yml written             <- Global configuration
+tests/Unit/ created                 <- Unit tests
+tests/Unit.suite.yml written        <- Unit test suite configuration
+tests/Functional/ created           <- Functional tests
+tests/Functional.suite.yml written  <- Functional test suite configuration
+tests/Acceptance/ created           <- Acceptance tests
+tests/Acceptance.suite.yml written  <- Acceptance test suite configuration
+Codeception is installed for acceptance, functional, and unit testing
+Next steps:
+1. Edit tests/Functional.suite.yml to enable the Doctrine module if needed
+2. Create your first acceptance test using vendor/bin/codecept generate:cest Acceptance First
+3. Write your first test in tests/Acceptance/FirstCest.php
+4. Run tests using: vendor/bin/codecept run
diff --git a/codeception/codeception/2.3/tests/_data/.gitignore b/codeception/codeception/5.0/tests/Acceptance/.gitignore
similarity index 100%
rename from codeception/codeception/2.3/tests/_data/.gitignore
rename to codeception/codeception/5.0/tests/Acceptance/.gitignore
diff --git a/codeception/codeception/5.0/tests/Acceptance.suite.yml b/codeception/codeception/5.0/tests/Acceptance.suite.yml
new file mode 100644
index 00000000..ab022c39
--- /dev/null
+++ b/codeception/codeception/5.0/tests/Acceptance.suite.yml
@@ -0,0 +1,15 @@
+# Codeception Acceptance Test Suite Configuration
+#
+# Perform tests in a browser by either emulating one using PhpBrowser, or in a real browser using WebDriver.
+# If you need both WebDriver and PhpBrowser tests, create a separate suite for each.
+
+actor: AcceptanceTester
+modules:
+    enabled:
+        - PhpBrowser:
+            url: https://localhost:8000
+# Add Codeception\Step\Retry trait to AcceptanceTester to enable retries
+step_decorators:
+    - Codeception\Step\ConditionalAssertion
+    - Codeception\Step\TryTo
+    - Codeception\Step\Retry
diff --git a/codeception/codeception/2.3/tests/acceptance/.gitignore b/codeception/codeception/5.0/tests/Functional/.gitignore
similarity index 100%
rename from codeception/codeception/2.3/tests/acceptance/.gitignore
rename to codeception/codeception/5.0/tests/Functional/.gitignore
diff --git a/codeception/codeception/5.0/tests/Functional.suite.yml b/codeception/codeception/5.0/tests/Functional.suite.yml
new file mode 100644
index 00000000..68e8882e
--- /dev/null
+++ b/codeception/codeception/5.0/tests/Functional.suite.yml
@@ -0,0 +1,15 @@
+# Codeception Test Suite Configuration
+#
+# Suite for functional tests
+# Emulate web requests and make application process them
+
+actor: FunctionalTester
+modules:
+    enabled:
+        - Asserts
+        - Symfony:
+              app_path: 'src'
+              environment: 'test'
+#        - Doctrine:
+#              depends: Symfony
+#              cleanup: true
diff --git a/codeception/codeception/2.3/tests/_support/AcceptanceTester.php b/codeception/codeception/5.0/tests/Support/AcceptanceTester.php
similarity index 77%
rename from codeception/codeception/2.3/tests/_support/AcceptanceTester.php
rename to codeception/codeception/5.0/tests/Support/AcceptanceTester.php
index e0b036bc..975baabd 100644
--- a/codeception/codeception/2.3/tests/_support/AcceptanceTester.php
+++ b/codeception/codeception/5.0/tests/Support/AcceptanceTester.php
@@ -1,10 +1,14 @@
 <?php
-namespace App\Tests;
+
+declare(strict_types=1);
+
+namespace App\Tests\Support;
 
 /**
  * Inherited Methods
- * @method void wantToTest($text)
+ *
  * @method void wantTo($text)
+ * @method void wantToTest($text)
  * @method void execute($callable)
  * @method void expectTo($prediction)
  * @method void expect($prediction)
@@ -12,7 +16,7 @@ namespace App\Tests;
  * @method void am($role)
  * @method void lookForwardTo($achieveValue)
  * @method void comment($description)
- * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
+ * @method void pause($vars = [])
  *
  * @SuppressWarnings(PHPMD)
 */
@@ -20,7 +24,7 @@ class AcceptanceTester extends \Codeception\Actor
 {
     use _generated\AcceptanceTesterActions;
 
-   /**
-    * Define custom actions here
-    */
+    /**
+     * Define custom actions here
+     */
 }
diff --git a/codeception/codeception/2.3/tests/functional/.gitignore b/codeception/codeception/5.0/tests/Support/Data/.gitignore
similarity index 100%
rename from codeception/codeception/2.3/tests/functional/.gitignore
rename to codeception/codeception/5.0/tests/Support/Data/.gitignore
diff --git a/codeception/codeception/2.3/tests/_support/FunctionalTester.php b/codeception/codeception/5.0/tests/Support/FunctionalTester.php
similarity index 77%
rename from codeception/codeception/2.3/tests/_support/FunctionalTester.php
rename to codeception/codeception/5.0/tests/Support/FunctionalTester.php
index 48eaea91..e860095d 100644
--- a/codeception/codeception/2.3/tests/_support/FunctionalTester.php
+++ b/codeception/codeception/5.0/tests/Support/FunctionalTester.php
@@ -1,10 +1,14 @@
 <?php
-namespace App\Tests;
+
+declare(strict_types=1);
+
+namespace App\Tests\Support;
 
 /**
  * Inherited Methods
- * @method void wantToTest($text)
+ *
  * @method void wantTo($text)
+ * @method void wantToTest($text)
  * @method void execute($callable)
  * @method void expectTo($prediction)
  * @method void expect($prediction)
@@ -12,7 +16,7 @@ namespace App\Tests;
  * @method void am($role)
  * @method void lookForwardTo($achieveValue)
  * @method void comment($description)
- * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
+ * @method void pause($vars = [])
  *
  * @SuppressWarnings(PHPMD)
 */
@@ -20,7 +24,7 @@ class FunctionalTester extends \Codeception\Actor
 {
     use _generated\FunctionalTesterActions;
 
-   /**
-    * Define custom actions here
-    */
+    /**
+     * Define custom actions here
+     */
 }
diff --git a/codeception/codeception/2.3/tests/unit/.gitignore b/codeception/codeception/5.0/tests/Support/Helper/.gitignore
similarity index 100%
rename from codeception/codeception/2.3/tests/unit/.gitignore
rename to codeception/codeception/5.0/tests/Support/Helper/.gitignore
diff --git a/codeception/codeception/2.3/tests/_support/UnitTester.php b/codeception/codeception/5.0/tests/Support/UnitTester.php
similarity index 76%
rename from codeception/codeception/2.3/tests/_support/UnitTester.php
rename to codeception/codeception/5.0/tests/Support/UnitTester.php
index 27870a86..a082b858 100644
--- a/codeception/codeception/2.3/tests/_support/UnitTester.php
+++ b/codeception/codeception/5.0/tests/Support/UnitTester.php
@@ -1,10 +1,14 @@
 <?php
-namespace App\Tests;
+
+declare(strict_types=1);
+
+namespace App\Tests\Support;
 
 /**
  * Inherited Methods
- * @method void wantToTest($text)
+ *
  * @method void wantTo($text)
+ * @method void wantToTest($text)
  * @method void execute($callable)
  * @method void expectTo($prediction)
  * @method void expect($prediction)
@@ -12,7 +16,7 @@ namespace App\Tests;
  * @method void am($role)
  * @method void lookForwardTo($achieveValue)
  * @method void comment($description)
- * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
+ * @method void pause($vars = [])
  *
  * @SuppressWarnings(PHPMD)
 */
@@ -20,7 +24,7 @@ class UnitTester extends \Codeception\Actor
 {
     use _generated\UnitTesterActions;
 
-   /**
-    * Define custom actions here
-    */
+    /**
+     * Define custom actions here
+     */
 }
diff --git a/codeception/codeception/2.3/tests/_support/_generated/.gitignore b/codeception/codeception/5.0/tests/Support/_generated/.gitignore
similarity index 100%
rename from codeception/codeception/2.3/tests/_support/_generated/.gitignore
rename to codeception/codeception/5.0/tests/Support/_generated/.gitignore
diff --git a/codeception/codeception/5.0/tests/Unit/.gitignore b/codeception/codeception/5.0/tests/Unit/.gitignore
new file mode 100644
index 00000000..e69de29b
diff --git a/codeception/codeception/2.3/tests/unit.suite.yml b/codeception/codeception/5.0/tests/Unit.suite.yml
similarity index 80%
rename from codeception/codeception/2.3/tests/unit.suite.yml
rename to codeception/codeception/5.0/tests/Unit.suite.yml
index 56d5ea86..d018283d 100644
--- a/codeception/codeception/2.3/tests/unit.suite.yml
+++ b/codeception/codeception/5.0/tests/Unit.suite.yml
@@ -6,4 +6,3 @@ actor: UnitTester
 modules:
     enabled:
         - Asserts
-        - \App\Tests\Helper\Unit
diff --git a/codeception/codeception/2.3/tests/_support/Helper/Acceptance.php b/codeception/codeception/2.3/tests/_support/Helper/Acceptance.php
deleted file mode 100644
index 429488fa..00000000
--- a/codeception/codeception/2.3/tests/_support/Helper/Acceptance.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-namespace App\Tests\Helper;
-
-// here you can define custom actions
-// all public methods declared in helper class will be available in $I
-
-class Acceptance extends \Codeception\Module
-{
-
-}
diff --git a/codeception/codeception/2.3/tests/_support/Helper/Functional.php b/codeception/codeception/2.3/tests/_support/Helper/Functional.php
deleted file mode 100644
index 4b605322..00000000
--- a/codeception/codeception/2.3/tests/_support/Helper/Functional.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-namespace App\Tests\Helper;
-
-// here you can define custom actions
-// all public methods declared in helper class will be available in $I
-
-class Functional extends \Codeception\Module
-{
-
-}
diff --git a/codeception/codeception/2.3/tests/_support/Helper/Unit.php b/codeception/codeception/2.3/tests/_support/Helper/Unit.php
deleted file mode 100644
index 2038c094..00000000
--- a/codeception/codeception/2.3/tests/_support/Helper/Unit.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-namespace App\Tests\Helper;
-
-// here you can define custom actions
-// all public methods declared in helper class will be available in $I
-
-class Unit extends \Codeception\Module
-{
-
-}
diff --git a/codeception/codeception/2.3/tests/acceptance.suite.yml b/codeception/codeception/2.3/tests/acceptance.suite.yml
deleted file mode 100644
index 4733290f..00000000
--- a/codeception/codeception/2.3/tests/acceptance.suite.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-# Codeception Test Suite Configuration
-#
-# Suite for acceptance tests.
-# Perform tests in browser using the WebDriver or PhpBrowser.
-# If you need both WebDriver and PHPBrowser tests - create a separate suite.
-
-actor: AcceptanceTester
-modules:
-    enabled:
-        - PhpBrowser:
-            url: http://localhost:8000
-        - \App\Tests\Helper\Acceptance
diff --git a/codeception/codeception/2.3/tests/functional.suite.yml b/codeception/codeception/2.3/tests/functional.suite.yml
deleted file mode 100644
index ccd2a252..00000000
--- a/codeception/codeception/2.3/tests/functional.suite.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-# Codeception Test Suite Configuration
-#
-# Suite for functional tests
-# Emulate web requests and make application process them
-# Include one of framework modules (Symfony2, Yii2, Laravel5) to use it
-# Remove this suite if you don't use frameworks
-
-actor: FunctionalTester
-modules:
-    enabled:
-        - Symfony:
-            app_path: 'src'
-            environment: 'test'
-#        - Doctrine2:
-#            depends: Symfony
-#            cleanup: true
-        - \App\Tests\Helper\Functional

@symfony-recipes-bot symfony-recipes-bot merged commit bb846a6 into symfony:main Mar 4, 2024
1 of 2 checks passed
@W0rma W0rma deleted the fix-codeception-module-doctrine2 branch March 4, 2024 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants