bake icon indicating copy to clipboard operation
bake copied to clipboard

RFC: Change Fixture and Tests to opt-in

Open davidyell opened this issue 6 years ago • 4 comments

I always have to append the --no-test and --no-fixture to my bake commands, to prevent the generation of these additional files.

I would propose that the no-test and no-fixture become defaults, and that --with-test and --with-fixture are added to invert the logic.

I can see a few advantages of this.

  • The shell does not create files which the user is not expecting
  • Quite often, I guess, most people add tests as a specific activity, rather than when they make the model
  • The additional files clutter up Git repos, as the tests folder is rightly not ignored
  • Less files being written and processed should make basic baking quicker

davidyell avatar Jul 05 '18 10:07 davidyell

I think it should be kept this way. But: One could follow my earlier tip and approach ( https://github.com/cakephp/bake/pull/365/files ) to make the configs Configure defaultable. As such everyone can have his own defaults just fine.

I do that will a lot of my shells and tooling. Always $config + (array)Configure::read('Bake') etc.

dereuromark avatar Jul 05 '18 10:07 dereuromark

So perhaps just an update to Bakes documentation then?

davidyell avatar Jul 05 '18 10:07 davidyell

No, I only applied my configure approach to one specific flag. I recommended to do that for all.

dereuromark avatar Jul 05 '18 10:07 dereuromark

Anyone interested in a PR that would allow setting more global personal defaults? That would solve this per person/preference. The default of having the tests and fixtures right away still sounds like the right thing - to enable more test driven development from the start. But opting out of it using config is a fair thing for those that chose to take that path.

dereuromark avatar Nov 30 '18 00:11 dereuromark

I can't think of a clean way to do this generically. Users can customize the command to overwrite the options.

othercorey avatar Sep 10 '22 06:09 othercorey