Code Duplication    Length = 70-71 lines in 6 locations

tests/unit/xsBase64BinaryTest.php 1 location

@@ 9-78 (lines=70) @@
6
/**
7
 * Generated Test Class.
8
 */
9
class xsBase64BinaryTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * Sets up the fixture, for example, opens a network connection.
13
     * This method is called before a test is executed.
14
     */
15
    protected function setUp()
16
    {
17
        parent::setUp();
18
    }
19
20
    /**
21
     * Tears down the fixture, for example, closes a network connection.
22
     * This method is called after a test is executed.
23
     */
24
    protected function tearDown()
25
    {
26
        parent::tearDown();
27
    }
28
29
    /**
30
     * @dataProvider testxsBase64BinaryValidDataProvider
31
     * @param mixed $input
32
     * @param mixed $message
33
     */
34
    public function testxsBase64BinaryValid($input, $message)
35
    {
36
        try {
37
            $d = new xsBase64Binary($input);
38
            $e = (string)$d;
39
        } catch (\Exception $e) {
40
            $this->fail($message . ' with Exception ' . $e->getMessage());
41
        }
42
    }
43
44
    public function testxsBase64BinaryValidDataProvider()
45
    {
46
        return array(
47
            array('0FB8', 'Uppercase base64'),
48
            array('0fb8', 'Lowercase base64'),
49
            array('0 FB8 0F+9', 'whitespace is allowed anywhere in the value'),
50
            array('0F+40A==', 'equals signs are used for padding'),
51
            array('', 'an empty value is valid'),
52
        );
53
    }
54
55
    /**
56
     * @dataProvider testxsBase64BinaryInvalidDataProvider
57
     * @param mixed $input
58
     * @param mixed $message
59
     */
60
    public function testxsBase64BinaryInvalid($input, $message)
61
    {
62
        try {
63
            $d = new xsBase64Binary($input);
64
            $s = (string)$d;
65
            $this->fail($message);
66
        } catch (\Exception $e) {
67
        }
68
        $this->assertEquals('', $s, $message);
69
    }
70
71
    public function testxsBase64BinaryInvalidDataProvider()
72
    {
73
        return array(
74
            array('FB8', 'an odd number of characters is not valid; characters appear in groups of four'),
75
            array('==0F', 'equals signs may only appear at the end'),
76
        );
77
    }
78
}
79

tests/unit/xsGMonthTest.php 1 location

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

tests/unit/xsIntTest.php 1 location

@@ 9-78 (lines=70) @@
6
/**
7
 * Generated Test Class.
8
 */
9
class xsIntTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * @dataProvider testxsIntValidDataProvider
13
     * @param mixed $input
14
     * @param mixed $message
15
     */
16
    public function testxsIntValid($input, $message)
17
    {
18
        try {
19
            $d = new xsInt($input);
20
            $s = (string)$d;
21
        } catch (\Exception $e) {
22
            $this->fail($message . ' with Exception ' . $e->getMessage());
23
        }
24
    }
25
26
    public function testxsIntValidDataProvider()
27
    {
28
        return array(
29
            array('+3', ''),
30
            array('122', ''),
31
            array('0', ''),
32
            array('-12312', ''),
33
        );
34
    }
35
36
    /**
37
     * @dataProvider testxsIntInvalidDataProvider
38
     * @param mixed $input
39
     * @param mixed $message
40
     */
41
    public function testxsIntInvalid($input, $message)
42
    {
43
        try {
44
            $d = new xsInt($input);
45
            $s = (string)$d;
46
            $this->fail($message);
47
        } catch (\Exception $e) {
48
        }
49
        $this->assertEquals('', $s, $message);
50
    }
51
52
    public function testxsIntInvalidDataProvider()
53
    {
54
        return array(
55
            array('2147483650', 'number is too large'),
56
            array('3.0', 'value must not contain a decimal point'),
57
            array('', 'an empty value is not valid, unless xsi:nil is used'),
58
        );
59
    }
60
61
    /**
62
     * Sets up the fixture, for example, opens a network connection.
63
     * This method is called before a test is executed.
64
     */
65
    protected function setUp()
66
    {
67
        parent::setUp();
68
    }
69
70
    /**
71
     * Tears down the fixture, for example, closes a network connection.
72
     * This method is called after a test is executed.
73
     */
74
    protected function tearDown()
75
    {
76
        parent::tearDown();
77
    }
78
}
79

tests/unit/xsLongTest.php 1 location

@@ 9-78 (lines=70) @@
6
/**
7
 * Generated Test Class.
8
 */
9
class xsLongTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * @dataProvider testxsLongValidDataProvider
13
     * @param mixed $input
14
     * @param mixed $message
15
     */
16
    public function testxsLongValid($input, $message)
17
    {
18
        try {
19
            $d = new xsLong($input);
20
            $s = (string)$d;
21
        } catch (\Exception $e) {
22
            $this->fail($message . ' with Exception ' . $e->getMessage());
23
        }
24
    }
25
26
    public function testxsLongValidDataProvider()
27
    {
28
        return array(
29
            array('+3', ''),
30
            array('122', ''),
31
            array('0', ''),
32
            array('-1231235555', ''),
33
        );
34
    }
35
36
    /**
37
     * @dataProvider testxsLongInvalidDataProvider
38
     * @param mixed $input
39
     * @param mixed $message
40
     */
