-
Notifications
You must be signed in to change notification settings - Fork 2
/
RomanNumeralTest.php
67 lines (46 loc) · 1.48 KB
/
RomanNumeralTest.php
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
65
66
67
<?php
require_once 'PHPUnit/Framework.php';
require_once 'RomanNumeral.php';
class RomanNumeralTest
extends PHPUnit_Framework_TestCase
{
public function test_class_exists ( )
{
$this->assertTrue(
class_exists('RomanNumeral')
);
} // END test_class_exists
public function test_class_attr()
{
$Numeral = new RomanNumeral('XVII');
$expected = 'XVII';
$this->assertEquals($expected, $Numeral->numeral);
} // END test_class_attr
public function test_validate_true ( )
{
$Numeral = new RomanNumeral('XVII');
$this->assertTrue(method_exists(
$Numeral, 'isValid'
), 'The $Numeral should have a isValid() method!');
$this->assertTrue($Numeral->isValid());
} // END test_validate_true
public static function provide_false_validations ( )
{
return array
(
'Repeating Ls is ERROR' => array( 'LL' ),
'Putting L before C is ERROR' => array( 'LC' ),
'Repeating D is ERROR' => array( 'DD' ),
'Repeating V is ERROR' => array( 'VV' ),
); // END datasets
} // END provide_false_validations
/**
* @dataProvider provide_false_validations
* @param string $numeral
*/
public function test_validate_false ( $numeral )
{
$Numeral = new RomanNumeral($numeral);
$this->assertFalse($Numeral->isValid());
} //END test_validate_false
} // END RomanNumeralTest