[Notes] Laravel TDD random recording

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

  1. Correction run the command:
php artisan vendor:publish --provider="Dingo\Api\Provider\LaravelServiceProvider"
  1. 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 ubuntu sudo apt-get install php-sqlite3.

  2. laravel project is not run in the root directory, direct access repair http://localhost/blog/public/api, the 301 will be redirected to the http://localhost/apinext, modify .htaccessthe file RewriteRule ^(.*)/$ /$1 [L,R=301]as a RewriteRule ^(.*)/$ 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?)

  3. 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

  4. Correction article command phpunit tests/FruitsTest.phpis phpunit tests/Feature/FruitsTest.php, the test class method names must be added the test development, such as in the article it_fetches_fruitswas changed testit_fetches_fruits, while running a test, this method will not run

  5. laravel连接sqlite Connect to an Sqlite DB - Laravel documentation procedure doesn't work

  6. 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)

Guess you like

Origin www.cnblogs.com/fsong/p/11259185.html
TDD