Skip to content

Replace Laravel5 module with Laravel module #413

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

Merged
merged 1 commit into from
Dec 30, 2020
Merged
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
26 changes: 13 additions & 13 deletions for/laravel.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ sidebar: |

## Reference

* [Laravel5 Module](/docs/modules/Laravel5)
* [Demo Application](https://github.com/janhenkgerritsen/codeception-laravel5-sample)
* [Laravel Module](/docs/modules/Laravel)
* [Demo Application](https://github.com/Codeception/laravel-module-tests)

---

Expand Down Expand Up @@ -46,13 +46,13 @@ cp .env .env.testing

Functional tests allow test application by simulating user actions, this is done by sending requests to framework kernel and checking HTML as a result. Unilke internal tests of Laravel, Codeception doesn't limit you to testing only one request per test. You can **test complex interactions involving different actions and controllers**. This way you can easily cover your specifictions with functional tests.

To start you need to configure `tests/functional.suite.yml` to use Laravel5 module:
To start you need to configure `tests/functional.suite.yml` to use Laravel module:

```yaml
class_name: FunctionalTester
modules:
enabled:
- Laravel5:
- Laravel:
environment_file: .env.testing
- \AppBundle\Helper\Functional
```
Expand All @@ -63,7 +63,7 @@ modules:
Continue to <a href="http://codeception.com/docs/04-FunctionalTests">Functional Testing Guide &raquo;</a>
</div>

Codeception will also use **Eloquent to cleanup changes to database** by wrapping tests into transaction and rolling it back in the end of a test. This makes tests isolated and fast. Laravel5 module allows to access services from DIC container, user authentication methods, fixture generators, check form validations and more.
Codeception will also use **Eloquent to cleanup changes to database** by wrapping tests into transaction and rolling it back in the end of a test. This makes tests isolated and fast. Laravel module allows to access services from DIC container, user authentication methods, fixture generators, check form validations and more.

To create first functional test for `Login` you should run:

Expand All @@ -79,7 +79,7 @@ Codeception is powered by PHPUnit so unit and integration test work in a similar
php vendor/bin/codecept g:test unit "Foo\Bar"
```
This generates `Codeception\Test\Unit` testcase which is inherited from PHPUnit but provides a module access.
Enable Laravel5 module in `unit.suite.yml` to have its methods inside a testcase. They are available injected into `$this->tester` property of a testcase.
Enable Laravel module in `unit.suite.yml` to have its methods inside a testcase. They are available injected into `$this->tester` property of a testcase.

<div class="alert alert-warning">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
Expand All @@ -105,7 +105,7 @@ Browser can be specified as `firefox`, `chrome`, or others.

Acceptance tests will be executed in development environment using real web server, so settings from `.env.testing` can't be passed to them.

You can also use Eloquent to create data for acceptance tests. This way you can use data factories and models to prepare and cleanup data for tests. You should enable Laravel5 module with ORM part to add ActiveRecord methods:
You can also use Eloquent to create data for acceptance tests. This way you can use data factories and models to prepare and cleanup data for tests. You should enable Laravel module with ORM part to add ActiveRecord methods:

```yaml
class_name: AcceptanceTester
Expand All @@ -114,13 +114,13 @@ modules:
- WebDriver:
url: 'https://localhost/' # put your local url
browser: firefox
- Laravel5:
- Laravel:
part: ORM
cleanup: false # can't wrap into transaction
- \Helper\Acceptance
```

Laravel5 module won't be able to wrap test execution in a transaction but methods like `haveRecord` or `haveModel` will delete objects they created when test ends.
Laravel module won't be able to wrap test execution in a transaction but methods like `haveRecord` or `haveModel` will delete objects they created when test ends.

### API Tests

Expand All @@ -130,23 +130,23 @@ API Tests are done at functional testing level but instead of testing HTML respo
php vendor/bin/codecept g:suite api
```

You will need to enable `REST`, `Laravel5` module in `tests/api.suite.yml`:
You will need to enable `REST`, `Laravel` module in `tests/api.suite.yml`:

```yaml
class_name: ApiTester
modules:
enabled:
- REST:
url: /api/v1
depends: Laravel5
depends: Laravel
- \Helper\Api
config:
- Laravel5:
- Laravel:
environment_file: .env.testing

```

Laravel5 module actions like `amOnPage` or `see` should not be available for testing API. This why Laravel5 module is not enabled but declared with `depends` for REST module. Laravel5 should use testing environment which is specified in `config` section
Laravel module actions like `amOnPage` or `see` should not be available for testing API. This why Laravel module is not enabled but declared with `depends` for REST module. Laravel should use testing environment which is specified in `config` section


<div class="alert alert-warning">
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy