Completed
Pull Request — master (#90)
by
unknown
07:39
created

SentenceCapitalizerTest::invalidValueProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/* 
4
 * To change this license header, choose License Headers in Project Properties.
5
 * To change this template file, choose Tools | Templates
6
 * and open the template in the editor.
7
 */
8
9
namespace ValueParsers\Normalizers;
10
11
use InvalidArgumentException;
12
13
/**
14
 * Null implementation of StringNormalizer.
15
 *
16
 * @since 0.3
17
 *
18
 * @license GPL-2.0+
19
 * @author
20
 */
21
class SentenceCapitalizerTest  extends PHPUnit_Framework_TestCase {
22
23
	/**
24
	 * @dataProvider stringProvider
25
	 */
26
	public function testNormalize( $value, $expected ) {
27
		$normalizer = new SentenceCapitalizer();
28
		$this->assertSame( $expected, $normalizer->normalize( $value ) );
29
	}
30
        
31
	public function stringProvider() {
32
		return [
33
			'Empty' => [ '', '' ],
34
			'Trimmed' => [ 'a', 'a' ],
35
			'Spaces' => [ ' a ', 'a' ],
36
			'Controls' => [ "\n\r\ta\n\r\t", 'a' ],
37
			'Paragraph separator' => [ "\xE2\x80\xA9a\xE2\x80\xA9", 'a' ],
38
		];
39
	}
40
41
	/**
42
	 * @dataProvider invalidValueProvider
43
	 */
44
	public function testNormalizeException( $value ) {
45
		$normalizer = new TrimmingStringNormalizer();
46
		$this->setExpectedException( 'InvalidArgumentException' );
47
		$normalizer->normalize( $value );
48
	}
49
50
	public function invalidValueProvider() {
51
		return [
52
			[ null ],
53
			[ true ],
54
			[ 1 ],
55
			[ new StringValue( '' ) ],
56
		];
57
	}
58
}
59