Skip to content

Improve the functional tests #445

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

Closed
javiereguiluz opened this issue Jan 20, 2017 · 5 comments · Fixed by #459
Closed

Improve the functional tests #445

javiereguiluz opened this issue Jan 20, 2017 · 5 comments · Fixed by #459

Comments

@javiereguiluz
Copy link
Member

As pointed by @stof, in this comment at least one of our tests modifies the state of the testing database.

We should improve this by automatically resetting the testing database before each test. In our case this can't be very complex to do because the database is just a file called var/data/blog_test.sqlite

@yceruto
Copy link
Member

yceruto commented Jan 20, 2017

At now neither test change the DB status, because just we check the response content/status for now, but I'm sure we need that since there is uncovered actions that change the DB status, for example:

  • "Create a new post/comment successfully"
  • "Edit an existent post successfully"
  • "Delete an existent post successfully"

So my vote 👍

@dmaicher
Copy link
Contributor

I propose this PR (#459) that uses my bundle https://github.com/dmaicher/doctrine-test-bundle to have very simple database isolation for all tests 😊 I'm using this bundle in several private and professional projects with mysql, sqlite and postgres - works very nicely.

I changed the tests slightly so first Post 1 is deleted and in the next test its edited. Just to show that all tests are running within database level transactions now that are rolled back at the end of the test.

What do you think?

javiereguiluz added a commit that referenced this issue Feb 17, 2017
…on (dmaicher, javiereguiluz)

This PR was merged into the master branch.

Discussion
----------

Use dama/doctrine-test-bundle for proper test DB isolation

This fixes #445 by using https://github.com/dmaicher/doctrine-test-bundle to have proper test isolation.

Commits
-------

3a94540 Fixed a typo
172ce3d Tweaks
0fa427c add some comments about the usage of the bundle
fc1b7c3 remove file path from listener config
d968017 Use dama/doctrine-test-bundle for proper test DB isolation
@stof
Copy link
Member

stof commented Feb 17, 2017

@yceruto deleting an existing post successfully changes the DB (at least I hope it does)

@yceruto
Copy link
Member

yceruto commented Feb 17, 2017

@stof sure, but before #459 it didn't happen: #444 (comment) so the post was never successfully removed.

sayjun0505 added a commit to sayjun0505/sym_proj that referenced this issue Apr 16, 2023
…on (dmaicher, javiereguiluz)

This PR was merged into the master branch.

Discussion
----------

Use dama/doctrine-test-bundle for proper test DB isolation

This fixes symfony/demo#445 by using https://github.com/dmaicher/doctrine-test-bundle to have proper test isolation.

Commits
-------

3a94540 Fixed a typo
172ce3d Tweaks
0fa427c add some comments about the usage of the bundle
fc1b7c3 remove file path from listener config
d968017 Use dama/doctrine-test-bundle for proper test DB isolation
spider-yamet added a commit to spider-yamet/sym_proj that referenced this issue Apr 16, 2023
…on (dmaicher, javiereguiluz)

This PR was merged into the master branch.

Discussion
----------

Use dama/doctrine-test-bundle for proper test DB isolation

This fixes symfony/demo#445 by using https://github.com/dmaicher/doctrine-test-bundle to have proper test isolation.

Commits
-------

3a94540 Fixed a typo
172ce3d Tweaks
0fa427c add some comments about the usage of the bundle
fc1b7c3 remove file path from listener config
d968017 Use dama/doctrine-test-bundle for proper test DB isolation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@javiereguiluz @stof @dmaicher @yceruto and others