Passed
Push — master ( f5d129...209660 )
by Nelson
02:26
created

VersionTestProvider   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 243
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 155
dl 0
loc 243
rs 10
c 0
b 0
f 0
wmc 13

11 Methods

Rating   Name   Duplication   Size   Complexity  
A goodConstructorArgumentsProvider() 0 18 1
A badConstructorArgumentsProvider() 0 13 1
A IEquatableMethodArgumentsProvider() 0 11 1
A toStringMethodProvider() 0 11 1
A compareMethodArraysProvider() 0 38 1
A unaccesiblePropertiesProvider() 0 9 1
A isValidProvider() 0 13 3
A objectInstanceProvider() 0 3 1
A compareMethodArgumentsProvider() 0 18 1
A readOnlyPropertiesProvider() 0 9 1
A IComparableCompareToMethodArgumentsProvider() 0 28 1
1
<?php
2
/**
3
 * PHP: Nelson Martell Library file
4
 *
5
 * Content:
6
 * - Trait definition.
7
 *
8
 * Copyright © 2016-2017 Nelson Martell (http://nelson6e65.github.io)
9
 *
10
 * Licensed under The MIT License (MIT)
11
 * For full copyright and license information, please see the LICENSE
12
 * Redistributions of files must retain the above copyright notice.
13
 *
14
 * @copyright 2016-2017 Nelson Martell
15
 * @link      http://nelson6e65.github.io/php_nml/
16
 * @since     v0.6.0
17
 * @license   http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
18
 * */
19
20
namespace NelsonMartell\Test\DataProviders;
21
22
use NelsonMartell\Test\Helpers\ConstructorMethodTester;
23
use NelsonMartell\Test\Helpers\ExporterPlugin;
24
use NelsonMartell\Test\Helpers\HasReadOnlyProperties;
25
use NelsonMartell\Test\Helpers\HasUnaccesibleProperties;
26
use NelsonMartell\Test\Helpers\IComparableTester;
27
use NelsonMartell\Test\Helpers\IComparerTester;
28
use NelsonMartell\Test\Helpers\IEquatableTester;
29
use NelsonMartell\Test\Helpers\ImplementsIStrictPropertiesContainer;
30
use NelsonMartell\Version;
31
use NelsonMartell\VersionComponent;
32
33
/**
34
 *
35
 * @author Nelson Martell <[email protected]>
36
 * @internal
37
 * */
