@@ -52,19 +52,38 @@ public function testIndex()
52
52
{
53
53
Schema::collection ('newcollection ' , function ($ collection )
54
54
{
55
- $ collection ->index ('mykey ' );
55
+ $ collection ->index ('mykey1 ' );
56
56
});
57
57
58
- $ index = $ this ->getIndex ('newcollection ' , 'mykey ' );
59
- $ this ->assertEquals (1 , $ index ['key ' ]['mykey ' ]);
58
+ $ index = $ this ->getIndex ('newcollection ' , 'mykey1 ' );
59
+ $ this ->assertEquals (1 , $ index ['key ' ]['mykey1 ' ]);
60
+
61
+ Schema::collection ('newcollection ' , function ($ collection )
62
+ {
63
+ $ collection ->index (['mykey2 ' ]);
64
+ });
65
+
66
+ $ index = $ this ->getIndex ('newcollection ' , 'mykey2 ' );
67
+ $ this ->assertEquals (1 , $ index ['key ' ]['mykey2 ' ]);
68
+
69
+ Schema::collection ('newcollection ' , function ($ collection )
70
+ {
71
+ $ collection ->string ('mykey3 ' )->index ();
72
+ });
60
73
74
+ $ index = $ this ->getIndex ('newcollection ' , 'mykey3 ' );
75
+ $ this ->assertEquals (1 , $ index ['key ' ]['mykey3 ' ]);
76
+ }
77
+
78
+ public function testPrimary ()
79
+ {
61
80
Schema::collection ('newcollection ' , function ($ collection )
62
81
{
63
- $ collection ->index ([ 'mykey ' ] );
82
+ $ collection ->string ( 'mykey ' , 100 )-> primary ( );
64
83
});
65
84
66
85
$ index = $ this ->getIndex ('newcollection ' , 'mykey ' );
67
- $ this ->assertEquals (1 , $ index ['key ' ][ ' mykey ' ]);
86
+ $ this ->assertEquals (1 , $ index ['unique ' ]);
68
87
}
69
88
70
89
public function testUnique ()
0 commit comments