https://github.com/codeception/sample-l4-app
Codeception Laravel Tests
https://github.com/codeception/sample-l4-app
Last synced: 4 months ago
JSON representation
Codeception Laravel Tests
- Host: GitHub
- URL: https://github.com/codeception/sample-l4-app
- Owner: Codeception
- Created: 2013-05-09T01:03:16.000Z (over 12 years ago)
- Default Branch: codeception-2.1
- Last Pushed: 2016-03-05T18:54:27.000Z (over 9 years ago)
- Last Synced: 2025-06-27T12:24:32.513Z (4 months ago)
- Language: PHP
- Homepage: http://codeception.com
- Size: 1.56 MB
- Stars: 103
- Watchers: 17
- Forks: 30
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# Sample Laravel Application with Codeception tests.
[](https://travis-ci.org/Codeception/sample-l4-app) <- see Travis CI integration
### Setup
- Clone repo
- Install dependencies:
- `composer install`
- Create databases:
- `touch app/database/database.sqlite`
- `touch app/database/testing.sqlite`
- `php artisan migrate --seed`
- `php artisan migrate --env=testing`
- Server: run `php artisan serve`
- Browse to localhost:8000/posts
- Enter `john@doe.com` as username, and `password` as the password
### To test
Run Codeception, installed via Composer
```
./vendor/bin/codecept run
```
## Tests
Please check out some [good test examples](https://github.com/Codeception/sample-l4-app/tree/master/tests) provided.
### Functional Tests
Demonstrates testing of [CRUD application](https://github.com/Codeception/sample-l4-app/blob/master/tests/functional/PostCrudCest.php) with
* [PageObjects](https://github.com/Codeception/sample-l4-app/blob/master/tests%2Ffunctional%2F_pages%2FPostsPage.php)
* [authentication](https://github.com/Codeception/sample-l4-app/blob/master/tests%2Ffunctional%2FAuthCest.php) (by user, credentials, http auth)
* usage of session variables
* [routes](https://github.com/Codeception/sample-l4-app/blob/master/tests%2Ffunctional%2FRoutesCest.php)
* creating and checking records in database
### CLI Tests
Demonstrates [testing of Artisan commands](https://github.com/Codeception/sample-l4-app/blob/master/tests%2Fcli%2FGenerateRepositoryCept.php). See [CliHelper](https://github.com/Codeception/sample-l4-app/blob/master/tests/_support/CliHelper.php) to learn how to perform cleanup between tests, and create cutom `runArtisan` command
### API Tests
Demonstrates functional [testing of API](https://github.com/Codeception/sample-l4-app/blob/master/tests%2Fapi%2FPostsResourceCest.php) using REST and Laravel4 modules connected, with
* partial json inclusion in response
* GET/POST/PUT/DELETE requests
* check changes inside database