41
    public function testxsLongInvalid($input, $message)
42
    {
43
        try {
44
            $d = new xsLong($input);
45
            $s = (string)$d;
46
            $this->fail($message);
47
        } catch (\Exception $e) {
48
        }
49
        $this->assertEquals('', $s, $message);
50
    }
51
52
    public function testxsLongInvalidDataProvider()
53
    {
54
        return array(
55
            array('9223372036854775810', 'number is too large'),
56
            array('3.0', 'value must not contain a decimal point'),
57
            array('', 'an empty value is not valid, unless xsi:nil is used'),
58
        );
59
    }
60
61
    /**
62
     * Sets up the fixture, for example, opens a network connection.
63
     * This method is called before a test is executed.
64
     */
65
    protected function setUp()
66
    {
67
        parent::setUp();
68
    }
69
70
    /**
71
     * Tears down the fixture, for example, closes a network connection.
72
     * This method is called after a test is executed.
73
     */
74
    protected function tearDown()
75
    {
76
        parent::tearDown();
77
    }
78
}
79

tests/unit/xsNameTest.php 1 location

@@ 9-79 (lines=71) @@
6
/**
7
 * Generated Test Class.
8
 */
9
class xsNameTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * @dataProvider testxsNameValidDataProvider
13
     * @param mixed $input
14
     * @param mixed $message
15
     */
16
    public function testxsNameValid($input, $message)
17
    {
18
        try {
19
            $d = new xsName($input);
20
            $s = (string)$d;
21
        } catch (\Exception $e) {
22
            $this->fail($message . ' with Exception ' . $e->getMessage());
23
        }
24
    }
25
26
    public function testxsNameValidDataProvider()
27
    {
28
        return array(
29
            array('myElement', ''),
30
            array('_my.Element', ''),
31
            array('my-element', ''),
32
            array('pre:myelement3', 'this is recommended only if pre is a namespace prefix; otherwise, colons ' .
33
                'should not be used'),
34
        );
35
    }
36
37
    /**
38
     * @dataProvider testxsNameInvalidDataProvider
39
     * @param mixed $input
40
     * @param mixed $message
41
     */
42
    public function testxsNameInvalid($input, $message)
43
    {
44
        try {
45
            $d = new xsName($input);
46
            $s = (string)$d;
47
            $this->fail($message);
48
        } catch (\Exception $e) {
49
        }
50
        $this->assertEquals('', $s, $message);
51
    }
52
53
    public function testxsNameInvalidDataProvider()
54
    {
55
        return array(
56
            array('-myelement', 'a Name must not start with a hyphen'),
57
            array('3rdElement', 'a Name must not start with a number'),
58
            array('', 'an empty value is not valid, unless xsi:nil is used'),
59
        );
60
    }
61
62
    /**
63
     * Sets up the fixture, for example, opens a network connection.
64
     * This method is called before a test is executed.
65
     */
66
    protected function setUp()
67
    {
68
        parent::setUp();
69
    }
70
71
    /**
72
     * Tears down the fixture, for example, closes a network connection.
73
     * This method is called after a test is executed.
74
     */
75
    protected function tearDown()
76
    {
77
        parent::tearDown();
78
    }
79
}
80

tests/unit/xsNegativeIntegerTest.php 1 location

@@ 9-78 (lines=70) @@
6
/**
7
 * Generated Test Class.
8
 */
9
class xsNegativeIntegerTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * @dataProvider testxsNegativeIntegerValidDataProvider
13
     * @param mixed $input
14
     * @param mixed $message
15
     */
16
    public function testxsNegativeIntegerValid($input, $message)
17
    {
18
        try {
19
            $d = new xsNegativeInteger($input);
20
            $s = (string)$d;
21
        } catch (\Exception $e) {
22
            $this->fail($message . ' with Exception ' . $e->getMessage());
23
        }
24
    }
25
26
    public function testxsNegativeIntegerValidDataProvider()
27
    {
28
        return array(
29
            array('-3', ''),
30
            array('-00122', 'leading zeros are permitted'),
31
        );
32
    }
33
34
    /**
35
     * @dataProvider testxsNegativeIntegerInvalidDataProvider
36
     * @param mixed $input
37
     * @param mixed $message
38
     */
39
    public function testxsNegativeIntegerInvalid($input, $message)
40
    {
41
        try {
42
            $d = new xsNegativeInteger($input);
43
            $s = (string)$d;
44
            $this->fail($message);
45
        } catch (\Exception $e) {
46
        }
47
        $this->assertEquals('', $s, $message);
48
    }
49
50
    public function testxsNegativeIntegerInvalidDataProvider()
51
    {
52
        return array(
53
            array('0', '0 is not considered negative'),
54
            array('122', 'value cannot be positive'),
55
            array('+3', 'value cannot be positive'),
56
            array('3.0', 'value must not contain a decimal point'),
57
            array('', 'an empty value is not valid, unless xsi:nil is used'),
58
        );
59
    }
60
61
    /**
62
     * Sets up the fixture, for example, opens a network connection.
63
     * This method is called before a test is executed.
64
     */
65
    protected function setUp()
66
    {
67
        parent::setUp();
68
    }
69
70
    /**
71
     * Tears down the fixture, for example, closes a network connection.
72
     * This method is called after a test is executed.
73
     */
74
    protected function tearDown()
75
    {
76
        parent::tearDown();
77
    }
78
}
79