Skip to content

Latest commit

 

History

History
99 lines (76 loc) · 3.86 KB

CONTRIBUTING.md

File metadata and controls

99 lines (76 loc) · 3.86 KB

How to Contribute

First of all: Contributions are very welcome!

Does your change require a test?

No, my change does not require a test

So you're going to make a small change or improve the documentation? Hey, you rock!

  • Just edit the respective trait on GitHub's website.
  • Make sure to add a descriptive title and add an explanation for your changes.

💡 You can also create a fork and clone it on your local machine, as explained in the next section.

Yes, my change requires a test

So you're going to add or modify functionality? Hey, you rock too!

You can use our prepared Codeception/symfony-module-tests. It is a minimal (but complete) Symfony project, ready to run tests.

1. Edit locally

  • Go to Codeception/symfony-module-tests and fork the project.
  • Clone your fork locally:
    git clone https://github.com/YourUserName/symfony-module-tests.git

  • Install Composer dependencies
    composer update

  • Update database schema and load Doctrine fixtures
    php bin/console doctrine:schema:update --force  
    php bin/console doctrine:fixtures:load --quiet

  • Edit the trait's source code in the vendor/codeception/module-symfony/src/Codeception/Module/Symfony/ folder.
  • If you create a new method, you can test it by adding a test in the corresponding /tests/Functional/*Cest.php file.

💡 Be sure to rebuild Codeception's "Actor" classes (see Console Commands):

vendor/bin/codecept clean
vendor/bin/codecept build

With this, your IDE will be able to recognize and autocomplete your new method.

  • Then, run the tests with the vendor/bin/codecept run Functional command.

2. Confirm your changes

  • If you are satisfied with your changes, the next step is to fork Codeception/symfony-module. In your terminal, go to another directory, then:
    # Clone the repo
    git clone https://github.com/YourUserName/module-symfony.git
    
    # Create a new branch for your change
    cd module-symfony
    git checkout -b new_feature

💡 If you've created a fork before, make sure to sync the changes.

  • Copy the changes from the trait file of the test project to the src/Codeception/Module/Symfony/ folder of your Module's fork.
  • Commit:
    git add --all
    git commit --message="Briefly explain what your change is about"
    git push --set-upstream origin new_feature

3. Create a Pull Request

  • 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.

Now wait for feedback on your Pull Request. If all is fine and it gets merged...

4. Send a Test

  • In the test project (symfony-module-tests), locate the /tests/Functional/*Cest.php file corresponding to the trait. In there, create a new method with the same name as your method in the trait, following alphabetical order.
    If your PR fixes an existing issue, put the test into /tests/Functional/IssuesCest.php.

  • Run the tests with vendor/bin/codecept run Functional command.

  • Commit:

    git checkout -b new_test
    git add --all
    git commit --message="Describe what feature you are testing"
    git push --set-upstream origin new_test
  • 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. Don't forget to add a link to the module's Pull Request you created earlier.