TDD: Test-driven development (Test-Driven Development), TDD principle is developed before the function code, unit test cases before writing the code, test code to determine what products need to write code. - Loaded TDD Baidu Encyclopedia
参考 Test Driven API Development using Laravel, Dingo and JWT with Documentation
- Correction run the command:
php artisan vendor:publish --provider="Dingo\Api\Provider\LaravelServiceProvider"
The second step article run unit test command prompt
Illuminate\Database\QueryException: could not find driver (SQL: select * from sqlite_master where type = 'table' and name = migrations)
error message in php artisan migrate gives me an error could not find driver find a solution that runs in ubuntusudo apt-get install php-sqlite3
.laravel project is not run in the root directory, direct access repair
http://localhost/blog/public/api
, the 301 will be redirected to thehttp://localhost/api
next, modify.htaccess
the fileRewriteRule ^(.*)/$ /$1 [L,R=301]
as aRewriteRule ^(.*)/$ public/$1 [L,R=301]
reference link: Removing "/ public" from the URL of (the Where does the URL of Laravel GET at The Base from?)DESCRIPTION phpunit testunits phpunit unit test --laravel [continually updated]
Method All test class must be public and modified at the beginning of the public function test test * () {} manner
Correction article command
phpunit tests/FruitsTest.php
isphpunit tests/Feature/FruitsTest.php
, the test class method names must be added the test development, such as in the articleit_fetches_fruits
was changedtestit_fetches_fruits
, while running a test, this method will not runlaravel连接sqlite Connect to an Sqlite DB - Laravel documentation procedure doesn't work
Laravel .env backup file mysql configuration information
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
Laravel currently used mostly write api, my single test case to judge the results returned HTTP status code (the most simple, but the accuracy is not very high, at least all green after the entire test unit ran down, his heart have been written procedures or ease a bit more than the absence of any unit tests)