-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathConfigurationTest.php
More file actions
64 lines (59 loc) · 2.43 KB
/
ConfigurationTest.php
File metadata and controls
64 lines (59 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
declare(strict_types=1);
namespace Damianopetrungaro\PHPCommitizen;
use PHPUnit\Framework\TestCase;
final class ConfigurationTest extends TestCase
{
/**
* @dataProvider configurationDataProvider
*/
public function testConfigurationFromArray(array $config): void
{
$configuration = Configuration::fromArray($config);
$this->assertSame($configuration->minLengthType(), $config['type']['lengthMin']);
$this->assertSame($configuration->maxLengthType(), $config['type']['lengthMax']);
$this->assertSame($configuration->acceptExtraType(), $config['type']['acceptExtra']);
$this->assertSame($configuration->types(), $config['type']['values']);
$this->assertSame($configuration->minLengthScope(), $config['scope']['lengthMin']);
$this->assertSame($configuration->maxLengthScope(), $config['scope']['lengthMax']);
$this->assertSame($configuration->acceptExtraScope(), $config['scope']['acceptExtra']);
$this->assertSame($configuration->scopes(), $config['scope']['values']);
$this->assertSame($configuration->minLengthDescription(), $config['description']['lengthMin']);
$this->assertSame($configuration->maxLengthDescription(), $config['description']['lengthMax']);
$this->assertSame($configuration->minLengthSubject(), $config['subject']['lengthMin']);
$this->assertSame($configuration->maxLengthSubject(), $config['subject']['lengthMax']);
$this->assertSame($configuration->wrapWidthBody(), $config['body']['wrap']);
$this->assertSame($configuration->wrapWidthFooter(), $config['footer']['wrap']);
}
public function configurationDataProvider(): array
{
return [[[
'type' => [
'lengthMin' => 1,
'lengthMax' => 5,
'acceptExtra' => false,
'values' => ['feat', 'fix'],
],
'scope' => [
'lengthMin' => 0,
'lengthMax' => 10,
'acceptExtra' => true,
'values' => [],
],
'description' => [
'lengthMin' => 1,
'lengthMax' => 44,
],
'subject' => [
'lengthMin' => 1,
'lengthMax' => 50,
],
'body' => [
'wrap' => 72,
],
'footer' => [
'wrap' => 72,
],
]]];
}
}