Issue
I want to solve a kata using PHP and test driven development. I would like to use a generator or template to base on a minimal composer project with phpunit.
The minimal project should contain:
- the composer.json with phpunit as require-dev
- the vendor folder
- a sample tests folder with a test file and a source file
I wondered how other developers do that in PHP and found so far the following options:
- use PHPStorm and create a new composer project based on laravel/laravel followed by
php artisan key:generate
as described here and here - use composer init as described in this post
- use php-pds/skeleton followed by
composer require phpunit/phpunit --dev
as described here
What is typical way for a PHP developer to deal with the initial boilerplate in a small php project?
Solution
I can offer you my approach as a reference:
I have a skeleton in PHP with composer and PHPUnit with a class and its test already set up. When I want to challenge a new kata, I just create a new kata and duplicate the skeleton in it (https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/duplicating-a-repository), then updates readme and class names to reflect the kata. Usually, I use master as the reference for the kata to start, and each attempt is a new branch from master.
Here is the link to my repo as a reference, you can use it as a template :)
Answered By - Daniele Scillia Answer Checked By - Willingham (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.