You are on page 1of 9

Laravel TDD

Migration GeneratorsMigration
Faker

TDD
1.
2.
3.

1.
2.
3. ()

TDD
(1)
(2)
(3)

Laravel Lumen
Laravel

test/TestCase.php

use Illuminate\Foundation\Testing\DatabaseTransactions;
DatabaseTransactionssql connection
(Lumen)

DBMigration GeneratorsMigration
Seederrollback
functiondb:seedSeeder
DatabaseSeeder

function

setUpcreateApplicationparent::setUp()
tearDownMockery

test/ReportTest.php

controllerrepository

mockcontroller$this->app->make
targetrepositoryMockinitMockTestCase

TestCaseinitMock

Mockery? repositorycontroller
DB

(functiontest@test)

shouldReceiverepositoryfunction
once102
withAnyArgs
andReturn

ReportController

ReportRepositorygetReportDatatrue
repositorycontroller

./vendor/bin/phpunit (phpunit)
Lumen

route

function$this->app->make('db')->connection("qshare")->beginTransaction();
transation
rollback()
$this->callrouteLaravelLumen()
Lumen

$respose->getContent()
assertTrue
Lumenview

phpunit.xml

suffixdirectory

migrationindexvarchar(255)
app/Providers/AppServiceProvider.php

Schema::defaultStringLength(191)migration

createApplicationputenvDB
tablemigration generatorclass
error

MockRepositoryRepository
TDD

1. Web Development with Laravel 5


2. Laravel (18) - Migrations & Seeding
3. ?
4. TDD(Test-Driven Development,)
5. Test Driven Development

You might also like