├── public ├── favicon.ico ├── robots.txt ├── .htaccess └── index.php ├── app ├── Listeners │ ├── .gitkeep │ └── TestEventListener.php ├── Events │ ├── Event.php │ ├── TestEvent.php │ └── OtherTestEvent.php ├── Http │ ├── Requests │ │ ├── Request.php │ │ ├── PostStoreRequest.php │ │ └── PostUpdateRequest.php │ ├── Controllers │ │ ├── Controller.php │ │ ├── WelcomeController.php │ │ ├── Auth │ │ │ ├── ResetPasswordController.php │ │ │ ├── ForgotPasswordController.php │ │ │ ├── LoginController.php │ │ │ └── RegisterController.php │ │ ├── UsersController.php │ │ ├── Api │ │ │ └── PostsController.php │ │ ├── PostsController.php │ │ └── HomeController.php │ ├── Middleware │ │ ├── VerifyCsrfToken.php │ │ ├── RedirectIfAuthenticated.php │ │ └── Authenticate.php │ ├── Kernel.php │ └── routes.php ├── Test │ ├── StringConverter.php │ ├── ToLowercase.php │ ├── ToUppercase.php │ └── Repeat.php ├── Post.php ├── Validation │ └── CustomValidator.php ├── Jobs │ └── Job.php ├── Providers │ ├── ConfigServiceProvider.php │ ├── EventServiceProvider.php │ ├── RouteServiceProvider.php │ └── AppServiceProvider.php ├── Console │ ├── Kernel.php │ └── Commands │ │ ├── Inspire.php │ │ └── CreateUser.php ├── User.php └── Exceptions │ └── Handler.php ├── database ├── seeds │ ├── .gitkeep │ ├── DatabaseSeeder.php │ └── UserTableSeeder.php ├── migrations │ ├── .gitkeep │ ├── 2014_10_25_122420_create_posts_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ └── 2014_10_12_000000_create_users_table.php ├── .gitignore └── factories │ └── ModelFactory.php ├── .gitattributes ├── resources ├── views │ ├── vendor │ │ └── .gitkeep │ ├── flash.blade.php │ ├── auth │ │ ├── emails │ │ │ └── password.blade.php │ │ ├── password.blade.php │ │ ├── reset.blade.php │ │ ├── login.blade.php │ │ └── register.blade.php │ ├── service-container.blade.php │ ├── form.blade.php │ ├── home.blade.php │ ├── special-characters.blade.php │ ├── hello.blade.php │ ├── users │ │ ├── show.blade.php │ │ └── edit.blade.php │ ├── posts │ │ ├── create.blade.php │ │ ├── show.blade.php │ │ ├── edit.blade.php │ │ └── index.blade.php │ ├── errors │ │ └── 503.blade.php │ ├── welcome.blade.php │ ├── layouts │ │ └── scaffold.blade.php │ └── app.blade.php ├── assets │ └── less │ │ ├── bootstrap │ │ ├── mixins │ │ │ ├── center-block.less │ │ │ ├── text-emphasis.less │ │ │ ├── size.less │ │ │ ├── background-variant.less │ │ │ ├── opacity.less │ │ │ ├── text-overflow.less │ │ │ ├── tab-focus.less │ │ │ ├── labels.less │ │ │ ├── resize.less │ │ │ ├── progress-bar.less │ │ │ ├── nav-divider.less │ │ │ ├── reset-filter.less │ │ │ ├── alerts.less │ │ │ ├── nav-vertical-align.less │ │ │ ├── responsive-visibility.less │ │ │ ├── pagination.less │ │ │ ├── border-radius.less │ │ │ ├── panels.less │ │ │ ├── list-group.less │ │ │ ├── hide-text.less │ │ │ ├── clearfix.less │ │ │ ├── table-row.less │ │ │ ├── image.less │ │ │ ├── buttons.less │ │ │ ├── forms.less │ │ │ ├── grid-framework.less │ │ │ └── grid.less │ │ ├── wells.less │ │ ├── breadcrumbs.less │ │ ├── responsive-embed.less │ │ ├── close.less │ │ ├── media.less │ │ ├── component-animations.less │ │ ├── thumbnails.less │ │ ├── utilities.less │ │ ├── pager.less │ │ ├── jumbotron.less │ │ ├── mixins.less │ │ ├── bootstrap.less │ │ ├── labels.less │ │ ├── badges.less │ │ ├── code.less │ │ ├── grid.less │ │ ├── alerts.less │ │ ├── progress-bars.less │ │ ├── pagination.less │ │ ├── print.less │ │ ├── scaffolding.less │ │ ├── tooltip.less │ │ ├── list-group.less │ │ ├── popovers.less │ │ └── modals.less │ │ └── app.less └── lang │ └── en │ ├── pagination.php │ └── passwords.php ├── storage ├── .gitignore ├── app │ └── .gitignore ├── logs │ └── .gitignore └── framework │ ├── cache │ └── .gitignore │ ├── views │ └── .gitignore │ ├── sessions │ └── .gitignore │ └── .gitignore ├── bootstrap ├── cache │ └── .gitignore ├── autoload.php └── app.php ├── tests ├── _data │ ├── dump.sql │ └── logo.jpg ├── api │ ├── _bootstrap.php │ └── PostsResourceCest.php ├── unit │ ├── _bootstrap.php │ └── UserTest.php ├── seeder │ ├── _bootstrap.php │ └── DatabaseSeederCest.php ├── _bootstrap.php ├── unit.suite.yml ├── functional │ ├── IndexCept.php │ ├── FlashCept.php │ ├── _bootstrap.php │ ├── BackCept.php │ ├── UploadedFilesCept.php │ ├── SpecialCharactersCept.php │ ├── FormCept.php │ ├── ArtisanCest.php │ ├── HelpersCest.php │ ├── RegisterCept.php │ ├── SessionCest.php │ ├── ApplicationHandlerCept.php │ ├── LoginCept.php │ ├── EditProfileCept.php │ ├── ModelFactoryCest.php │ ├── CustomValidationCest.php │ ├── RoutesCest.php │ ├── InternalDomainsCest.php │ ├── FormErrorsCest.php │ ├── ServiceContainerCest.php │ ├── RecordCest.php │ ├── AuthCest.php │ ├── PostCrudCest.php │ └── EventsCest.php ├── _support │ ├── Helper │ │ ├── Api.php │ │ ├── Unit.php │ │ ├── Functional.php │ │ └── Seeder.php │ ├── UnitTester.php │ ├── ApiTester.php │ ├── SeederTester.php │ ├── FunctionalTester.php │ └── Page │ │ └── Functional │ │ └── PostsPage.php ├── api.suite.yml ├── functional.suite.yml └── seeder.suite.yml ├── Dockerfile ├── .gitmodules ├── .env.example ├── package.json ├── phpspec.yml ├── .env.testing ├── .gitignore ├── after.sh ├── gulpfile.js ├── Homestead.yaml ├── codeception.yml ├── server.php ├── deploy └── deployment.yaml ├── phpunit.xml ├── config ├── services.php ├── view.php ├── compile.php ├── filesystems.php ├── cache.php ├── queue.php ├── auth.php └── database.php ├── .rancher-pipeline.yml ├── Vagrantfile ├── composer.json ├── .circleci └── config.yml ├── artisan └── readme.md /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Listeners/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/seeds/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/migrations/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /resources/views/vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /storage/.gitignore: -------------------------------------------------------------------------------- 1 | laravel.log -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /resources/views/flash.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.scaffold') 2 | -------------------------------------------------------------------------------- /tests/_data/dump.sql: -------------------------------------------------------------------------------- 1 | /* Replace this file with actual dump of your database */ -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7.2 2 | COPY ./ /app/root/ 3 | CMD ["php","-S","0.0.0.0:80","-t","/app/root/public"] 4 | -------------------------------------------------------------------------------- /app/Events/Event.php: -------------------------------------------------------------------------------- 1 | wantTo('open index page of site'); 4 | $I->amOnPage('/'); 5 | $I->see('Hello World', 'h1'); 6 | -------------------------------------------------------------------------------- /tests/functional/FlashCept.php: -------------------------------------------------------------------------------- 1 | wantTo('see a flash message'); 4 | $I->amOnPage('/flash'); 5 | $I->see("It's a flash", ".flash"); 6 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/center-block.less: -------------------------------------------------------------------------------- 1 | // Center-align a block level element 2 | 3 | .center-block() { 4 | display: block; 5 | margin-left: auto; 6 | margin-right: auto; 7 | } 8 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/text-emphasis.less: -------------------------------------------------------------------------------- 1 | // Typography 2 | 3 | .text-emphasis-variant(@color) { 4 | color: @color; 5 | a&:hover { 6 | color: darken(@color, 10%); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /app/Http/Requests/Request.php: -------------------------------------------------------------------------------- 1 | {{ $converter->convert('String To Convert') }}

