sebastianknott/dev-utils

这是我为开发所需的一系列工具。

0.4.0 2023-01-18 13:47 UTC

This package is auto-updated.

Last update: 2024-09-18 17:45:12 UTC


README

... 简而言之,DUSK(是的,这就是我的风格)是我个人开发项目的工具集。它帮助我快速启动项目,并使一切保持简单和自动化。我尽量使事情保持简单,因此它应该与php >= 7.2兼容,但我将专注于运行最新的PHP版本。

包含什么?

以下是一些你可以在这里找到的工具的简要列表。

单元测试工具

对于单元测试,我个人更喜欢显而易见的。

DevUtilsTestCase

我包含了一个新的单元测试基类,称为 DevUtilsTestCase。这个类将包含一个faker实例和我的个人 SystemUnderTestFactory。此外,mockery和hamcrest的全局函数在您的测试类中也是可用的。

<?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()));
   }
}

部署器

我为部署器编写了两个相当不寻常的配方。

Recipe staticCodeAnalysis

这个配方包含代码质量工具下找到的工具的目标。

Recipe unitTest

这个配方包含运行phpunit和infection的效率目标。

我喜欢的Composer库

这是一份我非常喜爱并迟早会安装的工具列表。

代码质量工具

所有我需要的工具,配置相互兼容。

目前,所有这些都是未来的框架。所有内容都是由部署器缝合在一起的。简单的 dep sca 应该执行所有工具。

随phpcs一起包含的是我的个人编码规范。这是slevomats编码规范和PSR-12之间的一个相当平和的混合。