| @@ 92-115 (lines=24) @@ | ||
| 89 | $this->assertEquals(1, $this->repository->count()); |
|
| 90 | } |
|
| 91 | ||
| 92 | public function testUpdateMany() |
|
| 93 | { |
|
| 94 | $datas = [ |
|
| 95 | [ |
|
| 96 | "name" => "foo", |
|
| 97 | "value" => 1 |
|
| 98 | ], |
|
| 99 | [ |
|
| 100 | "name" => "bar", |
|
| 101 | "value" => 2 |
|
| 102 | ], |
|
| 103 | [ |
|
| 104 | "name" => "foo", |
|
| 105 | "value" => 3 |
|
| 106 | ] |
|
| 107 | ]; |
|
| 108 | ||
| 109 | $this->repository->insertMany($datas); |
|
| 110 | $this->assertEquals(1, $this->repository->count(['name' => 'foo', 'value' => 3])); |
|
| 111 | ||
| 112 | $this->repository->updateMany(['name' => 'foo'], ['$set' => ['value' => 3]]); |
|
| 113 | $this->assertEquals(2, $this->repository->count(['name' => 'foo', 'value' => 3])); |
|
| 114 | ||
| 115 | } |
|
| 116 | ||
| 117 | public function testReplaceOne() |
|
| 118 | { |
|
| @@ 117-139 (lines=23) @@ | ||
| 114 | ||
| 115 | } |
|
| 116 | ||
| 117 | public function testReplaceOne() |
|
| 118 | { |
|
| 119 | $datas = [ |
|
| 120 | [ |
|
| 121 | "name" => "foo", |
|
| 122 | "value" => 1 |
|
| 123 | ], |
|
| 124 | [ |
|
| 125 | "name" => "bar", |
|
| 126 | "value" => 2 |
|
| 127 | ], |
|
| 128 | [ |
|
| 129 | "name" => "foo", |
|
| 130 | "value" => 3 |
|
| 131 | ] |
|
| 132 | ]; |
|
| 133 | ||
| 134 | $this->repository->insertMany($datas); |
|
| 135 | $this->assertEquals(1, $this->repository->count(['name' => 'foo', 'value' => 3])); |
|
| 136 | $this->repository->replaceOne(['name' => 'foo'], ["name" => "foo", "value" => 5]); |
|
| 137 | ||
| 138 | $this->assertEquals(1, $this->repository->count(["name" => "foo", "value" => 5])); |
|
| 139 | } |
|
| 140 | ||
| 141 | public function testDelete() |
|
| 142 | { |
|