|
@@ 157-167 (lines=11) @@
|
| 154 |
|
* @expectedException InvalidArgumentException |
| 155 |
|
* @expectedExceptionMessage Cannot create an index with no keys defined. |
| 156 |
|
*/ |
| 157 |
|
public function testSchemaCreateRequiresKeys() |
| 158 |
|
{ |
| 159 |
|
$collection = $this->connection->selectCollection(self::$dbName, 'test-model'); |
| 160 |
|
$manager = new Modlr\Persister\MongoDb\SchemaManager; |
| 161 |
|
|
| 162 |
|
$schemata = [ |
| 163 |
|
['options' => ['unique' => true]] |
| 164 |
|
]; |
| 165 |
|
|
| 166 |
|
$manager->createSchemata($collection, $schemata); |
| 167 |
|
} |
| 168 |
|
|
| 169 |
|
/** |
| 170 |
|
* @expectedException InvalidArgumentException |
|
@@ 173-183 (lines=11) @@
|
| 170 |
|
* @expectedException InvalidArgumentException |
| 171 |
|
* @expectedExceptionMessage Cannot create an index with no keys defined. |
| 172 |
|
*/ |
| 173 |
|
public function testSchemaCreateRequiresAtLeastOneKey() |
| 174 |
|
{ |
| 175 |
|
$collection = $this->connection->selectCollection(self::$dbName, 'test-model'); |
| 176 |
|
$manager = new Modlr\Persister\MongoDb\SchemaManager; |
| 177 |
|
|
| 178 |
|
$schemata = [ |
| 179 |
|
['keys' => [], 'options' => ['unique' => true]] |
| 180 |
|
]; |
| 181 |
|
|
| 182 |
|
$manager->createSchemata($collection, $schemata); |
| 183 |
|
} |
| 184 |
|
|
| 185 |
|
public function testSchemaCreation() |
| 186 |
|
{ |