88
99use Exception ;
1010use InvalidArgumentException ;
11- use Myks92 \ValueObjects \Identity \Id ;
11+ use Myks92 \ValueObjects \Identity \Uuid ;
1212use PHPUnit \Framework \TestCase ;
13- use Ramsey \Uuid \Uuid ;
13+ use Ramsey \Uuid \Uuid as UuidRamsey ;
1414
15- class IdTest extends TestCase
15+ class UuidTest extends TestCase
1616{
1717 public function testSuccess (): void
1818 {
19- $ id = $ this ->createId ($ value = Uuid ::uuid4 ()->toString ());
19+ $ id = $ this ->createId ($ value = UuidRamsey ::uuid4 ()->toString ());
2020
2121 self ::assertEquals ($ value , $ id ->getValue ());
2222 }
2323
2424 public function testCase (): void
2525 {
26- $ value = Uuid ::uuid4 ()->toString ();
26+ $ value = UuidRamsey ::uuid4 ()->toString ();
2727 $ id = $ this ->createId (mb_strtoupper ($ value ));
2828
2929 self ::assertEquals ($ value , $ id ->getValue ());
3030 }
3131
3232 public function testGenerate (): void
3333 {
34- $ id = Id ::generate ();
34+ $ id = Uuid ::generate ();
3535
3636 self ::assertNotEmpty ($ id ->getValue ());
3737 }
3838
3939 public function testToString (): void
4040 {
41- $ id = $ this ->createId ($ value = Uuid ::uuid4 ()->toString ());
41+ $ id = $ this ->createId ($ value = UuidRamsey ::uuid4 ()->toString ());
4242
4343 self ::assertEquals ($ value , $ id );
4444 }
4545
4646 public function testEqual (): void
4747 {
4848 $ id = $ this ->createId ();
49- $ id2 = Id ::generate (); //other
49+ $ id2 = Uuid ::generate (); //other
5050
5151 self ::assertTrue ($ id ->isEqualTo ($ id ));
5252 self ::assertFalse ($ id ->isEqualTo ($ id2 ));
@@ -55,26 +55,26 @@ public function testEqual(): void
5555 public function testIncorrect (): void
5656 {
5757 $ this ->expectException (InvalidArgumentException::class);
58- new Id ('not-uuid ' );
58+ new Uuid ('not-uuid ' );
5959 }
6060
6161 public function testEmpty (): void
6262 {
6363 $ this ->expectException (InvalidArgumentException::class);
64- new Id ('' );
64+ new Uuid ('' );
6565 }
6666
6767 /**
6868 * @param $value
6969 *
70- * @return Id
70+ * @return Uuid
7171 * @throws Exception
7272 */
73- private function createId ($ value = null ): Id
73+ private function createId ($ value = null ): Uuid
7474 {
7575 if (null === $ value ) {
76- $ value = Uuid ::uuid4 ()->toString ();
76+ $ value = UuidRamsey ::uuid4 ()->toString ();
7777 }
78- return new Id ($ value );
78+ return new Uuid ($ value );
7979 }
8080}
0 commit comments