2
2
3
3
namespace Tests ;
4
4
5
+ use Dyrynda \Database \Support \GeneratesUuid ;
5
6
use PHPUnit_Framework_TestCase ;
6
7
7
8
class UuidResolversTest extends PHPUnit_Framework_TestCase
@@ -13,46 +14,36 @@ class UuidResolversTest extends PHPUnit_Framework_TestCase
13
14
14
15
public function setUp ()
15
16
{
16
- $ this ->generator = $ this ->getMockForTrait (' Dyrynda\Database\Support\ GeneratesUuid' );
17
+ $ this ->generator = $ this ->getMockForTrait (GeneratesUuid::class );
17
18
}
18
19
19
- /** @test */
20
- public function it_handles_uuid_version_1 ()
21
- {
22
- $ this ->generator ->uuidVersion = 'uuid1 ' ;
23
-
24
- $ this ->assertSame ('uuid1 ' , $ this ->generator ->resolveUuidVersion ());
25
- }
26
-
27
- /** @test */
28
- public function it_handles_uuid_version_3 ()
29
- {
30
- $ this ->generator ->uuidVersion = 'uuid3 ' ;
31
-
32
- $ this ->assertSame ('uuid3 ' , $ this ->generator ->resolveUuidVersion ());
33
- }
34
-
35
- /** @test */
36
- public function it_handles_uuid_version_4 ()
20
+ /**
21
+ * @see \Tests\UuidResolversTest::it_handles_uuid_versions
22
+ * @return array
23
+ */
24
+ public function provider_for_it_handles_uuid_versions ()
37
25
{
38
- $ this ->generator ->uuidVersion = 'uuid4 ' ;
39
-
40
- $ this ->assertSame ('uuid4 ' , $ this ->generator ->resolveUuidVersion ());
26
+ return [
27
+ ['uuid1 ' , 'uuid1 ' ],
28
+ ['uuid3 ' , 'uuid3 ' ],
29
+ ['uuid4 ' , 'uuid4 ' ],
30
+ ['uuid5 ' , 'uuid5 ' ],
31
+ ['uuid999 ' , 'uuid4 ' ],
32
+ ];
41
33
}
42
34
43
- /** @test */
44
- public function it_handles_uuid_version_5 ()
45
- {
46
- $ this ->generator ->uuidVersion = 'uuid5 ' ;
47
-
48
- $ this ->assertSame ('uuid5 ' , $ this ->generator ->resolveUuidVersion ());
49
- }
50
35
51
- /** @test */
52
- public function it_defaults_to_uuid_version_4 ()
36
+ /**
37
+ * @test
38
+ * @param string $version
39
+ * @param string $resolved
40
+ *
41
+ * @dataProvider \Tests\UuidResolversTest::provider_for_it_handles_uuid_versions
42
+ */
43
+ public function it_handles_uuid_versions ($ version , $ resolved )
53
44
{
54
- $ this ->generator ->uuidVersion = ' uuid999 ' ;
45
+ $ this ->generator ->uuidVersion = $ version ;
55
46
56
- $ this ->assertSame (' uuid4 ' , $ this ->generator ->resolveUuidVersion ());
47
+ $ this ->assertSame ($ resolved , $ this ->generator ->resolveUuidVersion ());
57
48
}
58
49
}
0 commit comments