Skip to content

Commit 6d5e8bd

Browse files
committed
test: add unit tests for ECSConfig and RectorConfig classes
Signed-off-by: Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
1 parent a08362f commit 6d5e8bd

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed

tests/Config/ECSConfigTest.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of fast-forward/dev-tools.
7+
*
8+
* This source file is subject to the license bundled
9+
* with this source code in the file LICENSE.
10+
*
11+
* @copyright Copyright (c) 2026 Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
12+
* @license https://opensource.org/licenses/MIT MIT License
13+
*
14+
* @see https://github.com/php-fast-forward/dev-tools
15+
* @see https://github.com/php-fast-forward
16+
* @see https://datatracker.ietf.org/doc/html/rfc2119
17+
*/
18+
19+
namespace FastForward\DevTools\Tests\Config;
20+
21+
use FastForward\DevTools\Config\ECSConfig;
22+
use PHPUnit\Framework\Attributes\CoversClass;
23+
use PHPUnit\Framework\Attributes\Test;
24+
use PHPUnit\Framework\TestCase;
25+
use Symplify\EasyCodingStandard\Configuration\ECSConfigBuilder;
26+
27+
#[CoversClass(ECSConfig::class)]
28+
final class ECSConfigTest extends TestCase
29+
{
30+
/**
31+
* @return void
32+
*/
33+
#[Test]
34+
public function configureWillReturnECSConfigBuilder(): void
35+
{
36+
$result = ECSConfig::configure();
37+
38+
self::assertInstanceOf(ECSConfigBuilder::class, $result);
39+
}
40+
}

tests/Config/RectorConfigTest.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of fast-forward/dev-tools.
7+
*
8+
* This source file is subject to the license bundled
9+
* with this source code in the file LICENSE.
10+
*
11+
* @copyright Copyright (c) 2026 Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
12+
* @license https://opensource.org/licenses/MIT MIT License
13+
*
14+
* @see https://github.com/php-fast-forward/dev-tools
15+
* @see https://github.com/php-fast-forward
16+
* @see https://datatracker.ietf.org/doc/html/rfc2119
17+
*/
18+
19+
namespace FastForward\DevTools\Tests\Config;
20+
21+
use FastForward\DevTools\Config\RectorConfig;
22+
use PHPUnit\Framework\Attributes\CoversClass;
23+
use PHPUnit\Framework\Attributes\Test;
24+
use PHPUnit\Framework\TestCase;
25+
26+
#[CoversClass(RectorConfig::class)]
27+
final class RectorConfigTest extends TestCase
28+
{
29+
/**
30+
* @return void
31+
*/
32+
#[Test]
33+
public function configureWillReturnCallable(): void
34+
{
35+
$result = RectorConfig::configure();
36+
37+
self::assertIsCallable($result);
38+
}
39+
40+
/**
41+
* @return void
42+
*/
43+
#[Test]
44+
public function configureWithCustomCallbackWillReturnCallable(): void
45+
{
46+
$customCallback = static function ($config): void {
47+
\assert($config instanceof \Rector\Config\RectorConfig);
48+
};
49+
50+
$result = RectorConfig::configure($customCallback);
51+
52+
self::assertIsCallable($result);
53+
}
54+
}

0 commit comments

Comments
 (0)