Skip to content

Running the test suite

Moritz Ringler edited this page Jun 21, 2021 · 3 revisions

When contributing to Propel, we need you to write tests for your changes, and a successful run of the existing test suite is a requirement before a pull request can be merged.

As running the test only on CI will severely inhibit your programming flow, you will want to run the Propel test suite locally. Please consult the page at http://propelorm.org/documentation/cookbook/working-with-test-suite.html. It is slightly outdated, but most information should still be accurate, and help you get things going. If you run into trouble, don't hesitate to document it here.

Some quick hints:

  • When setup is complete, tests can be run through the script targets defined in composer.json, i.e. with composer run-script test:mysql, composer run-script test:agnostic, etc.
  • In general, there are two kinds of tests: tests that run without a database, called agnostic, and tests that run on a specific database system like MySQL or SQLite. The agnostic tests are not included, when running vendor specific tests and the other way round, so to see your tests executed, you need to start the correct target.
  • You can check code style by running composer run-script cs-check, composer run-script psalm, and composer run-script stan. Some style violations can be fixed automatically by running composer run-script cs-fix
  • When tests use a database, but either fixtures or connection is not available, make sure the test class extends the right parent class, and that it says @group database in the docstring of the class.