Completed
Push — master ( c0f76f...37333c )
by Jeroen De
299:55 queued 234:55
created

testMultipleViolations_canByConvertedToArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 16
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 10
nc 1
nop 0
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Frontend\Tests\Unit\Validation;
6
7
use Symfony\Component\Validator\ConstraintViolation;
8
use Symfony\Component\Validator\ConstraintViolationList;
9
use WMDE\Fundraising\Frontend\Validation\ConstraintViolationListMapper;
10
use PHPUnit\Framework\TestCase;
11
12
/**
13
 * @covers \WMDE\Fundraising\Frontend\Validation\ConstraintViolationListMapper
14
 */
15
class ConstraintViolationListMapperTest extends TestCase {
16
17
	public function testMultipleViolations_canByConvertedToArray(): void {
18
		$mapper = new ConstraintViolationListMapper();
19
20
		$violationOne = new ConstraintViolation( 'not good', null, [], null, '[lorem]', 5 );
21
		$violationTwo = new ConstraintViolation( 'neither', null, [], null, '[lorem]', 7 );
22
		$violationThree = new ConstraintViolation( 'oops', null, [], null, '[ipsum]', 9000 );
23
		$violations = new ConstraintViolationList( [ $violationOne, $violationTwo, $violationThree ] );
24
25
		$this->assertEquals(
26
			[
27
				'lorem' => [ 'not good', 'neither' ],
28
				'ipsum' => [ 'oops' ]
29
			],
30
			$mapper->map( $violations )
31
		);
32
	}
33
}
34