| @@ 35-44 (lines=10) @@ | ||
| 32 | * @param string $version Version. |
|
| 33 | * @param string|InvalidArgumentException $expect Expected result. |
|
| 34 | */ |
|
| 35 | public function testNormalizeVersion( $version, $expect ) { |
|
| 36 | $obj = new SemverVersioning( array() ); |
|
| 37 | if ( $expect instanceof InvalidArgumentException ) { |
|
| 38 | $this->expectException( InvalidArgumentException::class ); |
|
| 39 | $this->expectExceptionMessage( $expect->getMessage() ); |
|
| 40 | $obj->normalizeVersion( $version ); |
|
| 41 | } else { |
|
| 42 | $this->assertSame( $expect, $obj->normalizeVersion( $version ) ); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * Data provider for testNormalizeVersion. |
|
| @@ 298-308 (lines=11) @@ | ||
| 295 | * @param array $extra Extra components. |
|
| 296 | * @param string|InvalidArgumentException $expect Expected result. |
|
| 297 | */ |
|
| 298 | public function testFirstVersion( array $extra, $expect ) { |
|
| 299 | $obj = new SemverVersioning( array() ); |
|
| 300 | ||
| 301 | if ( $expect instanceof InvalidArgumentException ) { |
|
| 302 | $this->expectException( InvalidArgumentException::class ); |
|
| 303 | $this->expectExceptionMessage( $expect->getMessage() ); |
|
| 304 | $obj->firstVersion( $extra ); |
|
| 305 | } else { |
|
| 306 | $this->assertSame( $expect, $obj->firstVersion( $extra ) ); |
|
| 307 | } |
|
| 308 | } |
|
| 309 | ||
| 310 | /** |
|
| 311 | * Data provider for testFirstVersion. |
|
| @@ 49-58 (lines=10) @@ | ||
| 46 | * @param string $version Version. |
|
| 47 | * @param string|InvalidArgumentException $expect Expected result. |
|
| 48 | */ |
|
| 49 | public function testNormalizeVersion( $version, $expect ) { |
|
| 50 | $obj = new WordpressVersioning( array() ); |
|
| 51 | if ( $expect instanceof InvalidArgumentException ) { |
|
| 52 | $this->expectException( InvalidArgumentException::class ); |
|
| 53 | $this->expectExceptionMessage( $expect->getMessage() ); |
|
| 54 | $obj->normalizeVersion( $version ); |
|
| 55 | } else { |
|
| 56 | $this->assertSame( $expect, $obj->normalizeVersion( $version ) ); |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Data provider for testNormalizeVersion. |
|
| @@ 302-312 (lines=11) @@ | ||
| 299 | * @param array $extra Extra components. |
|
| 300 | * @param string|InvalidArgumentException $expect Expected result. |
|
| 301 | */ |
|
| 302 | public function testFirstVersion( array $extra, $expect ) { |
|
| 303 | $obj = new WordpressVersioning( array() ); |
|
| 304 | ||
| 305 | if ( $expect instanceof InvalidArgumentException ) { |
|
| 306 | $this->expectException( InvalidArgumentException::class ); |
|
| 307 | $this->expectExceptionMessage( $expect->getMessage() ); |
|
| 308 | $obj->firstVersion( $extra ); |
|
| 309 | } else { |
|
| 310 | $this->assertSame( $expect, $obj->firstVersion( $extra ) ); |
|
| 311 | } |
|
| 312 | } |
|
| 313 | ||
| 314 | /** |
|
| 315 | * Data provider for testFirstVersion. |
|