38
trait VersionTestProvider
39
{
40
    use ExporterPlugin;
41
    use ConstructorMethodTester;
42
    use IComparableTester;
43
    use IComparerTester;
44
    use IEquatableTester;
45
    use ImplementsIStrictPropertiesContainer;
46
    use HasReadOnlyProperties;
47
    use HasUnaccesibleProperties;
48
49
    public function unaccesiblePropertiesProvider()
50
    {
51
        $version = Version::parse(NML_VERSION);
52
53
        return [
54
            '$major with case changed'    => [$version, 'Major'],
55
            '$minor with case changed'    => [$version, 'Minor'],
56
            '$build with case changed'    => [$version, 'Build'],
57
            '$revision with case changed' => [$version, 'Revision'],
58
        ];
59
    }
60
61
    /**
62
     * Provides invalid arguments for constructor.
63
     *
64
     * @return array
65
     */
66
    public function badConstructorArgumentsProvider()
67
    {
68
        return [
69
            'Type: null (all)'               => [null, null],
70
            'Only first argument'            => [1, null],
71
            'Invalid $major and $minor type' => ['hello', 'world'],
72
            'Invalid $major type (string)'   => ['hello', 1],
73
            'Invalid $minor type (string)'   => [1, 'world'],
74
            '$major value < 0'               => [-1, 0],
75
            '$minor value < 0'               => [1, -3],
76
            '$build value < 0'               => [1, 0, -1, null],
77
            '$revision value < 0'            => [1, 0, 1, -1],
78
            '$revision while $build is not'  => [1, 0, null, -1],
79
        ];
80
    }
81
82
    /**
83
     * Provides valid arguments for constructor.
84
     *
85
     * @return array
86
     */
87
    public function goodConstructorArgumentsProvider()
88
    {
89
        return [
90
            'SemVer: Normal'                     => [1, 0, 0],
91
            'SemVer: Patch release '             => [1, 0, 1],
92
            'SemVer: Minor release'              => [1, 1, 0],
93
            'SemVer: Major release'              => [2, 0, 0],
94
            'SemVer: Pre-release alpha'          => [1, 0, '0-alpha'],
95
            'SemVer: Pre-release beta'           => [1, 0, '0-beta', 1],
96
            // 'SemVer: Pre-release build metadata' => [1, 0, '0-beta', '1+20130313144700'],
97
            'Windows version: Major'             => [1, 0, 0, 0],
98
            'Windows version: Minor'             => [1, 1, 0, 0],
99
            'Windows version: Build'             => [1, 2, 1, 0],
100
            'Windows version: Revision'          => [1, 3, 1, 2344234],
101
            'Git: describe'                      => [0, 5, '1-34-g6e5462c'],
102
            'Zero (minor)'                       => [0, 0], // is invalid, but can be created
103
            'Zero (build)'                       => [0, 0, 0], // is invalid, but can be created
104
            'Zero (revision)'                    => [0, 0, 0, 0], // is invalid, but can be created
105
        ];
106
    }
107
108
109
    public function objectInstanceProvider()
110
    {
111
        return [[new Version(0, 7, '0-beta')]];
112
    }
113
114
    public function readOnlyPropertiesProvider()
115
    {
116
        $obj = new Version(0, 7, '0-beta');
117
118
        return [
119
            [$obj, 'major', 0],
120
            [$obj, 'minor', 7],
121
            [$obj, 'build', new VersionComponent(0, '-beta')],
122
            [$obj, 'revision', new VersionComponent(null)],
123
        ];
124
    }
125
126
    public function IComparableCompareToMethodArgumentsProvider()
0 ignored issues
show
Coding Style introduced by
This method is not in camel caps format.

This check looks for method names that are not written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection seeker becomes databaseConnectionSeeker.

Loading history...
127
    {
128
        $v = new Version(1, 0, 9);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 13 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
129
        $obj = new \stdClass();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 11 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
130
        $obj->major = 1;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
131
        $obj->minor = 0;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
132
        $obj->build = 9;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
133
        $obj->revision = null;
134
135
136
        $args = [
137
            'Equals by reference'               => [0, $v, $v],
138
            'Equals by value'                   => [0, new Version(1, 0, 1), Version::parse('1.0.1')],
1 ignored issue
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 102 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
139
            'Major difference'                  => [-1, Version::parse('1.0.0'), Version::parse('2.0.0')],
1 ignored issue
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 106 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
140
            'Minor difference'                  => [1, Version::parse('1.1.0'), Version::parse('1.0.0')],
1 ignored issue
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 105 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
141
            'Build difference'                  => [1, Version::parse('1.0.1'), Version::parse('1.0.0')],
1 ignored issue
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 105 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
142
            'Revision difference'               => [-1, Version::parse('1.0.0.254'), Version::parse('1.0.0.389')],
1 ignored issue
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 114 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
143
            'Version < object'                  => [null, $v, $obj],
144
            'Version > array parseable'         => [1, Version::parse('1.1.0'), [0, 1, 999]],
145
            'Version < array parseable'         => [-1, Version::parse('1.1.0'), [2, 0]],
146
            'Version > array not parseable'     => [1, Version::parse('0.0.0'), ['invalid array']],
147
            'Version > string parseable'        => [1, Version::parse('1.1.0'), '0.1.999'],
148
            'Version < string parseable'        => [-1, Version::parse('1.1.0'), '2.0'],
149
            'Version > string not parseable'    => [1, Version::parse('1.1.0'), 'invalid string'],
150
            'integer|Version'                   => [1, $v, 9976645645656],
151
        ];
152
153
        return $args;
154
    }
155
156
    public function compareMethodArgumentsProvider()
157
    {
158
        $v = new Version(1, 0, 9);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 13 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
159
        $obj = new \stdClass();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 11 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
160
        $obj->major = 1;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
161
        $obj->minor = 0;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
162
        $obj->build = 9;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
163
        $obj->revision = null;
164
165
        $args = [
166
            'stdClass|Version' => [null, $obj, $v],
167
            'string|Version'   => [-1, '1.0.0.254', $v],
168
            'integer|Version'  => [-1, 9976645645656, $v],
169
            'float|Version'    => [-1, 1.342333, $v],
170
            'array|Version'    => [-1, [0, 1, 999], Version::parse('1.1.0')],
171
        ];
172
173
        return $args;
174
    }
175
176
    public function compareMethodArraysProvider()
177
    {
178
        return [
179
            'Version[]' => [[
180
                new Version(1, 0, 1, 3),
181
                new Version(1, 0, 11, 3),
182
                new Version(1, 1, 1, 0),
183
                new Version(1, 3, 1, 9),
184
                Version::parse("2.3.2-3-g"),
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal 2.3.2-3-g does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
185
                Version::parse("2.3.2-3-g726356"),
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal 2.3.2-3-g726356 does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
186
                Version::parse("2.3.2-4-g"),
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal 2.3.2-4-g does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
187
                Version::parse("2.3.4-3-g"),
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal 2.3.4-3-g does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
188
                Version::parse("2.3.4-3-gsh4hajk7"),
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal 2.3.4-3-gsh4hajk7 does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
189
                Version::parse("2.3.4-3-gsh4hbjk7"),
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal 2.3.4-3-gsh4hbjk7 does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
190
                Version::parse("2.31.0-4-g"),
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal 2.31.0-4-g does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
191
                Version::parse("2.31.1-4-g"),
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal 2.31.1-4-g does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
192
                Version::parse("2.31.11-4-g"),
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal 2.31.11-4-g does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
193
            ]],
194
            'Version[] + integer[]' => [[
195
                1,
196
                new Version(1, 0, 1, 3),
197
                new Version(1, 0, 11, 3),
198
                new Version(1, 1, 1, 0),
199
            ]],
200
            'Version[] + string[]'  => [[
201
                '0.0',
202
                new Version(0, 0, 9, 3),
203
                '0.1.0',
204
            ]],
205
            'Version[] + string[] (1 non parseable string)'  => [[
206
                '0.1.0',
207
                'invalid string',
208
                new Version(1, 0, 1, 3),
209
            ]],
210
            'Version[] + array[]'   => [[
211
                [],
212
                [0, 1, 0],
213
                new Version(1, 0, 1, 3),
214
            ]],
215
        ];
216
    }
217
218
    public function IEquatableMethodArgumentsProvider()
0 ignored issues
show
Coding Style introduced by
This method is not in camel caps format.

This check looks for method names that are not written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection seeker becomes databaseConnectionSeeker.

Loading history...
219
    {
220
        return [
221
            [true, new Version(1, 2), new Version(1, 2)],
222
            [false, new Version(1, 4), new Version(1, 2)],
223
            [false, new Version(1, 2, 1), new Version(1, 2, 2)],
224
            [false, new Version(1, 2, 1), 123],
225
            [false, new Version(1, 2, 1), 2345654675675675673453],
226
            [false, new Version(1, 2, 1), '1.2.1'],
227
            [false, new Version(1, 2, 1), [1, 2, 1]],
228
            [false, new Version(1, 2, 1), new \stdClass],
229
        ];
230
    }
231
232
    protected $parseableStrings = [
233
        'valid' => [
234
            '1.0',
235
            '0.2',
236
            '2.3.2-3-g726351',
237
            '2.3.2.3-2-g726352',
238
            '3.0.1',
239
            '4.0.2.0',
240
            '5.0.0.3-beta',
241
            '6.0.0-alpha',
242
        ],
243
        'invalid' => [
244
            '0.0',
245
            '1.0..1',
246
            '2.0.0-alpha.0',
247
            '2.3.2-3-g726353.3',
248
            '2.3.2-3-g726356.1-2-gyt4f4',
249
            '3.0.1-alpha.1',
250
            '4.0.0-alpha.0-beta',
251
            '5.0.1-alpha.2-beta',
252
        ],
253
    ];
254
255
    public function isValidProvider()
256
    {
257
        $args = [];
258
259
        foreach ($this->parseableStrings['valid'] as $str) {
260
            $args[$str] = [true, Version::parse($str)];
261
        }
262
263
        foreach ($this->parseableStrings['invalid'] as $str) {
264
            $args[$str] = [false, Version::parse($str)];
265
        }
266
267
        return $args;
268
    }
269
270
    public function toStringMethodProvider()
271
    {
272
        return [
273
            ['1.0', new Version(1, 0)],
274
            ['0.2', new Version(0, 2)],
275
            ['2.3.2-3-g726351', new Version(2, 3, '2-3-g726351')],
276
            ['2.3.2.3-2-g726352', new Version(2, 3, 2, '3-2-g726352')],
277
            ['3.0.1', new Version(3, 0, 1)],
278
            ['4.0.2.0', new Version(4, 0, 2, 0)],
279
            ['5.0.0.3-beta', new Version(5, 0, 0, '3-beta')],
280
            ['6.0.0-alpha', new Version(6, 0, '0-alpha')],
281
        ];
282
    }
283
}
284