7 | @stop 8 | -------------------------------------------------------------------------------- /tests/_support/Helper/Api.php: -------------------------------------------------------------------------------- 1 | wantTo('redirect back using /back route'); 4 | $I->amOnPage('/'); 5 | $I->amOnPage('/back'); 6 | $I->expect('I am redirected back to /'); 7 | $I->seeCurrentUrlEquals('/'); -------------------------------------------------------------------------------- /tests/functional.suite.yml: -------------------------------------------------------------------------------- 1 | class_name: FunctionalTester 2 | modules: 3 | enabled: 4 | - Helper\Functional 5 | - Asserts 6 | - REST: 7 | depends: Laravel5 8 | - Laravel5: 9 | environment_file: .env.testing -------------------------------------------------------------------------------- /app/Post.php: -------------------------------------------------------------------------------- 1 | .striped(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/seeder.suite.yml: -------------------------------------------------------------------------------- 1 | class_name: SeederTester 2 | modules: 3 | enabled: 4 | - \Helper\Seeder 5 | - Asserts 6 | - Laravel5: 7 | environment_file: .env.testing 8 | run_database_seeder: true 9 | database_seeder_class: DatabaseSeeder -------------------------------------------------------------------------------- /app/Test/ToLowercase.php: -------------------------------------------------------------------------------- 1 | 5 | Your message: {{ $message }} 6 |

7 | 8 |
9 | 10 | 11 |
12 | @stop -------------------------------------------------------------------------------- /tests/functional/UploadedFilesCept.php: -------------------------------------------------------------------------------- 1 | wantTo('upload a file'); 4 | $I->amOnPage(''); // Necessary to prevent LogicException with message "The page history is empty". 5 | $I->sendPOST('upload', [], ['file' => codecept_data_dir('logo.jpg')]); 6 | $I->see('Success'); -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/nav-divider.less: -------------------------------------------------------------------------------- 1 | // Horizontal dividers 2 | // 3 | // Dividers (basically an hr) within dropdowns and nav lists 4 | 5 | .nav-divider(@color: #e5e5e5) { 6 | height: 1px; 7 | margin: ((@line-height-computed / 2) - 1) 0; 8 | overflow: hidden; 9 | background-color: @color; 10 | } 11 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/reset-filter.less: -------------------------------------------------------------------------------- 1 | // Reset filters for IE 2 | // 3 | // When you need to remove a gradient background, do not forget to use this to reset 4 | // the IE filter for IE9 and below. 5 | 6 | .reset-filter() { 7 | filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)")); 8 | } 9 | -------------------------------------------------------------------------------- /app/Validation/CustomValidator.php: -------------------------------------------------------------------------------- 1 | assertCount(1, User::all()); 10 | } 11 | 12 | public function secondTest(SeederTester $I) 13 | { 14 | $I->assertCount(1, User::all()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/alerts.less: -------------------------------------------------------------------------------- 1 | // Alerts 2 | 3 | .alert-variant(@background; @border; @text-color) { 4 | background-color: @background; 5 | border-color: @border; 6 | color: @text-color; 7 | 8 | hr { 9 | border-top-color: darken(@border, 5%); 10 | } 11 | .alert-link { 12 | color: darken(@text-color, 10%); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/functional/SpecialCharactersCept.php: -------------------------------------------------------------------------------- 1 | wantTo('test for text that uses special characters'); 4 | 5 | $I->amOnPage('/special-characters'); 6 | 7 | $I->see('Straße', 'p.character'); 8 | $I->see('Straße', 'p.html-encoded'); 9 | 10 | $I->click('Straße', 'a.character'); 11 | $I->click('Straße', 'a.html-encoded'); 12 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | call('UserTableSeeder'); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /tests/functional/FormCept.php: -------------------------------------------------------------------------------- 1 | wantTo('submit a form'); 4 | $I->amOnPage('/form'); 5 | $I->fillField('message', 'My message!'); 6 | $I->click('Submit'); 7 | 8 | $I->see('Your message: My message!'); 9 | 10 | $I->fillField('message', 'Another message!'); 11 | $I->click('Submit'); 12 | 13 | $I->see('Your message: Another message!'); 14 | -------------------------------------------------------------------------------- /app/Listeners/TestEventListener.php: -------------------------------------------------------------------------------- 1 | 'johndoe@example.com', 'password' => bcrypt('password')]); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /database/seeds/UserTableSeeder.php: -------------------------------------------------------------------------------- 1 | 'johndoe@example.com', 'password' => bcrypt('password')]); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /resources/views/home.blade.php: -------------------------------------------------------------------------------- 1 | @extends('app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
Home
9 | 10 |
11 | You are logged in! 12 |
13 |
14 |
15 |
16 |
17 | @endsection 18 | -------------------------------------------------------------------------------- /after.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | cd code 6 | 7 | sudo -u vagrant -H bash -c "cp .env.testing .env; \ 8 | composer install -n --prefer-dist; \ 9 | if [ ! -f ~/.key_generated ]; then php artisan key:generate; touch ~/.key_generated; fi; \ 10 | touch storage/database.sqlite; \ 11 | touch storage/testing.sqlite; \ 12 | php artisan migrate; \ 13 | php artisan migrate --database=sqlite_testing;" 14 | -------------------------------------------------------------------------------- /tests/functional/ArtisanCest.php: -------------------------------------------------------------------------------- 1 | callArtisan('create-user', ['email' => 'test@example.com', 'password' => 'password']); 9 | // 10 | // $I->seeRecord('users', ['email' => 'test@example.com']); 11 | // $I->assertEquals('User created!', $output); 12 | // } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Redirect Trailing Slashes... 9 | RewriteRule ^(.*)/$ /$1 [L,R=301] 10 | 11 | # Handle Front Controller... 12 | RewriteCond %{REQUEST_FILENAME} !-d 13 | RewriteCond %{REQUEST_FILENAME} !-f 14 | RewriteRule ^ index.php [L] 15 | 16 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/nav-vertical-align.less: -------------------------------------------------------------------------------- 1 | // Navbar vertical align 2 | // 3 | // Vertically center elements in the navbar. 4 | // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin. 5 | 6 | .navbar-vertical-align(@element-height) { 7 | margin-top: ((@navbar-height - @element-height) / 2); 8 | margin-bottom: ((@navbar-height - @element-height) / 2); 9 | } 10 | -------------------------------------------------------------------------------- /resources/views/special-characters.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.scaffold') 2 | 3 | @section('main') 4 |

Straße

5 |

Straße

6 | Straße 7 | Straße 8 | 9 |
10 | 11 | 12 |
13 | @stop 14 | -------------------------------------------------------------------------------- /tests/functional/HelpersCest.php: -------------------------------------------------------------------------------- 1 | assertEquals('http://myapp.com/posts', route('posts.index')); 9 | } 10 | 11 | public function routeAfterRequest(FunctionalTester $I) 12 | { 13 | $I->amOnRoute('posts.index'); 14 | $I->assertEquals('http://myapp.com/posts', route('posts.index')); 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/responsive-visibility.less: -------------------------------------------------------------------------------- 1 | // Responsive utilities 2 | 3 | // 4 | // More easily include all the states for responsive-utilities.less. 5 | .responsive-visibility() { 6 | display: block !important; 7 | table& { display: table; } 8 | tr& { display: table-row !important; } 9 | th&, 10 | td& { display: table-cell !important; } 11 | } 12 | 13 | .responsive-invisibility() { 14 | display: none !important; 15 | } 16 | -------------------------------------------------------------------------------- /resources/views/hello.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.scaffold') 2 | 3 | @section('main') 4 |

Hello world!~

5 | 6 | @if (count($errors) > 0) 7 |
8 | 13 |
14 | 15 | {{var_dump(\App\Post::all()->toArray())}} 16 | 17 | @endif 18 | 19 | @stop 20 | -------------------------------------------------------------------------------- /tests/functional/RegisterCept.php: -------------------------------------------------------------------------------- 1 | wantTo('register a user'); 4 | 5 | $I->amOnPage('/register'); 6 | $I->fillField('name', 'John Doe'); 7 | $I->fillField('email', 'example@example.com'); 8 | $I->fillField('password', 'password'); 9 | $I->fillField('password_confirmation', 'password'); 10 | $I->click('button[type=submit]'); 11 | 12 | $I->amOnPage('/'); 13 | $I->seeRecord('users', ['email' => 'example@example.com']); 14 | $I->seeAuthentication(); 15 | -------------------------------------------------------------------------------- /app/Test/Repeat.php: -------------------------------------------------------------------------------- 1 | times = $times; 16 | } 17 | 18 | /** 19 | * @param $string 20 | * @return string 21 | */ 22 | public function convert($string) 23 | { 24 | return str_repeat($string, $this->times); 25 | } 26 | } -------------------------------------------------------------------------------- /tests/functional/SessionCest.php: -------------------------------------------------------------------------------- 1 | amOnPage('/session/My%20Message'); 8 | $I->seeInSession('message'); 9 | $I->seeInSession('message', 'My Message'); 10 | } 11 | 12 | public function seeSessionHasValues(FunctionalTester $I) 13 | { 14 | $I->amOnPage('/session/My%20Message'); 15 | $I->seeSessionHasValues(['message']); 16 | $I->seeSessionHasValues(['message' => 'My Message']); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var elixir = require('laravel-elixir'); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Elixir Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Elixir provides a clean, fluent API for defining some basic Gulp tasks 9 | | for your Laravel application. By default, we are compiling the Less 10 | | file for our application, as well as publishing vendor resources. 11 | | 12 | */ 13 | 14 | elixir(function(mix) { 15 | mix.less('app.less'); 16 | }); 17 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/pagination.less: -------------------------------------------------------------------------------- 1 | // Pagination 2 | 3 | .pagination-size(@padding-vertical; @padding-horizontal; @font-size; @border-radius) { 4 | > li { 5 | > a, 6 | > span { 7 | padding: @padding-vertical @padding-horizontal; 8 | font-size: @font-size; 9 | } 10 | &:first-child { 11 | > a, 12 | > span { 13 | .border-left-radius(@border-radius); 14 | } 15 | } 16 | &:last-child { 17 | > a, 18 | > span { 19 | .border-right-radius(@border-radius); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/functional/ApplicationHandlerCept.php: -------------------------------------------------------------------------------- 1 | haveApplicationHandler(function($app) { 5 | $app->make('config')->set(['test_value' => 10]); 6 | }); 7 | $I->sendGET('/test-value'); 8 | $I->see('Test value is 10'); 9 | 10 | $I->haveApplicationHandler(function($app) { 11 | $app->make('config')->set(['test_value' => 15]); 12 | }); 13 | $I->sendGET('/test-value'); 14 | $I->see('Test value is 15'); 15 | 16 | $I->clearApplicationHandlers(); 17 | $I->sendGET('/test-value'); 18 | $I->see('Test value is 5'); // 5 is the default value 19 | -------------------------------------------------------------------------------- /tests/unit/UserTest.php: -------------------------------------------------------------------------------- 1 | $email, 'password' => $password]); 20 | 21 | $this->tester->seeRecord('users', ['email' => $email, 'password' => $password]); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/border-radius.less: -------------------------------------------------------------------------------- 1 | // Single side border-radius 2 | 3 | .border-top-radius(@radius) { 4 | border-top-right-radius: @radius; 5 | border-top-left-radius: @radius; 6 | } 7 | .border-right-radius(@radius) { 8 | border-bottom-right-radius: @radius; 9 | border-top-right-radius: @radius; 10 | } 11 | .border-bottom-radius(@radius) { 12 | border-bottom-right-radius: @radius; 13 | border-bottom-left-radius: @radius; 14 | } 15 | .border-left-radius(@radius) { 16 | border-bottom-left-radius: @radius; 17 | border-top-left-radius: @radius; 18 | } 19 | -------------------------------------------------------------------------------- /Homestead.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | ip: "192.168.10.10" 3 | memory: 2048 4 | cpus: 1 5 | name: "Codeception Laravel 5 Sample" 6 | provider: virtualbox 7 | 8 | folders: 9 | - map: "." 10 | to: "/home/vagrant/code" 11 | 12 | sites: 13 | - map: homestead.app 14 | to: "/home/vagrant/code/public" 15 | 16 | databases: 17 | - homestead 18 | 19 | # blackfire: 20 | # - id: foo 21 | # token: bar 22 | # client-id: foo 23 | # client-token: bar 24 | 25 | # ports: 26 | # - send: 50000 27 | # to: 5000 28 | # - send: 7777 29 | # to: 777 30 | # protocol: udp 31 | -------------------------------------------------------------------------------- /tests/functional/LoginCept.php: -------------------------------------------------------------------------------- 1 | wantTo('login as a user'); 4 | 5 | $I->haveRecord('users', [ 6 | 'email' => 'john@doe.com', 7 | 'password' => bcrypt('password'), 8 | 'created_at' => new DateTime(), 9 | 'updated_at' => new DateTime(), 10 | ]); 11 | 12 | $I->amOnPage('/login'); 13 | $I->fillField('email', 'john@doe.com'); 14 | $I->fillField('password', 'password'); 15 | $I->click('button[type=submit]'); 16 | 17 | $I->seeCurrentUrlEquals(''); 18 | $I->amOnPage('/posts'); 19 | $I->seeAuthentication(); 20 | $I->see('Logged in as john@doe.com'); -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /app/Http/Requests/PostStoreRequest.php: -------------------------------------------------------------------------------- 1 | 'required', 16 | 'body' => 'required' 17 | ]; 18 | } 19 | 20 | /** 21 | * Determine if the user is authorized to make this request. 22 | * 23 | * @return bool 24 | */ 25 | public function authorize() 26 | { 27 | return true; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Requests/PostUpdateRequest.php: -------------------------------------------------------------------------------- 1 | 'required', 16 | 'body' => 'required' 17 | ]; 18 | } 19 | 20 | /** 21 | * Determine if the user is authorized to make this request. 22 | * 23 | * @return bool 24 | */ 25 | public function authorize() 26 | { 27 | return true; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/Jobs/Job.php: -------------------------------------------------------------------------------- 1 | Show User 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
IDEmailActions
{{ $user->id }}{{ $user->email }}Edit
24 | 25 | @stop -------------------------------------------------------------------------------- /app/Providers/ConfigServiceProvider.php: -------------------------------------------------------------------------------- 1 | 5, 20 | ]); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /server.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | 9 | $uri = urldecode( 10 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 11 | ); 12 | 13 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 14 | // built-in PHP web server. This provides a convenient way to test a Laravel 15 | // application without having installed a "real" web server software here. 16 | if ($uri !== '/' and file_exists(__DIR__.'/public'.$uri)) 17 | { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /tests/functional/EditProfileCept.php: -------------------------------------------------------------------------------- 1 | wantTo('edit a profile'); 6 | 7 | $user = User::create(['email' => 'johndoe@example.com', 'password' => bcrypt('password')]); 8 | $I->amOnPage('/login'); 9 | $I->fillField('email', 'johndoe@example.com'); 10 | $I->fillField('password', 'password'); 11 | $I->click('button[type=submit]'); 12 | 13 | $I->amOnPage('/users/1'); 14 | $I->see('Logged in as johndoe@example.com'); 15 | 16 | $I->click('Edit'); 17 | $I->fillField('Email', 'john@doe.com'); 18 | $I->click('Update'); 19 | 20 | $I->seeCurrentUrlEquals('/users/1'); 21 | $I->see('Logged in as john@doe.com'); 22 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/panels.less: -------------------------------------------------------------------------------- 1 | // Panels 2 | 3 | .panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border) { 4 | border-color: @border; 5 | 6 | & > .panel-heading { 7 | color: @heading-text-color; 8 | background-color: @heading-bg-color; 9 | border-color: @heading-border; 10 | 11 | + .panel-collapse > .panel-body { 12 | border-top-color: @border; 13 | } 14 | .badge { 15 | color: @heading-bg-color; 16 | background-color: @heading-text-color; 17 | } 18 | } 19 | & > .panel-footer { 20 | + .panel-collapse > .panel-body { 21 | border-bottom-color: @border; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/wells.less: -------------------------------------------------------------------------------- 1 | // 2 | // Wells 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base class 7 | .well { 8 | min-height: 20px; 9 | padding: 19px; 10 | margin-bottom: 20px; 11 | background-color: @well-bg; 12 | border: 1px solid @well-border; 13 | border-radius: @border-radius-base; 14 | .box-shadow(inset 0 1px 1px rgba(0,0,0,.05)); 15 | blockquote { 16 | border-color: #ddd; 17 | border-color: rgba(0,0,0,.15); 18 | } 19 | } 20 | 21 | // Sizes 22 | .well-lg { 23 | padding: 24px; 24 | border-radius: @border-radius-large; 25 | } 26 | .well-sm { 27 | padding: 9px; 28 | border-radius: @border-radius-small; 29 | } 30 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/list-group.less: -------------------------------------------------------------------------------- 1 | // List Groups 2 | 3 | .list-group-item-variant(@state; @background; @color) { 4 | .list-group-item-@{state} { 5 | color: @color; 6 | background-color: @background; 7 | 8 | a& { 9 | color: @color; 10 | 11 | .list-group-item-heading { 12 | color: inherit; 13 | } 14 | 15 | &:hover, 16 | &:focus { 17 | color: @color; 18 | background-color: darken(@background, 5%); 19 | } 20 | &.active, 21 | &.active:hover, 22 | &.active:focus { 23 | color: #fff; 24 | background-color: @color; 25 | border-color: @color; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/hide-text.less: -------------------------------------------------------------------------------- 1 | // CSS image replacement 2 | // 3 | // Heads up! v3 launched with with only `.hide-text()`, but per our pattern for 4 | // mixins being reused as classes with the same name, this doesn't hold up. As 5 | // of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`. 6 | // 7 | // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757 8 | 9 | // Deprecated as of v3.0.1 (will be removed in v4) 10 | .hide-text() { 11 | font: ~"0/0" a; 12 | color: transparent; 13 | text-shadow: none; 14 | background-color: transparent; 15 | border: 0; 16 | } 17 | 18 | // New mixin to use as of v3.0.1 19 | .text-hide() { 20 | .hide-text(); 21 | } 22 | -------------------------------------------------------------------------------- /database/migrations/2014_10_25_122420_create_posts_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('title'); 19 | $table->text('body'); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::drop('posts'); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | path()) !== false) { 19 | return $next($request); 20 | } 21 | 22 | return parent::handle($request, $next); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /tests/_support/UnitTester.php: -------------------------------------------------------------------------------- 1 | have(User::class, ['email' => 'johndoe@example.com']); 10 | 11 | $I->assertEquals('johndoe@example.com', $user->email); 12 | $I->seeRecord('users', ['email' => 'johndoe@example.com']); 13 | } 14 | 15 | public function testHaveWithName(FunctionalTester $I) 16 | { 17 | $I->have(User::class, [], 'admin'); 18 | } 19 | 20 | public function testHaveMultiple(FunctionalTester $I) 21 | { 22 | $users = $I->haveMultiple(User::class, 3); 23 | 24 | $I->assertEquals(3, count($users)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/breadcrumbs.less: -------------------------------------------------------------------------------- 1 | // 2 | // Breadcrumbs 3 | // -------------------------------------------------- 4 | 5 | 6 | .breadcrumb { 7 | padding: @breadcrumb-padding-vertical @breadcrumb-padding-horizontal; 8 | margin-bottom: @line-height-computed; 9 | list-style: none; 10 | background-color: @breadcrumb-bg; 11 | border-radius: @border-radius-base; 12 | 13 | > li { 14 | display: inline-block; 15 | 16 | + li:before { 17 | content: "@{breadcrumb-separator}\00a0"; // Unicode space added since inline-block means non-collapsing white-space 18 | padding: 0 5px; 19 | color: @breadcrumb-color; 20 | } 21 | } 22 | 23 | > .active { 24 | color: @breadcrumb-active-color; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire') 27 | ->hourly(); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 18 | $table->string('token')->index(); 19 | $table->timestamp('created_at'); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::drop('password_resets'); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /tests/_support/FunctionalTester.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('email')->unique(); 19 | $table->string('password', 60); 20 | $table->rememberToken(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::drop('users'); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/Console/Commands/Inspire.php: -------------------------------------------------------------------------------- 1 | comment(PHP_EOL.Inspiring::quote().PHP_EOL); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 17 | TestEventListener::class 18 | ] 19 | ]; 20 | 21 | /** 22 | * Register any other events for your application. 23 | * 24 | * @return void 25 | */ 26 | public function boot() 27 | { 28 | parent::boot(); 29 | 30 | // 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /deploy/deployment.yaml: -------------------------------------------------------------------------------- 1 | kind: Service 2 | apiVersion: v1 3 | metadata: 4 | name: php-example-service 5 | spec: 6 | selector: 7 | app: php-example 8 | type: NodePort 9 | ports: 10 | - protocol: TCP 11 | port: 80 12 | targetPort: 80 13 | --- 14 | apiVersion: apps/v1 15 | kind: Deployment 16 | metadata: 17 | name: php-example 18 | labels: 19 | app: php-example 20 | spec: 21 | replicas: 1 22 | selector: 23 | matchLabels: 24 | app: php-example 25 | template: 26 | metadata: 27 | labels: 28 | app: php-example 29 | spec: 30 | imagePullSecrets: 31 | - name: pipeline-docker-registry 32 | containers: 33 | - name: php 34 | image: ${CICD_IMAGE}:${CICD_EXECUTION_SEQUENCE} 35 | ports: 36 | - containerPort: 80 37 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | ./tests/ 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | "Passwords must be at least six characters and match the confirmation.", 17 | "user" => "We can't find a user with that e-mail address.", 18 | "token" => "This password reset token is invalid.", 19 | "sent" => "We have e-mailed your password reset link!", 20 | "reset" => "Your password has been reset!", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/close.less: -------------------------------------------------------------------------------- 1 | // 2 | // Close icons 3 | // -------------------------------------------------- 4 | 5 | 6 | .close { 7 | float: right; 8 | font-size: (@font-size-base * 1.5); 9 | font-weight: @close-font-weight; 10 | line-height: 1; 11 | color: @close-color; 12 | text-shadow: @close-text-shadow; 13 | .opacity(.2); 14 | 15 | &:hover, 16 | &:focus { 17 | color: @close-color; 18 | text-decoration: none; 19 | cursor: pointer; 20 | .opacity(.5); 21 | } 22 | 23 | // Additional properties for button version 24 | // iOS requires the button element instead of an anchor tag. 25 | // If you want the anchor version, it requires `href="#"`. 26 | button& { 27 | padding: 0; 28 | cursor: pointer; 29 | background: transparent; 30 | border: 0; 31 | -webkit-appearance: none; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /resources/views/posts/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.scaffold') 2 | 3 | @section('main') 4 | 5 |

