Code Duplication    Length = 64-68 lines in 2 locations

tests/unit/xsGDayTest.php 1 location

@@ 9-76 (lines=68) @@
6
/**
7
 * Generated Test Class.
8
 */
9
class xsGDayTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * @dataProvider testxsGDayValidDataProvider
13
     * @param mixed $input
14
     * @param mixed $message
15
     */
16
    public function testxsGDayValid($input, $message)
17
    {
18
        try {
19
            $d = new xsGDay($input);
20
            $s = (string)$d;
21
        } catch (\Exception $e) {
22
            $this->fail($message . ' with Exception ' . $e->getMessage());
23
        }
24
    }
25
26
    public function testxsGDayValidDataProvider()
27
    {
28
        return array(
29
            array('---02', 'the 2nd of the month'),
30
        );
31
    }
32
33
    /**
34
     * @dataProvider testxsGDayInvalidDataProvider
35
     * @param mixed $input
36
     * @param mixed $message
37
     */
38
    public function testxsGDayInvalid($input, $message)
39
    {
40
        try {
41
            $d = new xsGDay($input);
42
            $s = (string)$d;
43
            $this->fail($message);
44
        } catch (\Exception $e) {
45
        }
46
        $this->assertEquals('', $s, $message);
47
    }
48
49
    public function testxsGDayInvalidDataProvider()
50
    {
51
        return array(
52
            array('02', 'the leading hyphens are required'),
53
            array('---2', 'the day must be 2 digits'),
54
            array('---32', 'the day must be a valid day of the month; no month has 32 days'),
55
            array('', 'an empty value is not valid, unless xsi:nil is used'),
56
        );
57
    }
58
59
    /**
60
     * Sets up the fixture, for example, opens a network connection.
61
     * This method is called before a test is executed.
62
     */
63
    protected function setUp()
64
    {
65
        parent::setUp();
66
    }
67
68
    /**
69
     * Tears down the fixture, for example, closes a network connection.
70
     * This method is called after a test is executed.
71
     */
72
    protected function tearDown()
73
    {
74
        parent::tearDown();
75
    }
76
}
77

tests/unit/xsNMTOKENTest.php 1 location

@@ 9-72 (lines=64) @@
6
/**
7
 * Generated Test Class.
8
 */
9
class xsNMTOKENTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * @dataProvider testxsNMTOKENValidDataProvider
13
     */
14
    public function testxsNMTOKENValid($input, $message)
15
    {
16
        try {
17
            $d = new xsNMTOKEN($input);
18
            $s = (string)$d;
19
        } catch (\Exception $e) {
20
            $this->fail($message . ' with Exception ' . $e->getMessage());
21
        }
22
    }
23
24
    public function testxsNMTOKENValidDataProvider()
25
    {
26
        return array(
27
            array('ABCD', ''),
28
            array('123_456', ''),
29
            array('  starts_with_a_space', 'when parsed, leading spaces will be removed'),
30
        );
31
    }
32
33
    /**
34
     * @dataProvider testxsNMTOKENInvalidDataProvider
35
     */
36
    public function testxsNMTOKENInvalid($input, $message)
37
    {
38
        try {
39
            $d = new xsNMTOKEN($input);
40
            $s = (string)$d;
41
            $this->fail($message);
42
        } catch (\Exception $e) {
43
        }
44
        $this->assertEquals('', $s, $message);
45
    }
46
47
    public function testxsNMTOKENInvalidDataProvider()
48
    {
49
        return array(
50
            array('contains a space', 'value must not contain a space'),
51
            array('', 'an empty value is not valid, unless xsi:nil is used'),
52
        );
53
    }
54
55
    /**
56
     * Sets up the fixture, for example, opens a network connection.
57
     * This method is called before a test is executed.
58
     */
59
    protected function setUp()
60
    {
61
        parent::setUp();
62
    }
63
64
    /**
65
     * Tears down the fixture, for example, closes a network connection.
66
     * This method is called after a test is executed.
67
     */
68
    protected function tearDown()
69
    {
70
        parent::tearDown();
71
    }
72
}
73