|
6 | 6 |
|
7 | 7 | class VersionTest extends TestCase |
8 | 8 | { |
| 9 | + public function test_get_complete_version_for_version_file() |
| 10 | + { |
| 11 | + $this->assertSame( |
| 12 | + file_get_contents(__DIR__ . '/../VERSION'), |
| 13 | + get_complete_version([])[0], |
| 14 | + 'Should read from VERSION file in the project root' |
| 15 | + ); |
| 16 | + } |
| 17 | + |
9 | 18 | /** |
10 | 19 | * Converts the version array to string. |
11 | 20 | * |
12 | 21 | * @dataProvider versions |
13 | 22 | */ |
14 | | - public function testVersionString($index, $version, $result) |
| 23 | + public function test_version_string($index, $version, $result) |
15 | 24 | { |
16 | 25 | $this->assertSame($version, get_version($result), '(array -> string) #' . $index); |
17 | 26 | } |
18 | 27 |
|
19 | 28 | /** |
20 | 29 | * Get the version array from VERSION file. |
21 | 30 | */ |
22 | | - public function testVersionFile() |
| 31 | + public function test_version_file() |
23 | 32 | { |
24 | 33 | $version = get_complete_version([]); |
25 | 34 | $this->assertCount(3, $version); |
26 | 35 | } |
27 | 36 |
|
28 | | - public function testMajorVerison() |
| 37 | + public function test_major_verison() |
29 | 38 | { |
30 | 39 | $major = get_major_version([1, 0, 0]); |
31 | 40 | $this->assertSame(1, $major); |
32 | 41 | } |
| 42 | + |
33 | 43 | /** |
34 | 44 | * Converts the string to array version. |
35 | 45 | * |
36 | 46 | * @dataProvider versions |
37 | 47 | */ |
38 | | - public function testVersionArray($index, $version, $result) |
| 48 | + public function test_version_array($index, $version, $result) |
39 | 49 | { |
40 | 50 | $this->assertSame($result, get_version_array($version), '(string -> array) #' . $index); |
41 | 51 | } |
| 52 | + |
42 | 53 | /** |
43 | 54 | * Converts the string to array version. |
44 | 55 | * |
45 | 56 | * @dataProvider moreVersions |
46 | 57 | */ |
47 | | - public function testMoreVersionArray($index, $version, $result) |
| 58 | + public function test_more_version_array($index, $version, $result) |
48 | 59 | { |
49 | 60 | $this->assertSame($result, get_version_array($version), '(string -> array) #' . $index); |
50 | 61 | } |
51 | 62 |
|
52 | 63 | /** |
53 | 64 | * @dataProvider invalidVersions |
54 | 65 | */ |
55 | | - public function testInvalidVersions($index, $version) |
| 66 | + public function test_invalid_versions($index, $version) |
56 | 67 | { |
57 | 68 | $this->assertSame(INVALID_VERSION_ARRAY, get_version_array($version), 'Data row #' . $index); |
58 | 69 | } |
59 | 70 |
|
60 | 71 | /** |
61 | 72 | * Special case: if pre-build is alpha with no meta, git's latest CHANGESET is appended as metadata |
62 | 73 | */ |
63 | | - public function testAlphaPreReleaseWithZeroBuild() |
| 74 | + public function test_alpha_pre_release_with_zero_build() |
64 | 75 | { |
65 | 76 | if (!file_exists(__DIR__ . '/../VERSION')) { |
66 | 77 | $this->markTestSkipped('The VERSION file is not provided, test is skipped'); |
|
0 commit comments