LoginSignup
2
0

はじめに

こんにちは、エンジニアのkeitaMaxです。

CakePHPのよく使うコマンドを備忘録として残していきます。

マイグレーション

マイグレーションファイルを作成

bin/cake bake migration CreateArticles created modified

マイグレーションファイルを実行

bin/cake migrations migrate

マイグレーションファイルのロールバック

bin/cake migrations rollback

コントローラ

コントローラの作成

bin/cake bake controller articles

モデル

モデルの作成

bin/cake bake model articles

テスト

PHPUnit

全部実行する

vendor/bin/phpunit

特定のファイルだけ実行する

tests/TestCase/Controller/ArticlesControllerTest.phpファイルだけ実行したい場合

vendor/bin/phpunit tests/TestCase/Controller/ArticlesControllerTest.php 

特定のファイルの一つの関数だけ実行する

tests/TestCase/Controller/ArticlesControllerTest.phpファイルのtestIndexだけ実行したい場合

vendor/bin/phpunit tests/TestCase/Controller/ArticlesControllerTest.php --filter testIndex

CodeSniffer

実行

composer cs-check

自動修正

composer cs-fix

PHPStan

実行

composer stan

おわりに

この記事での質問や、間違っている、もっといい方法があるといったご意見などありましたらご指摘していただけると幸いです。

最後まで読んでいただきありがとうございました!

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0