|
| 1 | +# How to Contribute |
| 2 | + |
| 3 | +First of all: Contributions are very welcome! |
| 4 | + |
| 5 | +**Does your change require a test?** |
| 6 | + |
| 7 | +## No, my change does not require a test |
| 8 | +So you're going to make a small change or improve the documentation? Hey, you rock! |
| 9 | + |
| 10 | +- Either just edit [`Symfony.php`](https://github.com/Codeception/module-symfony/blob/master/src/Codeception/Module/Symfony.php) on GitHub's website. |
| 11 | +- Make sure to add a descriptive title and add an explanation for your changes. |
| 12 | + |
| 13 | +> :bulb: You can also create a *fork* and *cloning it* on your local machine, as explained in the next section. |
| 14 | +
|
| 15 | +## Yes, my change requires a test |
| 16 | + |
| 17 | +So you're going to add or modify functionality? Hey, you rock too! |
| 18 | + |
| 19 | +You can use our prepared [Codeception/symfony-module-tests](https://github.com/Codeception/symfony-module-tests). |
| 20 | +It is a minimal (but complete) Symfony project, ready to run tests. |
| 21 | + |
| 22 | +### 1. Edit locally |
| 23 | + |
| 24 | +- Go to [Codeception/symfony-module-tests](https://github.com/Codeception/symfony-module-tests) and fork the project. |
| 25 | + Then follow the installation instructions. |
| 26 | + <br/> |
| 27 | +- Edit the module's source code in the `vendor/codeception/module-symfony/src/Codeception/Module/Symfony.php` file. |
| 28 | + <br/> |
| 29 | +- If you created a new method, you can test it by adding a test in the `tests/Functional/SymfonyModuleCest.php` file. |
| 30 | +> :bulb: Be sure to Rebuild Codeception's "Actor" classes (see [Console Commands](https://codeception.com/docs/reference/Commands#Build)): |
| 31 | +> ```shell |
| 32 | +> vendor/bin/codecept clean |
| 33 | +> vendor/bin/codecept build |
| 34 | +> ``` |
| 35 | +> With this, your IDE will be able to recognize and autocomplete your new method. |
| 36 | +
|
| 37 | +- Then, run the tests with the `vendor/bin/codecept run Functional` command. |
| 38 | +
|
| 39 | +### 2. Confirm your changes |
| 40 | +
|
| 41 | +- If you are satisfied with your changes, the next step is to fork [Codeception/symfony-module](https://github.com/Codeception/module-symfony). |
| 42 | + In your terminal, go to another directory, then: |
| 43 | + ```shell |
| 44 | + # Clone the repo |
| 45 | + git clone https://github.com/YourUserName/module-symfony.git |
| 46 | +
|
| 47 | + # Create a new branch for your change |
| 48 | + cd module-symfony |
| 49 | + git checkout -b new_feature |
| 50 | + ``` |
| 51 | +> :bulb: If you've created a fork before, make sure to [sync the changes](https://stackoverflow.com/a/7244456). |
| 52 | +
|
| 53 | +- Copy the changes from the `Symfony.php` of the test project to the `src/Codeception/Module/Symfony.php` file on your Module's fork. |
| 54 | + <br/> |
| 55 | +- Commit: |
| 56 | + ```shell |
| 57 | + git add --all |
| 58 | + git commit --message="Briefly explain what your change is about" |
| 59 | + git push --set-upstream origin new_feature |
| 60 | + ``` |
| 61 | + |
| 62 | +### 3. Create a Pull Request |
| 63 | + |
| 64 | +- In the CLI output, click on the link to `https://github.com/YourUserName/module-symfony/pull/new/new_feature` to create a Pull Request through GitHub.com. |
| 65 | + |
| 66 | +Now wait for feedback on your Pull Request. If all is fine and gets merged... |
| 67 | + |
| 68 | +### 4. Send a Test |
| 69 | + |
| 70 | +- In the test project (`symfony-module-tests`), create a test with the same name as your new method in `tests/Functional/SymfonyModuleCest.php`, following alphabetical order. |
| 71 | + |
| 72 | +- Run the tests with `vendor/bin/codecept run Functional` command. |
| 73 | + |
| 74 | +- Commit: |
| 75 | + ```shell |
| 76 | + git checkout -b new_test |
| 77 | + git add --all |
| 78 | + git commit --message="Describe what feature you are testing" |
| 79 | + git push --set-upstream origin new_test |
| 80 | + ``` |
| 81 | + |
| 82 | +- In the CLI output, click on the link to `https://github.com/YourUserName/symfony-module-tests/pull/new/new_test` to create a Pull Request through `GitHub.com`. |
| 83 | + Don't forget to add a link to the module's Pull Request you created. |
0 commit comments