Create Post

6 | 7 |
8 | {{ csrf_field() }} 9 | 24 |
25 | 26 | @if ($errors->any()) 27 | 30 | @endif 31 | 32 | @stop -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/table-row.less: -------------------------------------------------------------------------------- 1 | // Tables 2 | 3 | .table-row-variant(@state; @background) { 4 | // Exact selectors below required to override `.table-striped` and prevent 5 | // inheritance to nested tables. 6 | .table > thead > tr, 7 | .table > tbody > tr, 8 | .table > tfoot > tr { 9 | > td.@{state}, 10 | > th.@{state}, 11 | &.@{state} > td, 12 | &.@{state} > th { 13 | background-color: @background; 14 | } 15 | } 16 | 17 | // Hover states for `.table-hover` 18 | // Note: this is not available for cells or rows within `thead` or `tfoot`. 19 | .table-hover > tbody > tr { 20 | > td.@{state}:hover, 21 | > th.@{state}:hover, 22 | &.@{state}:hover > td, 23 | &:hover > .@{state}, 24 | &.@{state}:hover > th { 25 | background-color: darken(@background, 5%); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /resources/views/users/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.scaffold') 2 | 3 | @section('main') 4 | 5 |

Edit User

6 |
7 | {{ csrf_field() }} 8 | {{ method_field('patch') }} 9 | 19 |
20 | 21 | @if ($errors->any()) 22 | 25 | @endif 26 | 27 | @stop -------------------------------------------------------------------------------- /resources/views/errors/503.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 33 | 34 | 35 |
36 |
37 |
Be right back.
38 |
39 |
40 | 41 | 42 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => '', 19 | 'secret' => '', 20 | ], 21 | 22 | 'mandrill' => [ 23 | 'secret' => '', 24 | ], 25 | 26 | 'ses' => [ 27 | 'key' => '', 28 | 'secret' => '', 29 | 'region' => 'us-east-1', 30 | ], 31 | 32 | 'stripe' => [ 33 | 'model' => 'User', 34 | 'secret' => '', 35 | ], 36 | 37 | ]; 38 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/media.less: -------------------------------------------------------------------------------- 1 | .media { 2 | // Proper spacing between instances of .media 3 | margin-top: 15px; 4 | 5 | &:first-child { 6 | margin-top: 0; 7 | } 8 | } 9 | 10 | .media-right, 11 | .media > .pull-right { 12 | padding-left: 10px; 13 | } 14 | 15 | .media-left, 16 | .media > .pull-left { 17 | padding-right: 10px; 18 | } 19 | 20 | .media-left, 21 | .media-right, 22 | .media-body { 23 | display: table-cell; 24 | vertical-align: top; 25 | } 26 | 27 | .media-middle { 28 | vertical-align: middle; 29 | } 30 | 31 | .media-bottom { 32 | vertical-align: bottom; 33 | } 34 | 35 | // Reset margins on headings for tighter default spacing 36 | .media-heading { 37 | margin-top: 0; 38 | margin-bottom: 5px; 39 | } 40 | 41 | // Media list variation 42 | // 43 | // Undo default ul/ol styles 44 | .media-list { 45 | padding-left: 0; 46 | list-style: none; 47 | } 48 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/component-animations.less: -------------------------------------------------------------------------------- 1 | // 2 | // Component animations 3 | // -------------------------------------------------- 4 | 5 | // Heads up! 6 | // 7 | // We don't use the `.opacity()` mixin here since it causes a bug with text 8 | // fields in IE7-8. Source: https://github.com/twbs/bootstrap/pull/3552. 9 | 10 | .fade { 11 | opacity: 0; 12 | .transition(opacity .15s linear); 13 | &.in { 14 | opacity: 1; 15 | } 16 | } 17 | 18 | .collapse { 19 | display: none; 20 | visibility: hidden; 21 | 22 | &.in { display: block; visibility: visible; } 23 | tr&.in { display: table-row; } 24 | tbody&.in { display: table-row-group; } 25 | } 26 | 27 | .collapsing { 28 | position: relative; 29 | height: 0; 30 | overflow: hidden; 31 | .transition-property(~"height, visibility"); 32 | .transition-duration(.35s); 33 | .transition-timing-function(ease); 34 | } 35 | -------------------------------------------------------------------------------- /tests/functional/CustomValidationCest.php: -------------------------------------------------------------------------------- 1 | amOnPage(''); 8 | $I->haveRecord('posts', [ 9 | 'title' => 'Hello Universe', 10 | 'body' => 'You are so awesome', 11 | 'created_at' => new DateTime(), 12 | 'updated_at' => new DateTime() 13 | ]); 14 | } 15 | 16 | public function testCustomValidationSuccess(FunctionalTester $I) 17 | { 18 | $I->amOnPage('validation?postal_code=1234AB&post_id=1'); 19 | $I->see('Validation success'); 20 | } 21 | 22 | public function testCustomValidationError(FunctionalTester $I) 23 | { 24 | $I->amOnPage('validation?postal_code=invalid&post_id=123456'); 25 | $I->seeFormErrorMessage('postal_code'); 26 | $I->seeFormErrorMessage('post_id'); 27 | } 28 | } -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | auth = $auth; 25 | } 26 | 27 | /** 28 | * Handle an incoming request. 29 | * 30 | * @param \Illuminate\Http\Request $request 31 | * @param \Closure $next 32 | * @return mixed 33 | */ 34 | public function handle($request, Closure $next) 35 | { 36 | if ($this->auth->check()) 37 | { 38 | return new RedirectResponse(url('/home')); 39 | } 40 | 41 | return $next($request); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/thumbnails.less: -------------------------------------------------------------------------------- 1 | // 2 | // Thumbnails 3 | // -------------------------------------------------- 4 | 5 | 6 | // Mixin and adjust the regular image class 7 | .thumbnail { 8 | display: block; 9 | padding: @thumbnail-padding; 10 | margin-bottom: @line-height-computed; 11 | line-height: @line-height-base; 12 | background-color: @thumbnail-bg; 13 | border: 1px solid @thumbnail-border; 14 | border-radius: @thumbnail-border-radius; 15 | .transition(border .2s ease-in-out); 16 | 17 | > img, 18 | a > img { 19 | &:extend(.img-responsive); 20 | margin-left: auto; 21 | margin-right: auto; 22 | } 23 | 24 | // Add a hover state for linked versions only 25 | a&:hover, 26 | a&:focus, 27 | a&.active { 28 | border-color: @link-color; 29 | } 30 | 31 | // Image captions 32 | .caption { 33 | padding: @thumbnail-caption-padding; 34 | color: @thumbnail-caption-color; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/functional/RoutesCest.php: -------------------------------------------------------------------------------- 1 | amOnRoute('posts.index'); 9 | $I->seeCurrentUrlEquals('/posts'); 10 | $I->seeCurrentActionIs('PostsController@index'); 11 | } 12 | 13 | public function openPageByAction(FunctionalTester $I) 14 | { 15 | $I->amOnAction('PostsController@index'); 16 | $I->seeCurrentUrlEquals('/posts'); 17 | $I->seeCurrentRouteIs('posts.index'); 18 | } 19 | 20 | public function openRouteWithDomainSpecified(FunctionalTester $I) 21 | { 22 | $I->amOnRoute('domain'); 23 | $I->seeResponseCodeIs(200); 24 | $I->see('Domain route'); 25 | } 26 | 27 | public function routesWithTrailingSlashes(FunctionalTester $I) 28 | { 29 | $I->amOnPage('/redirect'); 30 | $I->seeCurrentRouteIs('homepage'); 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /app/Http/Controllers/WelcomeController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 24 | } 25 | 26 | /** 27 | * Show the application welcome screen to the user. 28 | * 29 | * @return Response 30 | */ 31 | public function index() 32 | { 33 | return view('welcome'); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /resources/views/posts/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.scaffold') 2 | 3 | @section('main') 4 | 5 |

Show Post

6 | 7 |

Return to all posts

8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 29 | 30 | 31 |
TitleBody
{{ $post->title }}{{ $post->body }}Edit 23 |
24 | {{ csrf_field() }} 25 | {{ method_field('delete') }} 26 | 27 |
28 |
32 | 33 | @stop -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ResetPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 29 | } 30 | } -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | 'App\Http\Middleware\Authenticate', 28 | 'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth', 29 | 'guest' => 'App\Http\Middleware\RedirectIfAuthenticated', 30 | ]; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /database/factories/ModelFactory.php: -------------------------------------------------------------------------------- 1 | define(App\User::class, function (Faker\Generator $faker) { 15 | return [ 16 | 'email' => $faker->email, 17 | 'password' => bcrypt(str_random(10)), 18 | 'remember_token' => str_random(10), 19 | ]; 20 | }); 21 | 22 | $factory->defineAs(App\User::class, 'admin', function (Faker\Generator $faker) { 23 | return [ 24 | 'email' => $faker->email, 25 | 'password' => bcrypt(str_random(10)), 26 | 'remember_token' => str_random(10), 27 | ]; 28 | }); 29 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ForgotPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 29 | } 30 | } -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | auth = $auth; 24 | } 25 | 26 | /** 27 | * Handle an incoming request. 28 | * 29 | * @param \Illuminate\Http\Request $request 30 | * @param \Closure $next 31 | * @return mixed 32 | */ 33 | public function handle($request, Closure $next) 34 | { 35 | if ($this->auth->guest()) 36 | { 37 | if ($request->ajax()) 38 | { 39 | return response('Unauthorized.', 401); 40 | } 41 | else 42 | { 43 | return redirect()->guest('login'); 44 | } 45 | } 46 | 47 | return $next($request); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 37 | 38 | 39 |
40 |
41 |
Laravel 5
42 |
{{ Inspiring::quote() }}
43 |
44 |
45 | 46 | 47 | -------------------------------------------------------------------------------- /.rancher-pipeline.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - name: Codeception test 3 | steps: 4 | - runScriptConfig: 5 | image: php:7.2 6 | shellScript: |- 7 | apt-get update 8 | apt-get install -y --no-install-recommends git zip libsqlite3-dev zlib1g-dev 9 | docker-php-ext-install zip 10 | curl --silent --show-error https://getcomposer.org/installer | php 11 | ./composer.phar install -n --prefer-dist 12 | touch storage/testing.sqlite storage/database.sqlite 13 | cp .env.testing .env 14 | php artisan migrate 15 | php artisan migrate --env=testing --database=sqlite_testing --force 16 | ./vendor/bin/codecept build 17 | ./vendor/bin/codecept run 18 | - name: Publish image 19 | steps: 20 | - publishImageConfig: 21 | dockerfilePath: ./Dockerfile 22 | buildContext: . 23 | tag: php-example:${CICD_EXECUTION_SEQUENCE} 24 | - name: Deploy 25 | steps: 26 | - applyYamlConfig: 27 | path: ./deploy/deployment.yaml 28 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | require 'json' 2 | require 'yaml' 3 | 4 | VAGRANTFILE_API_VERSION ||= "2" 5 | confDir = $confDir ||= File.expand_path("./homestead", File.dirname(__FILE__)) 6 | 7 | homesteadYamlPath = "Homestead.yaml" 8 | homesteadJsonPath = "Homestead.json" 9 | afterScriptPath = "after.sh" 10 | aliasesPath = "aliases" 11 | 12 | require File.expand_path(confDir + '/scripts/homestead.rb') 13 | 14 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 15 | if File.exists? aliasesPath then 16 | config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases" 17 | end 18 | 19 | if File.exists? homesteadYamlPath then 20 | Homestead.configure(config, YAML::load(File.read(homesteadYamlPath))) 21 | elsif File.exists? homesteadJsonPath then 22 | Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath))) 23 | end 24 | 25 | if File.exists? afterScriptPath then 26 | config.vm.provision "shell", path: afterScriptPath 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /resources/views/posts/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.scaffold') 2 | 3 | @section('main') 4 | 5 |

Edit Post

6 |
7 | {{ csrf_field() }} 8 | {{ method_field('patch') }} 9 | 25 |
26 | 27 | @if ($errors->any()) 28 | 31 | @endif 32 | 33 | @stop -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/utilities.less: -------------------------------------------------------------------------------- 1 | // 2 | // Utility classes 3 | // -------------------------------------------------- 4 | 5 | 6 | // Floats 7 | // ------------------------- 8 | 9 | .clearfix { 10 | .clearfix(); 11 | } 12 | .center-block { 13 | .center-block(); 14 | } 15 | .pull-right { 16 | float: right !important; 17 | } 18 | .pull-left { 19 | float: left !important; 20 | } 21 | 22 | 23 | // Toggling content 24 | // ------------------------- 25 | 26 | // Note: Deprecated .hide in favor of .hidden or .sr-only (as appropriate) in v3.0.1 27 | .hide { 28 | display: none !important; 29 | } 30 | .show { 31 | display: block !important; 32 | } 33 | .invisible { 34 | visibility: hidden; 35 | } 36 | .text-hide { 37 | .text-hide(); 38 | } 39 | 40 | 41 | // Hide from screenreaders and browsers 42 | // 43 | // Credit: HTML5 Boilerplate 44 | 45 | .hidden { 46 | display: none !important; 47 | visibility: hidden !important; 48 | } 49 | 50 | 51 | // For Affix plugin 52 | // ------------------------- 53 | 54 | .affix { 55 | position: fixed; 56 | } 57 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | realpath(base_path('resources/views')) 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => realpath(storage_path().'/framework/views'), 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "description": "The Laravel Framework.", 4 | "keywords": ["framework", "laravel"], 5 | "license": "MIT", 6 | "type": "project", 7 | "require": { 8 | "laravel/framework": "5.4.*", 9 | "flow/jsonpath": "^0.2.4", 10 | "fzaninotto/faker": "~1.4" 11 | }, 12 | "require-dev": { 13 | "phpunit/phpunit": "~4.0", 14 | "phpspec/phpspec": "~2.1", 15 | "codeception/codeception": "2.2.x-dev", 16 | "symfony/dom-crawler": "~3.0", 17 | "symfony/css-selector": "~3.0" 18 | }, 19 | "autoload": { 20 | "classmap": [ 21 | "database" 22 | ], 23 | "psr-4": { 24 | "App\\": "app/" 25 | } 26 | }, 27 | "autoload-dev": { 28 | }, 29 | "scripts": { 30 | "post-install-cmd": [ 31 | "php artisan clear-compiled", 32 | "php artisan optimize" 33 | ], 34 | "post-update-cmd": [ 35 | "php artisan clear-compiled", 36 | "php artisan optimize" 37 | ], 38 | "post-create-project-cmd": [ 39 | "php -r \"copy('.env.example', '.env');\"", 40 | "php artisan key:generate" 41 | ] 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/pager.less: -------------------------------------------------------------------------------- 1 | // 2 | // Pager pagination 3 | // -------------------------------------------------- 4 | 5 | 6 | .pager { 7 | padding-left: 0; 8 | margin: @line-height-computed 0; 9 | list-style: none; 10 | text-align: center; 11 | &:extend(.clearfix all); 12 | li { 13 | display: inline; 14 | > a, 15 | > span { 16 | display: inline-block; 17 | padding: 5px 14px; 18 | background-color: @pager-bg; 19 | border: 1px solid @pager-border; 20 | border-radius: @pager-border-radius; 21 | } 22 | 23 | > a:hover, 24 | > a:focus { 25 | text-decoration: none; 26 | background-color: @pager-hover-bg; 27 | } 28 | } 29 | 30 | .next { 31 | > a, 32 | > span { 33 | float: right; 34 | } 35 | } 36 | 37 | .previous { 38 | > a, 39 | > span { 40 | float: left; 41 | } 42 | } 43 | 44 | .disabled { 45 | > a, 46 | > a:hover, 47 | > a:focus, 48 | > span { 49 | color: @pager-disabled-color; 50 | background-color: @pager-bg; 51 | cursor: @cursor-disabled; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/LoginController.php: -------------------------------------------------------------------------------- 1 | middleware('guest', ['except' => 'logout']); 36 | } 37 | } -------------------------------------------------------------------------------- /app/User.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | 14 | 15 |
16 | @if (Session::has('message')) 17 |
18 |

{{ Session::get('message') }}

19 |
20 | @endif 21 | 22 | @yield('main') 23 | 24 |
25 | @if (Auth::user()) 26 | Logged in as {{{ Auth::user()->email }}}. 27 | Logout 28 | @else 29 | Not logged in 30 | @endif 31 |
32 |
33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | group(['namespace' => $this->namespace], function ($router) { 39 | require app_path('Http/routes.php'); 40 | }); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | jobs: 4 | build: 5 | docker: 6 | - image: circleci/php:7.1-node-browsers 7 | working_directory: ~/laravel 8 | steps: 9 | - checkout 10 | - run: sudo apt install -y libsqlite3-dev zlib1g-dev 11 | - run: sudo docker-php-ext-install zip 12 | - run: sudo composer self-update 13 | - restore_cache: 14 | keys: 15 | - composer-v1-{{ checksum "composer.lock" }} 16 | - composer-v1- 17 | - run: composer install -n --prefer-dist 18 | - save_cache: 19 | key: composer-v1-{{ checksum "composer.lock" }} 20 | paths: 21 | - vendor 22 | - restore_cache: 23 | keys: 24 | - node-v1-{{ checksum "package.json" }} 25 | - node-v1- 26 | - run: yarn install 27 | - save_cache: 28 | key: node-v1-{{ checksum "package.json" }} 29 | paths: 30 | - node_modules 31 | - run: touch storage/testing.sqlite 32 | - run: php artisan migrate --env=testing --database=sqlite_testing --force 33 | - run: ./vendor/bin/codecept build 34 | - run: ./vendor/bin/codecept run 35 | -------------------------------------------------------------------------------- /app/Console/Commands/CreateUser.php: -------------------------------------------------------------------------------- 1 | email = $this->argument('email'); 44 | $user->password = $this->argument('password'); 45 | $user->save(); 46 | 47 | $this->line('User created!'); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tests/functional/InternalDomainsCest.php: -------------------------------------------------------------------------------- 1 | amOnPage('https://www.google.com'); 10 | $I->fail('Visiting an external URL should throw an ExternalUrlException'); 11 | } catch (\Codeception\Exception\ExternalUrlException $ignored) {} 12 | } 13 | 14 | public function testWithDomain(FunctionalTester $I) 15 | { 16 | $I->amOnPage('http://example.com'); 17 | $I->see('Domain route'); 18 | } 19 | 20 | public function testWithSubdomain(FunctionalTester $I) 21 | { 22 | $I->amOnPage('http://subdomain.example.com'); 23 | $I->see('Subdomain route'); 24 | } 25 | 26 | public function testWithWildcardInDomain(FunctionalTester $I) 27 | { 28 | $I->amOnPage('http://wildcard.example.com'); 29 | $I->see('Wildcard route'); 30 | } 31 | 32 | public function testWithMultipleWildcardsInDomain(FunctionalTester $I) 33 | { 34 | $I->amOnPage('http://wild.card.example.com'); 35 | $I->see('Multiple wildcards route'); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /resources/views/posts/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.scaffold') 2 | 3 | @section('main') 4 | 5 |

All Posts

6 | 7 |

Add new post

8 | 9 | @if ($posts->count()) 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | @foreach ($posts as $post) 20 | 21 | 22 | 23 | 24 | 31 | 32 | @endforeach 33 | 34 |
TitleBody
{{ $post->title }}{{ $post->body }}Edit 25 |
26 | {{ csrf_field() }} 27 | {{ method_field('delete') }} 28 | 29 |
30 |
35 | @else 36 | There are no posts 37 | @endif 38 | 39 | @stop -------------------------------------------------------------------------------- /bootstrap/autoload.php: -------------------------------------------------------------------------------- 1 | hr { 23 | border-top-color: darken(@jumbotron-bg, 10%); 24 | } 25 | 26 | .container &, 27 | .container-fluid & { 28 | border-radius: @border-radius-large; // Only round corners at higher resolutions if contained in a container 29 | } 30 | 31 | .container { 32 | max-width: 100%; 33 | } 34 | 35 | @media screen and (min-width: @screen-sm-min) { 36 | padding: (@jumbotron-padding * 1.6) 0; 37 | 38 | .container &, 39 | .container-fluid & { 40 | padding-left: (@jumbotron-padding * 2); 41 | padding-right: (@jumbotron-padding * 2); 42 | } 43 | 44 | h1, 45 | .h1 { 46 | font-size: (@font-size-base * 4.5); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/image.less: -------------------------------------------------------------------------------- 1 | // Image Mixins 2 | // - Responsive image 3 | // - Retina image 4 | 5 | 6 | // Responsive image 7 | // 8 | // Keep images from scaling beyond the width of their parents. 9 | .img-responsive(@display: block) { 10 | display: @display; 11 | max-width: 100%; // Part 1: Set a maximum relative to the parent 12 | height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching 13 | } 14 | 15 | 16 | // Retina image 17 | // 18 | // Short retina mixin for setting background-image and -size. Note that the 19 | // spelling of `min--moz-device-pixel-ratio` is intentional. 20 | .img-retina(@file-1x; @file-2x; @width-1x; @height-1x) { 21 | background-image: url("@{file-1x}"); 22 | 23 | @media 24 | only screen and (-webkit-min-device-pixel-ratio: 2), 25 | only screen and ( min--moz-device-pixel-ratio: 2), 26 | only screen and ( -o-min-device-pixel-ratio: 2/1), 27 | only screen and ( min-device-pixel-ratio: 2), 28 | only screen and ( min-resolution: 192dpi), 29 | only screen and ( min-resolution: 2dppx) { 30 | background-image: url("@{file-2x}"); 31 | background-size: @width-1x @height-1x; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /config/compile.php: -------------------------------------------------------------------------------- 1 | [ 17 | 18 | realpath(__DIR__.'/../app/Providers/AppServiceProvider.php'), 19 | realpath(__DIR__.'/../app/Providers/EventServiceProvider.php'), 20 | realpath(__DIR__.'/../app/Providers/RouteServiceProvider.php'), 21 | 22 | ], 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Compiled File Providers 27 | |-------------------------------------------------------------------------- 28 | | 29 | | Here you may list service providers which define a "compiles" function 30 | | that returns additional files that should be compiled, providing an 31 | | easy way to get common files from any packages you are utilizing. 32 | | 33 | */ 34 | 35 | 'providers' => [ 36 | // 37 | ], 38 | 39 | ]; 40 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins.less: -------------------------------------------------------------------------------- 1 | // Mixins 2 | // -------------------------------------------------- 3 | 4 | // Utilities 5 | @import "mixins/hide-text.less"; 6 | @import "mixins/opacity.less"; 7 | @import "mixins/image.less"; 8 | @import "mixins/labels.less"; 9 | @import "mixins/reset-filter.less"; 10 | @import "mixins/resize.less"; 11 | @import "mixins/responsive-visibility.less"; 12 | @import "mixins/size.less"; 13 | @import "mixins/tab-focus.less"; 14 | @import "mixins/text-emphasis.less"; 15 | @import "mixins/text-overflow.less"; 16 | @import "mixins/vendor-prefixes.less"; 17 | 18 | // Components 19 | @import "mixins/alerts.less"; 20 | @import "mixins/buttons.less"; 21 | @import "mixins/panels.less"; 22 | @import "mixins/pagination.less"; 23 | @import "mixins/list-group.less"; 24 | @import "mixins/nav-divider.less"; 25 | @import "mixins/forms.less"; 26 | @import "mixins/progress-bar.less"; 27 | @import "mixins/table-row.less"; 28 | 29 | // Skins 30 | @import "mixins/background-variant.less"; 31 | @import "mixins/border-radius.less"; 32 | @import "mixins/gradients.less"; 33 | 34 | // Layout 35 | @import "mixins/clearfix.less"; 36 | @import "mixins/center-block.less"; 37 | @import "mixins/nav-vertical-align.less"; 38 | @import "mixins/grid-framework.less"; 39 | @import "mixins/grid.less"; 40 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/buttons.less: -------------------------------------------------------------------------------- 1 | // Button variants 2 | // 3 | // Easily pump out default styles, as well as :hover, :focus, :active, 4 | // and disabled options for all buttons 5 | 6 | .button-variant(@color; @background; @border) { 7 | color: @color; 8 | background-color: @background; 9 | border-color: @border; 10 | 11 | &:hover, 12 | &:focus, 13 | &.focus, 14 | &:active, 15 | &.active, 16 | .open > .dropdown-toggle& { 17 | color: @color; 18 | background-color: darken(@background, 10%); 19 | border-color: darken(@border, 12%); 20 | } 21 | &:active, 22 | &.active, 23 | .open > .dropdown-toggle& { 24 | background-image: none; 25 | } 26 | &.disabled, 27 | &[disabled], 28 | fieldset[disabled] & { 29 | &, 30 | &:hover, 31 | &:focus, 32 | &.focus, 33 | &:active, 34 | &.active { 35 | background-color: @background; 36 | border-color: @border; 37 | } 38 | } 39 | 40 | .badge { 41 | color: @background; 42 | background-color: @color; 43 | } 44 | } 45 | 46 | // Button sizes 47 | .button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) { 48 | padding: @padding-vertical @padding-horizontal; 49 | font-size: @font-size; 50 | line-height: @line-height; 51 | border-radius: @border-radius; 52 | } 53 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->bind( 34 | 'Illuminate\Contracts\Auth\Registrar', 35 | 'App\Services\Registrar' 36 | ); 37 | 38 | $this->app->bind('App\Test\StringConverter', 'App\Test\ToLowercase'); 39 | $this->app->addContextualBinding('App\Test\Repeat', '$times', 2); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /tests/functional/FormErrorsCest.php: -------------------------------------------------------------------------------- 1 | amOnPage('/register'); 9 | $I->click('button[type=submit]'); 10 | } 11 | 12 | public function testSeeFormHasErrors(FunctionalTester $I) 13 | { 14 | $I->seeFormHasErrors(); 15 | } 16 | 17 | public function testDontSeeFormErrors(FunctionalTester $I) 18 | { 19 | $I->amOnPage(''); 20 | $I->dontSeeFormErrors(); 21 | } 22 | 23 | public function testSeeFormErrorMessage(FunctionalTester $I) 24 | { 25 | $I->seeFormErrorMessage('name'); 26 | $I->seeFormErrorMessage('name', 'required'); 27 | $I->seeFormErrorMessage('name', 'The name field is required.'); 28 | } 29 | 30 | public function testSeeFormErrorMessages(FunctionalTester $I) 31 | { 32 | $I->seeFormErrorMessages(array( 33 | 'name' => null, 34 | 'email' => null, 35 | )); 36 | 37 | $I->seeFormErrorMessages(array( 38 | 'name' => 'required', 39 | 'email' => 'required', 40 | )); 41 | 42 | $I->seeFormErrorMessages(array( 43 | 'name' => 'The name field is required.', 44 | 'email' => 'The email field is required.' 45 | )); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/bootstrap.less: -------------------------------------------------------------------------------- 1 | // Core variables and mixins 2 | @import "variables.less"; 3 | @import "mixins.less"; 4 | 5 | // Reset and dependencies 6 | @import "normalize.less"; 7 | @import "print.less"; 8 | @import "glyphicons.less"; 9 | 10 | // Core CSS 11 | @import "scaffolding.less"; 12 | @import "type.less"; 13 | @import "code.less"; 14 | @import "grid.less"; 15 | @import "tables.less"; 16 | @import "forms.less"; 17 | @import "buttons.less"; 18 | 19 | // Components 20 | @import "component-animations.less"; 21 | @import "dropdowns.less"; 22 | @import "button-groups.less"; 23 | @import "input-groups.less"; 24 | @import "navs.less"; 25 | @import "navbar.less"; 26 | @import "breadcrumbs.less"; 27 | @import "pagination.less"; 28 | @import "pager.less"; 29 | @import "labels.less"; 30 | @import "badges.less"; 31 | @import "jumbotron.less"; 32 | @import "thumbnails.less"; 33 | @import "alerts.less"; 34 | @import "progress-bars.less"; 35 | @import "media.less"; 36 | @import "list-group.less"; 37 | @import "panels.less"; 38 | @import "responsive-embed.less"; 39 | @import "wells.less"; 40 | @import "close.less"; 41 | 42 | // Components w/ JavaScript 43 | @import "modals.less"; 44 | @import "tooltip.less"; 45 | @import "popovers.less"; 46 | @import "carousel.less"; 47 | 48 | // Utility classes 49 | @import "utilities.less"; 50 | @import "responsive-utilities.less"; 51 | -------------------------------------------------------------------------------- /tests/functional/ServiceContainerCest.php: -------------------------------------------------------------------------------- 1 | haveBinding('App\Test\StringConverter', 'App\Test\ToUppercase'); 8 | 9 | $I->amOnPage('service-container'); 10 | $I->seeElement("//p[text()='STRING TO CONVERT']"); 11 | } 12 | 13 | public function testHaveSingleton(FunctionalTester $I) 14 | { 15 | $I->haveSingleton('App\Test\StringConverter', 'App\Test\ToUppercase'); 16 | 17 | $I->amOnPage('service-container'); 18 | $I->seeElement("//p[text()='STRING TO CONVERT']"); 19 | } 20 | 21 | public function testHaveInstance(FunctionalTester $I) 22 | { 23 | $converter = new \App\Test\ToUppercase(); 24 | $I->haveInstance('App\Test\StringConverter', $converter); 25 | 26 | $I->amOnPage('service-container'); 27 | $I->seeElement("//p[text()='STRING TO CONVERT']"); 28 | } 29 | 30 | public function testHaveContextualBinding(FunctionalTester $I) 31 | { 32 | $I->haveContextualBinding('App\Test\Repeat', '$times', 3); 33 | $I->haveBinding('App\Test\StringConverter', 'App\Test\Repeat'); 34 | 35 | $I->amOnPage('service-container'); 36 | $I->seeElement("//p[text()='String To ConvertString To ConvertString To Convert']"); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/labels.less: -------------------------------------------------------------------------------- 1 | // 2 | // Labels 3 | // -------------------------------------------------- 4 | 5 | .label { 6 | display: inline; 7 | padding: .2em .6em .3em; 8 | font-size: 75%; 9 | font-weight: bold; 10 | line-height: 1; 11 | color: @label-color; 12 | text-align: center; 13 | white-space: nowrap; 14 | vertical-align: baseline; 15 | border-radius: .25em; 16 | 17 | // Add hover effects, but only for links 18 | a& { 19 | &:hover, 20 | &:focus { 21 | color: @label-link-hover-color; 22 | text-decoration: none; 23 | cursor: pointer; 24 | } 25 | } 26 | 27 | // Empty labels collapse automatically (not available in IE8) 28 | &:empty { 29 | display: none; 30 | } 31 | 32 | // Quick fix for labels in buttons 33 | .btn & { 34 | position: relative; 35 | top: -1px; 36 | } 37 | } 38 | 39 | // Colors 40 | // Contextual variations (linked labels get darker on :hover) 41 | 42 | .label-default { 43 | .label-variant(@label-default-bg); 44 | } 45 | 46 | .label-primary { 47 | .label-variant(@label-primary-bg); 48 | } 49 | 50 | .label-success { 51 | .label-variant(@label-success-bg); 52 | } 53 | 54 | .label-info { 55 | .label-variant(@label-info-bg); 56 | } 57 | 58 | .label-warning { 59 | .label-variant(@label-warning-bg); 60 | } 61 | 62 | .label-danger { 63 | .label-variant(@label-danger-bg); 64 | } 65 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/badges.less: -------------------------------------------------------------------------------- 1 | // 2 | // Badges 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base class 7 | .badge { 8 | display: inline-block; 9 | min-width: 10px; 10 | padding: 3px 7px; 11 | font-size: @font-size-small; 12 | font-weight: @badge-font-weight; 13 | color: @badge-color; 14 | line-height: @badge-line-height; 15 | vertical-align: baseline; 16 | white-space: nowrap; 17 | text-align: center; 18 | background-color: @badge-bg; 19 | border-radius: @badge-border-radius; 20 | 21 | // Empty badges collapse automatically (not available in IE8) 22 | &:empty { 23 | display: none; 24 | } 25 | 26 | // Quick fix for badges in buttons 27 | .btn & { 28 | position: relative; 29 | top: -1px; 30 | } 31 | .btn-xs & { 32 | top: 0; 33 | padding: 1px 5px; 34 | } 35 | 36 | // Hover state, but only for links 37 | a& { 38 | &:hover, 39 | &:focus { 40 | color: @badge-link-hover-color; 41 | text-decoration: none; 42 | cursor: pointer; 43 | } 44 | } 45 | 46 | // Account for badges in navs 47 | .list-group-item.active > &, 48 | .nav-pills > .active > a > & { 49 | color: @badge-active-color; 50 | background-color: @badge-active-bg; 51 | } 52 | .list-group-item > & { 53 | float: right; 54 | } 55 | .list-group-item > & + & { 56 | margin-right: 5px; 57 | } 58 | .nav-pills > li > a > & { 59 | margin-left: 3px; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /tests/functional/RecordCest.php: -------------------------------------------------------------------------------- 1 | 'johndoe@example.com', 7 | 'password' => 'password', 8 | 'created_at' => '', 9 | 'updated_at' => '' 10 | ]; 11 | 12 | public function testHaveRecordWithTableName(FunctionalTester $I) 13 | { 14 | $id = $I->haveRecord('users', $this->userAttributes); 15 | 16 | $I->seeRecord('users', ['id' => $id, 'email' => 'johndoe@example.com']); 17 | $I->dontSeeRecord('users', ['id' => $id, 'email' => 'janedoe@example.com']); 18 | } 19 | 20 | public function testHaveRecordWithModel(FunctionalTester $I) 21 | { 22 | $user = $I->haveRecord('App\User', $this->userAttributes); 23 | 24 | $I->seeRecord('App\User', ['id' => $user->id, 'email' => 'johndoe@example.com']); 25 | $I->dontSeeRecord('App\User', ['id' => $user->id, 'email' => 'janedoe@example.com']); 26 | } 27 | 28 | public function testGrabRecordWithTableName(FunctionalTester $I) 29 | { 30 | $I->haveRecord('App\User', $this->userAttributes); 31 | 32 | $record = $I->grabRecord('users', ['email' => 'johndoe@example.com']); 33 | 34 | $I->assertTrue(is_array($record)); 35 | } 36 | 37 | public function testGrabRecordWithModel(FunctionalTester $I) 38 | { 39 | $I->haveRecord('App\User', $this->userAttributes); 40 | 41 | $model = $I->grabRecord('App\User', ['email' => 'johndoe@example.com']); 42 | 43 | $I->assertTrue($model instanceof App\User); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /resources/views/auth/password.blade.php: -------------------------------------------------------------------------------- 1 | @extends('app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
Reset Password
9 |
10 | @if (session('status')) 11 |
12 | {{ session('status') }} 13 |
14 | @endif 15 | 16 | @if (count($errors) > 0) 17 |
18 | Whoops! There were some problems with your input.

19 |
    20 | @foreach ($errors->all() as $error) 21 |
  • {{ $error }}
  • 22 | @endforeach 23 |
24 |
25 | @endif 26 | 27 |
28 | 29 | 30 |
31 | 32 |
33 | 34 |
35 |
36 | 37 |
38 |
39 | 42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | @endsection 51 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | isHttpException($e)) { 48 | return $this->renderHttpException($e); 49 | } else { 50 | return parent::render($request, $e); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /app/Http/Controllers/UsersController.php: -------------------------------------------------------------------------------- 1 | user = $user; 22 | } 23 | 24 | /** 25 | * Display the specified resource. 26 | * 27 | * @param int $id 28 | * @return Response 29 | */ 30 | public function show($id) 31 | { 32 | $user = $this->user->findOrFail($id); 33 | 34 | return view('users.show', compact('user')); 35 | } 36 | 37 | /** 38 | * Show the form for editing the specified resource. 39 | * 40 | * @param int $id 41 | * @return Response 42 | */ 43 | public function edit($id) 44 | { 45 | $user = $this->user->findOrFail($id); 46 | 47 | return view('users.edit', compact('user')); 48 | } 49 | 50 | /** 51 | * Update the specified resource in storage. 52 | * 53 | * @param Request $request 54 | * @param int $id 55 | * @return Response 56 | */ 57 | public function update(Request $request, $id) 58 | { 59 | $this->validate($request, ['email' => 'required|email']); 60 | 61 | $user = $this->user->findOrFail($id); 62 | $user->update($request->all()); 63 | $user->save(); 64 | 65 | return redirect()->route('users.show', $id); 66 | } 67 | 68 | } -------------------------------------------------------------------------------- /tests/_support/Page/Functional/PostsPage.php: -------------------------------------------------------------------------------- 1 | '#title', 'body' => 'Body:']; 17 | 18 | /** 19 | * @var FunctionalTester; 20 | */ 21 | protected $tester; 22 | 23 | public function __construct(FunctionalTester $I) 24 | { 25 | $this->tester = $I; 26 | } 27 | 28 | public function createPost($fields = []) 29 | { 30 | $I = $this->tester; 31 | $I->amOnPage(static::$url); 32 | $I->click('Add new post'); 33 | $this->fillFormFields($fields); 34 | $I->click('Submit'); 35 | } 36 | 37 | public function editPost($id, $fields = []) 38 | { 39 | $I = $this->tester; 40 | $I->amOnPage(self::route("/$id/edit")); 41 | $I->see('Edit Post', 'h1'); 42 | $this->fillFormFields($fields); 43 | $I->click('Update'); 44 | } 45 | 46 | public function deletePost($id) 47 | { 48 | $I = $this->tester; 49 | $I->amOnPage(self::route("/$id")); 50 | $I->click('Delete'); 51 | } 52 | 53 | protected function fillFormFields($data) 54 | { 55 | foreach ($data as $field => $value) { 56 | if (!isset(static::$formFields[$field])) { 57 | throw new \Exception("Form field $field does not exist"); 58 | } 59 | $this->tester->fillField(static::$formFields[$field], $value); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/code.less: -------------------------------------------------------------------------------- 1 | // 2 | // Code (inline and block) 3 | // -------------------------------------------------- 4 | 5 | 6 | // Inline and block code styles 7 | code, 8 | kbd, 9 | pre, 10 | samp { 11 | font-family: @font-family-monospace; 12 | } 13 | 14 | // Inline code 15 | code { 16 | padding: 2px 4px; 17 | font-size: 90%; 18 | color: @code-color; 19 | background-color: @code-bg; 20 | border-radius: @border-radius-base; 21 | } 22 | 23 | // User input typically entered via keyboard 24 | kbd { 25 | padding: 2px 4px; 26 | font-size: 90%; 27 | color: @kbd-color; 28 | background-color: @kbd-bg; 29 | border-radius: @border-radius-small; 30 | box-shadow: inset 0 -1px 0 rgba(0,0,0,.25); 31 | 32 | kbd { 33 | padding: 0; 34 | font-size: 100%; 35 | font-weight: bold; 36 | box-shadow: none; 37 | } 38 | } 39 | 40 | // Blocks of code 41 | pre { 42 | display: block; 43 | padding: ((@line-height-computed - 1) / 2); 44 | margin: 0 0 (@line-height-computed / 2); 45 | font-size: (@font-size-base - 1); // 14px to 13px 46 | line-height: @line-height-base; 47 | word-break: break-all; 48 | word-wrap: break-word; 49 | color: @pre-color; 50 | background-color: @pre-bg; 51 | border: 1px solid @pre-border-color; 52 | border-radius: @border-radius-base; 53 | 54 | // Account for some code outputs that place code tags in pre tags 55 | code { 56 | padding: 0; 57 | font-size: inherit; 58 | color: inherit; 59 | white-space: pre-wrap; 60 | background-color: transparent; 61 | border-radius: 0; 62 | } 63 | } 64 | 65 | // Enable scrollable blocks of code 66 | .pre-scrollable { 67 | max-height: @pre-scrollable-max-height; 68 | overflow-y: scroll; 69 | } 70 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | 'Illuminate\Contracts\Http\Kernel', 31 | 'App\Http\Kernel' 32 | ); 33 | 34 | $app->singleton( 35 | 'Illuminate\Contracts\Console\Kernel', 36 | 'App\Console\Kernel' 37 | ); 38 | 39 | $app->singleton( 40 | 'Illuminate\Contracts\Debug\ExceptionHandler', 41 | 'App\Exceptions\Handler' 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/grid.less: -------------------------------------------------------------------------------- 1 | // 2 | // Grid system 3 | // -------------------------------------------------- 4 | 5 | 6 | // Container widths 7 | // 8 | // Set the container width, and override it for fixed navbars in media queries. 9 | 10 | .container { 11 | .container-fixed(); 12 | 13 | @media (min-width: @screen-sm-min) { 14 | width: @container-sm; 15 | } 16 | @media (min-width: @screen-md-min) { 17 | width: @container-md; 18 | } 19 | @media (min-width: @screen-lg-min) { 20 | width: @container-lg; 21 | } 22 | } 23 | 24 | 25 | // Fluid container 26 | // 27 | // Utilizes the mixin meant for fixed width containers, but without any defined 28 | // width for fluid, full width layouts. 29 | 30 | .container-fluid { 31 | .container-fixed(); 32 | } 33 | 34 | 35 | // Row 36 | // 37 | // Rows contain and clear the floats of your columns. 38 | 39 | .row { 40 | .make-row(); 41 | } 42 | 43 | 44 | // Columns 45 | // 46 | // Common styles for small and large grid columns 47 | 48 | .make-grid-columns(); 49 | 50 | 51 | // Extra small grid 52 | // 53 | // Columns, offsets, pushes, and pulls for extra small devices like 54 | // smartphones. 55 | 56 | .make-grid(xs); 57 | 58 | 59 | // Small grid 60 | // 61 | // Columns, offsets, pushes, and pulls for the small device range, from phones 62 | // to tablets. 63 | 64 | @media (min-width: @screen-sm-min) { 65 | .make-grid(sm); 66 | } 67 | 68 | 69 | // Medium grid 70 | // 71 | // Columns, offsets, pushes, and pulls for the desktop device range. 72 | 73 | @media (min-width: @screen-md-min) { 74 | .make-grid(md); 75 | } 76 | 77 | 78 | // Large grid 79 | // 80 | // Columns, offsets, pushes, and pulls for the large desktop device range. 81 | 82 | @media (min-width: @screen-lg-min) { 83 | .make-grid(lg); 84 | } 85 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make('Illuminate\Contracts\Console\Kernel'); 32 | 33 | $status = $kernel->handle( 34 | $input = new Symfony\Component\Console\Input\ArgvInput, 35 | new Symfony\Component\Console\Output\ConsoleOutput 36 | ); 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Shutdown The Application 41 | |-------------------------------------------------------------------------- 42 | | 43 | | Once Artisan has finished running. We will fire off the shutdown events 44 | | so that any final work may be done by the application before we shut 45 | | down the process. This is the last thing to happen to the request. 46 | | 47 | */ 48 | 49 | $kernel->terminate($input, $status); 50 | 51 | exit($status); 52 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/alerts.less: -------------------------------------------------------------------------------- 1 | // 2 | // Alerts 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base styles 7 | // ------------------------- 8 | 9 | .alert { 10 | padding: @alert-padding; 11 | margin-bottom: @line-height-computed; 12 | border: 1px solid transparent; 13 | border-radius: @alert-border-radius; 14 | 15 | // Headings for larger alerts 16 | h4 { 17 | margin-top: 0; 18 | // Specified for the h4 to prevent conflicts of changing @headings-color 19 | color: inherit; 20 | } 21 | // Provide class for links that match alerts 22 | .alert-link { 23 | font-weight: @alert-link-font-weight; 24 | } 25 | 26 | // Improve alignment and spacing of inner content 27 | > p, 28 | > ul { 29 | margin-bottom: 0; 30 | } 31 | > p + p { 32 | margin-top: 5px; 33 | } 34 | } 35 | 36 | // Dismissible alerts 37 | // 38 | // Expand the right padding and account for the close button's positioning. 39 | 40 | .alert-dismissable, // The misspelled .alert-dismissable was deprecated in 3.2.0. 41 | .alert-dismissible { 42 | padding-right: (@alert-padding + 20); 43 | 44 | // Adjust close link position 45 | .close { 46 | position: relative; 47 | top: -2px; 48 | right: -21px; 49 | color: inherit; 50 | } 51 | } 52 | 53 | // Alternate styles 54 | // 55 | // Generate contextual modifier classes for colorizing the alert. 56 | 57 | .alert-success { 58 | .alert-variant(@alert-success-bg; @alert-success-border; @alert-success-text); 59 | } 60 | .alert-info { 61 | .alert-variant(@alert-info-bg; @alert-info-border; @alert-info-text); 62 | } 63 | .alert-warning { 64 | .alert-variant(@alert-warning-bg; @alert-warning-border; @alert-warning-text); 65 | } 66 | .alert-danger { 67 | .alert-variant(@alert-danger-bg; @alert-danger-border; @alert-danger-text); 68 | } 69 | -------------------------------------------------------------------------------- /app/Http/routes.php: -------------------------------------------------------------------------------- 1 | 'example.com', 'as' => 'domain', 'uses' => 'HomeController@domain']); 15 | Route::get('', ['domain' => 'subdomain.example.com', 'as' => 'subdomain', 'uses' => 'HomeController@subdomain']); 16 | Route::get('', ['domain' => '{w}.example.com', 'as' => 'wildcard', 'uses' => 'HomeController@wildcard']); 17 | Route::get('', ['domain' => '{w1}.{w2}.example.com', 'as' => 'multiple-wildcards', 'uses' => 'HomeController@multipleWildcards']); 18 | 19 | Route::get('', ['as' => 'homepage', 'uses' => 'HomeController@index']); 20 | Route::get('flash', 'HomeController@flash'); 21 | Route::get('back', 'HomeController@back'); 22 | Route::get('redirect', 'HomeController@redirect'); 23 | Route::get('secure', 'HomeController@secure'); 24 | Route::get('session/{message}', 'HomeController@session'); 25 | Route::get('special-characters', 'HomeController@specialCharacters'); 26 | Route::get('fire-event', 'HomeController@fireEvent'); 27 | Route::get('validation', 'HomeController@validation'); 28 | Route::get('service-container', 'HomeController@serviceContainer'); 29 | Route::get('test-value', 'HomeController@testValue'); 30 | Route::post('upload', 'HomeController@upload'); 31 | Route::match(['get', 'post'], 'form', 'HomeController@form'); 32 | 33 | Route::resource('posts', 'PostsController'); 34 | Route::resource('api/posts', 'Api\PostsController', ['as' => 'api']); 35 | Route::resource('users', 'UsersController'); 36 | Route::auth(); 37 | -------------------------------------------------------------------------------- /tests/functional/AuthCest.php: -------------------------------------------------------------------------------- 1 | userAttributes = [ 13 | 'email' => 'john@doe.com', 14 | 'password' => Hash::make('password'), 15 | 'created_at' => new DateTime(), 16 | 'updated_at' => new DateTime(), 17 | ]; 18 | } 19 | 20 | public function loginUsingUserRecord(FunctionalTester $I) 21 | { 22 | $I->amLoggedAs(User::create($this->userAttributes)); 23 | 24 | $I->amOnPage(PostsPage::$url); 25 | 26 | $I->seeCurrentUrlEquals(PostsPage::$url); 27 | $I->seeAuthentication(); 28 | 29 | // Login should persist between requests 30 | $I->amOnPage(PostsPage::$url); 31 | 32 | $I->seeAuthentication(); 33 | } 34 | 35 | public function loginUsingCredentials(FunctionalTester $I) 36 | { 37 | $I->haveRecord('users', $this->userAttributes); 38 | $I->amLoggedAs(['email' => 'john@doe.com', 'password' => 'password']); 39 | 40 | $I->amOnPage(PostsPage::$url); 41 | 42 | $I->seeCurrentUrlEquals(PostsPage::$url); 43 | $I->seeAuthentication(); 44 | 45 | // Login should persist between requests 46 | $I->amOnPage(PostsPage::$url); 47 | 48 | $I->seeAuthentication(); 49 | } 50 | 51 | public function secureRouteWithoutAuthenticatedUser(FunctionalTester $I) 52 | { 53 | $I->amOnPage('/secure'); 54 | 55 | $I->seeCurrentUrlEquals('/login'); 56 | } 57 | 58 | public function secureRouteWithAuthenticatedUser(FunctionalTester $I) 59 | { 60 | $I->amLoggedAs(User::create($this->userAttributes)); 61 | 62 | $I->amOnPage('/secure'); 63 | 64 | $I->see('Hello World'); 65 | } 66 | 67 | } -------------------------------------------------------------------------------- /tests/functional/PostCrudCest.php: -------------------------------------------------------------------------------- 1 | postAttributes = [ 13 | 'title' => 'Hello Universe', 14 | 'body' => 'You are so awesome', 15 | 'created_at' => new DateTime(), 16 | 'updated_at' => new DateTime() 17 | ]; 18 | } 19 | 20 | // tests 21 | public function createPost(FunctionalTester $I, PostsPage $postsPage) 22 | { 23 | $postsPage->createPost(['title' => 'Hello world', 'body' => 'And greetings for all']); 24 | $I->seeCurrentUrlEquals($postsPage::$url); 25 | $I->see('Hello world', '.table'); 26 | } 27 | 28 | public function createPostValidationFails(FunctionalTester $I, PostsPage $postsPage) 29 | { 30 | $postsPage->createPost(); 31 | $I->seeCurrentUrlEquals($postsPage->route('/create')); 32 | $I->see('The body field is required.', '.error'); 33 | $I->see('The title field is required.', '.error'); 34 | } 35 | 36 | public function editPost(FunctionalTester $I, PostsPage $postsPage) 37 | { 38 | $randTitle = "Edited at " . microtime(); 39 | $id = $I->haveRecord('posts', $this->postAttributes); 40 | $postsPage->editPost($id, ['title' => 'Edited at ' . $randTitle]); 41 | $I->seeCurrentUrlEquals($postsPage->route("/$id")); 42 | $I->see('Show Post', 'h1'); 43 | $I->see($randTitle); 44 | $I->dontSee('Hello Universe'); 45 | } 46 | 47 | public function deletePost(FunctionalTester $I, PostsPage $postsPage) 48 | { 49 | $id = $I->haveRecord('posts', $this->postAttributes); 50 | $I->amOnPage($postsPage::$url); 51 | $I->see('Hello Universe'); 52 | $postsPage->deletePost($id); 53 | $I->seeCurrentUrlEquals($postsPage::$url); 54 | $I->dontSee('Hello Universe'); 55 | } 56 | } -------------------------------------------------------------------------------- /resources/views/auth/reset.blade.php: -------------------------------------------------------------------------------- 1 | @extends('app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
Reset Password
9 |
10 | @if (count($errors) > 0) 11 |
12 | Whoops! There were some problems with your input.

13 |
    14 | @foreach ($errors->all() as $error) 15 |
  • {{ $error }}
  • 16 | @endforeach 17 |
18 |
19 | @endif 20 | 21 |
22 | 23 | 24 | 25 |
26 | 27 |
28 | 29 |
30 |
31 | 32 |
33 | 34 |
35 | 36 |
37 |
38 | 39 |
40 | 41 |
42 | 43 |
44 |
45 | 46 |
47 |
48 | 51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | @endsection 60 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | 9 | /* 10 | |-------------------------------------------------------------------------- 11 | | Register The Auto Loader 12 | |-------------------------------------------------------------------------- 13 | | 14 | | Composer provides a convenient, automatically generated class loader for 15 | | our application. We just need to utilize it! We'll simply require it 16 | | into the script here so that we don't have to worry about manual 17 | | loading any of our classes later on. It feels nice to relax. 18 | | 19 | */ 20 | 21 | require __DIR__.'/../bootstrap/autoload.php'; 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Turn On The Lights 26 | |-------------------------------------------------------------------------- 27 | | 28 | | We need to illuminate PHP development, so let us turn on the lights. 29 | | This bootstraps the framework and gets it ready for use, then it 30 | | will load up this application so that we can run it and send 31 | | the responses back to the browser and delight our users. 32 | | 33 | */ 34 | 35 | $app = require_once __DIR__.'/../bootstrap/app.php'; 36 | 37 | /* 38 | |-------------------------------------------------------------------------- 39 | | Run The Application 40 | |-------------------------------------------------------------------------- 41 | | 42 | | Once we have the application, we can simply call the run method, 43 | | which will execute the request and send the response back to 44 | | the client's browser allowing them to enjoy the creative 45 | | and wonderful application we have prepared for them. 46 | | 47 | */ 48 | 49 | $kernel = $app->make('Illuminate\Contracts\Http\Kernel'); 50 | 51 | $response = $kernel->handle( 52 | $request = Illuminate\Http\Request::capture() 53 | ); 54 | 55 | $response->send(); 56 | 57 | $kernel->terminate($request, $response); 58 | -------------------------------------------------------------------------------- /resources/views/auth/login.blade.php: -------------------------------------------------------------------------------- 1 | @extends('app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
Login
9 |
10 | @if (count($errors) > 0) 11 |
12 | Whoops! There were some problems with your input.

13 |
    14 | @foreach ($errors->all() as $error) 15 |
  • {{ $error }}
  • 16 | @endforeach 17 |
18 |
19 | @endif 20 | 21 |
22 | 23 | 24 |
25 | 26 |
27 | 28 |
29 |
30 | 31 |
32 | 33 |
34 | 35 |
36 |
37 | 38 |
39 |
40 |
41 | 44 |
45 |
46 |
47 | 48 |
49 |
50 | 53 | 54 | Forgot Your Password? 55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | @endsection 64 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisterController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 38 | } 39 | 40 | /** 41 | * Get a validator for an incoming registration request. 42 | * 43 | * @param array $data 44 | * @return \Illuminate\Contracts\Validation\Validator 45 | */ 46 | protected function validator(array $data) 47 | { 48 | return Validator::make($data, [ 49 | 'name' => 'required|max:255', 50 | 'email' => 'required|email|max:255|unique:users', 51 | 'password' => 'required|min:6|confirmed', 52 | ]); 53 | } 54 | 55 | /** 56 | * Create a new user instance after a valid registration. 57 | * 58 | * @param array $data 59 | * @return User 60 | */ 61 | protected function create(array $data) 62 | { 63 | return User::create([ 64 | 'name' => $data['name'], 65 | 'email' => $data['email'], 66 | 'password' => bcrypt($data['password']), 67 | ]); 68 | } 69 | } -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | 'local', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Default Cloud Filesystem Disk 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Many applications store files both locally and in the cloud. For this 26 | | reason, you may specify a default "cloud" driver here. This driver 27 | | will be bound as the Cloud disk implementation in the container. 28 | | 29 | */ 30 | 31 | 'cloud' => 's3', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Filesystem Disks 36 | |-------------------------------------------------------------------------- 37 | | 38 | | Here you may configure as many filesystem "disks" as you wish, and you 39 | | may even configure multiple disks of the same driver. Defaults have 40 | | been setup for each driver as an example of the required options. 41 | | 42 | */ 43 | 44 | 'disks' => [ 45 | 46 | 'local' => [ 47 | 'driver' => 'local', 48 | 'root' => storage_path().'/app', 49 | ], 50 | 51 | 's3' => [ 52 | 'driver' => 's3', 53 | 'key' => 'your-key', 54 | 'secret' => 'your-secret', 55 | 'region' => 'your-region', 56 | 'bucket' => 'your-bucket', 57 | ], 58 | 59 | 'rackspace' => [ 60 | 'driver' => 'rackspace', 61 | 'username' => 'your-username', 62 | 'key' => 'your-key', 63 | 'container' => 'your-container', 64 | 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/', 65 | 'region' => 'IAD', 66 | ], 67 | 68 | ], 69 | 70 | ]; 71 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Cache Stores 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may define all of the cache "stores" for your application as 24 | | well as their drivers. You may even define multiple stores for the 25 | | same cache driver to group types of items stored in your caches. 26 | | 27 | */ 28 | 29 | 'stores' => [ 30 | 31 | 'apc' => [ 32 | 'driver' => 'apc' 33 | ], 34 | 35 | 'array' => [ 36 | 'driver' => 'array' 37 | ], 38 | 39 | 'database' => [ 40 | 'driver' => 'database', 41 | 'table' => 'cache', 42 | 'connection' => null, 43 | ], 44 | 45 | 'file' => [ 46 | 'driver' => 'file', 47 | 'path' => storage_path().'/framework/cache', 48 | ], 49 | 50 | 'memcached' => [ 51 | 'driver' => 'memcached', 52 | 'servers' => [ 53 | [ 54 | 'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100 55 | ], 56 | ], 57 | ], 58 | 59 | 'redis' => [ 60 | 'driver' => 'redis', 61 | 'connection' => 'default', 62 | ], 63 | 64 | ], 65 | 66 | /* 67 | |-------------------------------------------------------------------------- 68 | | Cache Key Prefix 69 | |-------------------------------------------------------------------------- 70 | | 71 | | When utilizing a RAM based store such as APC or Memcached, there might 72 | | be other applications utilizing the same cache. So, we'll specify a 73 | | value to get prefixed to all our keys so we can avoid collisions. 74 | | 75 | */ 76 | 77 | 'prefix' => 'laravel', 78 | 79 | ]; 80 | -------------------------------------------------------------------------------- /resources/views/auth/register.blade.php: -------------------------------------------------------------------------------- 1 | @extends('app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
Register
9 |
10 | @if (count($errors) > 0) 11 |
12 | Whoops! There were some problems with your input.

13 |
    14 | @foreach ($errors->all() as $error) 15 |
  • {{ $error }}
  • 16 | @endforeach 17 |
18 |
19 | @endif 20 | 21 |
22 | 23 | 24 |
25 | 26 |
27 | 28 |
29 |
30 | 31 |
32 | 33 |
34 | 35 |
36 |
37 | 38 |
39 | 40 |
41 | 42 |
43 |
44 | 45 |
46 | 47 |
48 | 49 |
50 |
51 | 52 |
53 |
54 | 57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | @endsection 66 | -------------------------------------------------------------------------------- /tests/functional/EventsCest.php: -------------------------------------------------------------------------------- 1 | 'john@doe.com', 12 | 'password' => Hash::make('password'), 13 | 'created_at' => new DateTime(), 14 | 'updated_at' => new DateTime(), 15 | ]); 16 | 17 | User::saving(function ($user) { 18 | return false; 19 | }); 20 | 21 | $I->disableModelEvents(); 22 | 23 | $user->email = 'updated@example.com'; 24 | $user->save(); 25 | 26 | $I->seeRecord('users', ['email' => 'updated@example.com']); 27 | } 28 | 29 | public function disablingEvents(FunctionalTester $I) 30 | { 31 | $I->disableEvents(); 32 | 33 | $I->amOnPage('fire-event'); 34 | $I->dontSeeRecord('users', ['email' => 'johndoe@example.com']); 35 | } 36 | 37 | public function seeEventTriggered(FunctionalTester $I) 38 | { 39 | $I->amOnPage('fire-event'); 40 | $I->seeEventTriggered('App\Events\TestEvent'); 41 | } 42 | 43 | public function seeEventTriggeredWithMultipleEvents(FunctionalTester $I) 44 | { 45 | $I->amOnPage('fire-event'); 46 | $I->seeEventTriggered('App\Events\TestEvent', 'App\Events\OtherTestEvent'); 47 | } 48 | 49 | public function seeEventTriggeredWithEventObject(FunctionalTester $I) 50 | { 51 | $I->amOnPage('fire-event'); 52 | $I->seeEventTriggered(new \App\Events\TestEvent()); 53 | } 54 | 55 | public function seeEventTriggeredWhenEventsAreDisabled(FunctionalTester $I) 56 | { 57 | $I->disableEvents(); 58 | 59 | $I->amOnPage('fire-event'); 60 | $I->seeEventTriggered('App\Events\TestEvent'); 61 | } 62 | 63 | public function dontSeeEventTriggered(FunctionalTester $I) 64 | { 65 | $I->amOnPage('/'); 66 | $I->dontSeeEventTriggered('App\Events\TestEvent'); 67 | } 68 | 69 | public function dontSeeEventTriggeredWithEventObject(FunctionalTester $I) 70 | { 71 | $I->amOnPage('/'); 72 | $I->dontSeeEventTriggered(new \App\Events\TestEvent()); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/progress-bars.less: -------------------------------------------------------------------------------- 1 | // 2 | // Progress bars 3 | // -------------------------------------------------- 4 | 5 | 6 | // Bar animations 7 | // ------------------------- 8 | 9 | // WebKit 10 | @-webkit-keyframes progress-bar-stripes { 11 | from { background-position: 40px 0; } 12 | to { background-position: 0 0; } 13 | } 14 | 15 | // Spec and IE10+ 16 | @keyframes progress-bar-stripes { 17 | from { background-position: 40px 0; } 18 | to { background-position: 0 0; } 19 | } 20 | 21 | 22 | // Bar itself 23 | // ------------------------- 24 | 25 | // Outer container 26 | .progress { 27 | overflow: hidden; 28 | height: @line-height-computed; 29 | margin-bottom: @line-height-computed; 30 | background-color: @progress-bg; 31 | border-radius: @progress-border-radius; 32 | .box-shadow(inset 0 1px 2px rgba(0,0,0,.1)); 33 | } 34 | 35 | // Bar of progress 36 | .progress-bar { 37 | float: left; 38 | width: 0%; 39 | height: 100%; 40 | font-size: @font-size-small; 41 | line-height: @line-height-computed; 42 | color: @progress-bar-color; 43 | text-align: center; 44 | background-color: @progress-bar-bg; 45 | .box-shadow(inset 0 -1px 0 rgba(0,0,0,.15)); 46 | .transition(width .6s ease); 47 | } 48 | 49 | // Striped bars 50 | // 51 | // `.progress-striped .progress-bar` is deprecated as of v3.2.0 in favor of the 52 | // `.progress-bar-striped` class, which you just add to an existing 53 | // `.progress-bar`. 54 | .progress-striped .progress-bar, 55 | .progress-bar-striped { 56 | #gradient > .striped(); 57 | background-size: 40px 40px; 58 | } 59 | 60 | // Call animation for the active one 61 | // 62 | // `.progress.active .progress-bar` is deprecated as of v3.2.0 in favor of the 63 | // `.progress-bar.active` approach. 64 | .progress.active .progress-bar, 65 | .progress-bar.active { 66 | .animation(progress-bar-stripes 2s linear infinite); 67 | } 68 | 69 | 70 | // Variations 71 | // ------------------------- 72 | 73 | .progress-bar-success { 74 | .progress-bar-variant(@progress-bar-success-bg); 75 | } 76 | 77 | .progress-bar-info { 78 | .progress-bar-variant(@progress-bar-info-bg); 79 | } 80 | 81 | .progress-bar-warning { 82 | .progress-bar-variant(@progress-bar-warning-bg); 83 | } 84 | 85 | .progress-bar-danger { 86 | .progress-bar-variant(@progress-bar-danger-bg); 87 | } 88 | -------------------------------------------------------------------------------- /resources/views/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Laravel 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | 22 | 55 | 56 | @yield('content') 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/pagination.less: -------------------------------------------------------------------------------- 1 | // 2 | // Pagination (multiple pages) 3 | // -------------------------------------------------- 4 | .pagination { 5 | display: inline-block; 6 | padding-left: 0; 7 | margin: @line-height-computed 0; 8 | border-radius: @border-radius-base; 9 | 10 | > li { 11 | display: inline; // Remove list-style and block-level defaults 12 | > a, 13 | > span { 14 | position: relative; 15 | float: left; // Collapse white-space 16 | padding: @padding-base-vertical @padding-base-horizontal; 17 | line-height: @line-height-base; 18 | text-decoration: none; 19 | color: @pagination-color; 20 | background-color: @pagination-bg; 21 | border: 1px solid @pagination-border; 22 | margin-left: -1px; 23 | } 24 | &:first-child { 25 | > a, 26 | > span { 27 | margin-left: 0; 28 | .border-left-radius(@border-radius-base); 29 | } 30 | } 31 | &:last-child { 32 | > a, 33 | > span { 34 | .border-right-radius(@border-radius-base); 35 | } 36 | } 37 | } 38 | 39 | > li > a, 40 | > li > span { 41 | &:hover, 42 | &:focus { 43 | color: @pagination-hover-color; 44 | background-color: @pagination-hover-bg; 45 | border-color: @pagination-hover-border; 46 | } 47 | } 48 | 49 | > .active > a, 50 | > .active > span { 51 | &, 52 | &:hover, 53 | &:focus { 54 | z-index: 2; 55 | color: @pagination-active-color; 56 | background-color: @pagination-active-bg; 57 | border-color: @pagination-active-border; 58 | cursor: default; 59 | } 60 | } 61 | 62 | > .disabled { 63 | > span, 64 | > span:hover, 65 | > span:focus, 66 | > a, 67 | > a:hover, 68 | > a:focus { 69 | color: @pagination-disabled-color; 70 | background-color: @pagination-disabled-bg; 71 | border-color: @pagination-disabled-border; 72 | cursor: @cursor-disabled; 73 | } 74 | } 75 | } 76 | 77 | // Sizing 78 | // -------------------------------------------------- 79 | 80 | // Large 81 | .pagination-lg { 82 | .pagination-size(@padding-large-vertical; @padding-large-horizontal; @font-size-large; @border-radius-large); 83 | } 84 | 85 | // Small 86 | .pagination-sm { 87 | .pagination-size(@padding-small-vertical; @padding-small-horizontal; @font-size-small; @border-radius-small); 88 | } 89 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/PostsController.php: -------------------------------------------------------------------------------- 1 | post = $post; 31 | $this->responseFactory = $responseFactory; 32 | } 33 | 34 | /** 35 | * Display a listing of posts. 36 | * 37 | * @return JsonResponse 38 | */ 39 | public function index() 40 | { 41 | $posts = $this->post->all(); 42 | 43 | return $this->responseFactory->json($posts); 44 | } 45 | 46 | /** 47 | * Store a newly created post. 48 | * 49 | * @param PostStoreRequest $request 50 | * @return JsonResponse 51 | */ 52 | public function store(PostStoreRequest $request) 53 | { 54 | $post = $this->post->create($request->all()); 55 | 56 | return $this->responseFactory->json($post); 57 | } 58 | 59 | 60 | /** 61 | * Display the specified post. 62 | * 63 | * @param int $id 64 | * @return JsonResponse 65 | */ 66 | public function show($id) 67 | { 68 | $post = $this->post->findOrFail($id); 69 | 70 | return $this->responseFactory->json($post); 71 | } 72 | 73 | 74 | /** 75 | * Update the specified post. 76 | * 77 | * @param int $id 78 | * @return JsonResponse 79 | */ 80 | public function update(Request $request, $id) 81 | { 82 | $post = $this->post->findOrFail($id); 83 | $post->update($request->all()); 84 | 85 | return $this->responseFactory->json($post); 86 | } 87 | 88 | 89 | /** 90 | * Delete the specified post. 91 | * 92 | * @param int $id 93 | * @return JsonResponse 94 | */ 95 | public function destroy($id) 96 | { 97 | $this->post->findOrFail($id)->delete(); 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_DRIVER', 'sync'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Queue Connections 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may configure the connection information for each server that 27 | | is used by your application. A default configuration has been added 28 | | for each back-end shipped with Laravel. You are free to add more. 29 | | 30 | */ 31 | 32 | 'connections' => [ 33 | 34 | 'sync' => [ 35 | 'driver' => 'sync', 36 | ], 37 | 38 | 'database' => [ 39 | 'driver' => 'database', 40 | 'table' => 'jobs', 41 | 'queue' => 'default', 42 | 'expire' => 60, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'ttr' => 60, 50 | ], 51 | 52 | 'sqs' => [ 53 | 'driver' => 'sqs', 54 | 'key' => 'your-public-key', 55 | 'secret' => 'your-secret-key', 56 | 'queue' => 'your-queue-url', 57 | 'region' => 'us-east-1', 58 | ], 59 | 60 | 'iron' => [ 61 | 'driver' => 'iron', 62 | 'host' => 'mq-aws-us-east-1.iron.io', 63 | 'token' => 'your-token', 64 | 'project' => 'your-project-id', 65 | 'queue' => 'your-queue-name', 66 | 'encrypt' => true, 67 | ], 68 | 69 | 'redis' => [ 70 | 'driver' => 'redis', 71 | 'queue' => 'default', 72 | 'expire' => 60, 73 | ], 74 | 75 | ], 76 | 77 | /* 78 | |-------------------------------------------------------------------------- 79 | | Failed Queue Jobs 80 | |-------------------------------------------------------------------------- 81 | | 82 | | These options configure the behavior of failed queue job logging so you 83 | | can control which database and table are used to store the jobs that 84 | | have failed. You may change them to any database / table you wish. 85 | | 86 | */ 87 | 88 | 'failed' => [ 89 | 'database' => 'mysql', 'table' => 'failed_jobs', 90 | ], 91 | 92 | ]; 93 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/print.less: -------------------------------------------------------------------------------- 1 | /*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */ 2 | 3 | // ========================================================================== 4 | // Print styles. 5 | // Inlined to avoid the additional HTTP request: h5bp.com/r 6 | // ========================================================================== 7 | 8 | @media print { 9 | *, 10 | *:before, 11 | *:after { 12 | background: transparent !important; 13 | color: #000 !important; // Black prints faster: h5bp.com/s 14 | box-shadow: none !important; 15 | text-shadow: none !important; 16 | } 17 | 18 | a, 19 | a:visited { 20 | text-decoration: underline; 21 | } 22 | 23 | a[href]:after { 24 | content: " (" attr(href) ")"; 25 | } 26 | 27 | abbr[title]:after { 28 | content: " (" attr(title) ")"; 29 | } 30 | 31 | // Don't show links that are fragment identifiers, 32 | // or use the `javascript:` pseudo protocol 33 | a[href^="#"]:after, 34 | a[href^="javascript:"]:after { 35 | content: ""; 36 | } 37 | 38 | pre, 39 | blockquote { 40 | border: 1px solid #999; 41 | page-break-inside: avoid; 42 | } 43 | 44 | thead { 45 | display: table-header-group; // h5bp.com/t 46 | } 47 | 48 | tr, 49 | img { 50 | page-break-inside: avoid; 51 | } 52 | 53 | img { 54 | max-width: 100% !important; 55 | } 56 | 57 | p, 58 | h2, 59 | h3 { 60 | orphans: 3; 61 | widows: 3; 62 | } 63 | 64 | h2, 65 | h3 { 66 | page-break-after: avoid; 67 | } 68 | 69 | // Bootstrap specific changes start 70 | // 71 | // Chrome (OSX) fix for https://github.com/twbs/bootstrap/issues/11245 72 | // Once fixed, we can just straight up remove this. 73 | select { 74 | background: #fff !important; 75 | } 76 | 77 | // Bootstrap components 78 | .navbar { 79 | display: none; 80 | } 81 | .btn, 82 | .dropup > .btn { 83 | > .caret { 84 | border-top-color: #000 !important; 85 | } 86 | } 87 | .label { 88 | border: 1px solid #000; 89 | } 90 | 91 | .table { 92 | border-collapse: collapse !important; 93 | 94 | td, 95 | th { 96 | background-color: #fff !important; 97 | } 98 | } 99 | .table-bordered { 100 | th, 101 | td { 102 | border: 1px solid #ddd !important; 103 | } 104 | } 105 | 106 | // Bootstrap specific changes end 107 | } 108 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Sample Laravel Application with Codeception tests. 2 | 3 | [![CircleCI](https://circleci.com/gh/CircleCI-Public/circleci-demo-php-laravel.svg?style=svg)](https://circleci.com/gh/CircleCI-Public/circleci-demo-php-laravel) 4 | 5 | ### Setup 6 | 7 | You can setup this sample manually or use [Vagrant](https://www.vagrantup.com/) to automatically set up a development environment for you. 8 | 9 | #### Manual 10 | - Clone repo 11 | - Create your .env file from the example file: `cp .env.testing .env` 12 | - Install composer dependencies: `composer install` 13 | - Create databases by creating the following files: 14 | - `storage/database.sqlite` 15 | - `storage/testing.sqlite` 16 | - Run the following commands: 17 | - `php artisan migrate` 18 | - `php artisan migrate --database=sqlite_testing` 19 | - Server: run `php -S localhost:8000 -t public` 20 | - Browse to localhost:8000/posts 21 | 22 | #### Vagrant 23 | - Clone repo 24 | - Cd into the cloned directory 25 | - Install git submodules: `git submodule update --init --recursive` 26 | - you can also add the `--recursive` flag to the `git clone` command to skip this step 27 | - Run `vagrant up` 28 | 29 | To SSH into the machine to run your tests, run `vagrant ssh`. You can access the app on the guest VM under http://192.168.10.10/. 30 | 31 | ### To test 32 | 33 | Run Codeception, installed via Composer 34 | 35 | ``` 36 | ./vendor/bin/codecept build 37 | ./vendor/bin/codecept run 38 | ``` 39 | 40 | ## Tests 41 | 42 | Please check out some [good test examples](https://github.com/janhenkgerritsen/codeception-laravel5-sample/tree/codeception-2.1/tests) provided. 43 | 44 | ### Functional Tests 45 | 46 | Demonstrates testing of [CRUD application](https://github.com/janhenkgerritsen/codeception-laravel5-sample/blob/codeception-2.1/tests/functional/PostCrudCest.php) with 47 | 48 | * [PageObjects](https://github.com/janhenkgerritsen/codeception-laravel5-sample/blob/codeception-2.1/tests%2Ffunctional%2F_pages%2FPostsPage.php) 49 | * [authentication](https://github.com/janhenkgerritsen/codeception-laravel5-sample/blob/codeception-2.1/tests%2Ffunctional%2FAuthCest.php) (by user, credentials, http auth) 50 | * usage of session variables 51 | * [routes](https://github.com/janhenkgerritsen/codeception-laravel5-sample/blob/codeception-2.1/tests%2Ffunctional%2FRoutesCest.php) 52 | * creating and checking records in database 53 | * testing of form errors 54 | 55 | ### API Tests 56 | 57 | Demonstrates functional [testing of API](https://github.com/janhenkgerritsen/codeception-laravel5-sample/blob/codeception-2.1/tests%2Fapi%2FPostsResourceCest.php) using REST and Laravel5 modules connected, with 58 | 59 | * partial json inclusion in response 60 | * GET/POST/PUT/DELETE requests 61 | * check changes inside database 62 | 63 | -------------------------------------------------------------------------------- /app/Http/Controllers/PostsController.php: -------------------------------------------------------------------------------- 1 | post = $post; 23 | } 24 | 25 | /** 26 | * Display a listing of posts. 27 | * 28 | * @return \Illuminate\View\View 29 | */ 30 | public function index() 31 | { 32 | $posts = $this->post->all(); 33 | 34 | return view('posts.index', compact('posts')); 35 | } 36 | 37 | /** 38 | * Show the form for creating a new post. 39 | * 40 | * @return \Illuminate\View\View 41 | */ 42 | public function create() 43 | { 44 | return view('posts.create'); 45 | } 46 | 47 | /** 48 | * Store a newly create Post. 49 | * 50 | * @param PostStoreRequest $request 51 | * @return \Illuminate\Http\RedirectResponse 52 | */ 53 | public function store(PostStoreRequest $request) 54 | { 55 | $this->post->create($request->input()); 56 | 57 | return redirect()->route('posts.index'); 58 | } 59 | 60 | /** 61 | * Display a post. 62 | * 63 | * @param int $id 64 | * @return \Illuminate\View\View 65 | */ 66 | public function show($id) 67 | { 68 | $post = $this->post->findOrFail($id); 69 | 70 | return view('posts.show', compact('post')); 71 | } 72 | 73 | /** 74 | * Show the form for editing a post. 75 | * 76 | * @param int $id 77 | * @return \Illuminate\View\View 78 | */ 79 | public function edit($id) 80 | { 81 | $post = $this->post->findOrFail($id); 82 | 83 | return view('posts.edit', compact('post')); 84 | } 85 | 86 | /** 87 | * Update a post. 88 | * 89 | * @param int $id 90 | * @return \Illuminate\Http\RedirectResponse 91 | */ 92 | public function update(PostUpdateRequest $request, $id) 93 | { 94 | /** @var Post $post */ 95 | $post = $this->post->findOrFail($id); 96 | $post->update($request->all()); 97 | 98 | return redirect()->route('posts.show', $id); 99 | } 100 | 101 | /** 102 | * Remove the specified resource from storage. 103 | * 104 | * @param int $id 105 | * @return \Illuminate\Http\RedirectResponse 106 | */ 107 | public function destroy($id) 108 | { 109 | $this->post->findOrFail($id)->delete(); 110 | 111 | return redirect()->route('posts.index'); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /resources/assets/less/bootstrap/mixins/forms.less: -------------------------------------------------------------------------------- 1 | // Form validation states 2 | // 3 | // Used in forms.less to generate the form validation CSS for warnings, errors, 4 | // and successes. 5 | 6 | .form-control-validation(@text-color: #555; @border-color: #ccc; @background-color: #f5f5f5) { 7 | // Color the label and help text 8 | .help-block, 9 | .control-label, 10 | .radio, 11 | .checkbox, 12 | .radio-inline, 13 | .checkbox-inline, 14 | &.radio label, 15 | &.checkbox label, 16 | &.radio-inline label, 17 | &.checkbox-inline label { 18 | color: @text-color; 19 | } 20 | // Set the border and box shadow on specific inputs to match 21 | .form-control { 22 | border-color: @border-color; 23 | .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work 24 | &:focus { 25 | border-color: darken(@border-color, 10%); 26 | @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@border-color, 20%); 27 | .box-shadow(@shadow); 28 | } 29 | } 30 | // Set validation states also for addons 31 | .input-group-addon { 32 | color: @text-color; 33 | border-color: @border-color; 34 | background-color: @background-color; 35 | } 36 | // Optional feedback icon 37 | .form-control-feedback { 38 | color: @text-color; 39 | } 40 | } 41 | 42 | 43 | // Form control focus state 44 | // 45 | // Generate a customized focus state and for any input with the specified color, 46 | // which defaults to the `@input-border-focus` variable. 47 | // 48 | // We highly encourage you to not customize the default value, but instead use 49 | // this to tweak colors on an as-needed basis. This aesthetic change is based on 50 | // WebKit's default styles, but applicable to a wider range of browsers. Its 51 | // usability and accessibility should be taken into account with any change. 52 | // 53 | // Example usage: change the default blue border and shadow to white for better 54 | // contrast against a dark gray background. 55 | .form-control-focus(@color: @input-border-focus) { 56 | @color-rgba: rgba(red(@color), green(@color), blue(@color), .6); 57 | &:focus { 58 | border-color: @color; 59 | outline: 0; 60 | .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}"); 61 | } 62 | } 63 | 64 | // Form control sizing 65 | // 66 | // Relative text size, padding, and border-radii changes for form controls. For 67 | // horizontal sizing, wrap controls in the predefined grid classes. `