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

Added a section for testing when they migrate a page #192

Merged
merged 2 commits into from
Jan 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ This is the list of items that usually need to be done in order to complete the
- Checks permissions and demo mode constraints
- Re-introduce hooks (and document the missing one if you can't for a good reason)
- Complete `Link` class to map PrestaShop menu to the new page
- Create the smoke/survival tests for the migrated page
- Deletions
- Remove the old controller in `controllers/admin/Admin*.php`
- Remove related old templates (in `admin-dev/themes/default/template/controllers/*`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ Once everything is migrated, refactored, extracted to specific classes and worki
* Delete the old controller.
* Delete the old templates (delete the `admin-dev/themes/default/template/controller/{name}` folder.
* Delete the related "legacy tests".

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: Testing
weight: 70
---

# Testing

You are encouraged to add both unit and functional tests for every new class
you have created.

You **must** add a smoke test (also called "survival") for every new page
you migrate.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are encouraged to add both unit and functional tests for every new class you have created.
But you must add a smoke test (also called "survival") for every new page you migrate.

Could be better to use must, wdyt?


## Smoke testing

A smoke test is a really simple and basic test that ensure the page will load with
the right HTTP code. This won't ensure the page will works as expected **but** if the test fails, this ensure the page is not functional.

To add a new test, you need to add a new entry in the Data Provider of SurvivalTest class:

```php
<?php

namespace LegacyTests\Integration\PrestaShopBundle\Controller\Admin;
// ...
/**
* @group demo
*
* To execute these tests: use "./vendor/bin/phpunit -c tests-legacy/phpunit-admin.xml --filter=SurvivalTest" command.
*/
class SurvivalTest extends WebTestCase
{
// [...]

public function getDataProvider()
{
return [
'symfony_route_of_page' => ['Page title', 'symfony_route_of_page'],
// ...
];
}
}
```