sebastianknott / dev-utils
This is a collection of stuff I need for developing.
Requires
- php: ^8.1.0
- ext-ast: *
- ext-igbinary: *
- bamarni/composer-bin-plugin: ^1.4
- davidrjonas/composer-lock-diff: ^1.5
- deployer/deployer: ^6.7
- fakerphp/faker: ^1.9
- hamcrest/hamcrest-php: ^2.0
- infection/infection: ^0.26.16
- mindplay/composer-locator: ^2.1
- mockery/mockery: ^1.3
- phake/phake: ^3.1
- phan/phan: ^5.4.1
- php-parallel-lint/php-console-highlighter: ^0.5.0
- php-parallel-lint/php-parallel-lint: ^1.2
- phpcompatibility/php-compatibility: ^9.3
- phpmd/phpmd: ^2.8
- phpmetrics/phpmetrics: ^2.7.0
- phpstan/phpstan: ^1.9.12
- phpstan/phpstan-deprecation-rules: ^1.0.0
- phpstan/phpstan-doctrine: ^1.0.0
- phpstan/phpstan-mockery: ^1.0.0
- phpstan/phpstan-phpunit: ^1.0.0
- phpunit/phpunit: ^9.5.0
- psalm/plugin-phpunit: ^0.18.4
- rregeer/phpunit-coverage-check: ^0.3.1
- sebastian/phpcpd: ^6.0.0
- sebastianknott/coding-standard: ^2.0.0
- sebastianknott/hamcrest-object-accessor: @dev
- squizlabs/php_codesniffer: ^3.5
- vimeo/psalm: ^5.4.0
Requires (Dev)
This package is auto-updated.
Last update: 2025-01-18 18:32:10 UTC
README
... or in short DUSK (Yeah. That's how I roll) is a tool set for my personal development projects. It helps me get things of the ground rather quick and keeps things hassle free and automated. I try to keep things civil, so it SHOULD work with php >= 7.2, but I will focus on running up-to-date versions of PHP.
Whats included?
Here comes a short list of stuff you can find here.
Unit Tests Tools
For UnitTest I personally prefer the obvious.
- phpunit/phpunit
- mockery/mockery
- phake/phake
- hamcrest/hamcrest-php
- sebastianknott/hamcrest-object-accessor
- infection/infection
DevUtilsTestCase
I included a new base class for unit tests called DevUtilsTestCase
. This class will have an instance of faker and
my personal SystemUnderTestFactory
. Additionally the global functions of mockery and hamcrest are accessible in
your test class.
<?php use Mockery\MockInterface; use SebastianKnott\DevUtils\Test\Infrastructure\DevToolsTestCase; class ExampleTest extends DevToolsTestCase { public function testExample(){ // Build your subject with mocked dependencies. There is // also a method for all you phake fans out there ^^ $subjectBundle = self::$factory ->buildSutWithMockery(Example::class); // Access your subject by getting it from the bundle. $subject = $subjectBundle->getSubject(); // Access the corresponding mocked constructor parameters // by name with array notation. /** @var MockInterface $firstParameter */ $firstParameter = $subjectBundle['firstParameterName']; // Notice that you can access hamcrest functions globally // (e.g. `startsWith`) $firstParameter->shouldReceive('myTest') ->with(startsWith('bla')); // ... and faker stands by for your disposal $result = $subject->runMyStuff(self::$faker->address); assertThat($result, is(boolValue())); } }
Deployer
I wrote two rather unusual recipes for deployer.
Recipe staticCodeAnalysis
This recipe contains targets for the tools found under Code Quality Tools.
Recipe unitTest
This recipe contains targets for phpunit and infection to run efficiently.
Composer Libraries I like
There is a list of tools I really love and install sooner or later anyway.
- bamarni/composer-bin-plugin A great tool to install composer packages who expose binaries in vendor/bin without dependency problems.
- davidrjonas/composer-lock-diff This little helper compares two composer.lock files and prints out the diff in easy to understand table.
- dealerdirect/phpcodesniffer-composer-installer Installs Code Sniffer standards directly to Code sniffer. No path wrangling anymore.
- fzaninotto/faker This tool generates any kind of lorem ipsum you may want.
- infection/infection Puts your unit tests under the microscope and makes you a better programmer
- mockery/mockery Mock stuff with eas.
- mockery/mockery Mock stuff with eas.
Code Quality Tools
All the tools I need with configurations compatible to each other.
For now everything is just a scaffold for things to come. Everything is stitched together by deployer. A simple dep sca
should execute all tools.
Included with phpcs comes my own coding-standard. A pretty mellow mix between slevomats coding-standard and PSR-12.