Mercurial > hg > isophonics-drupal-site
comparison core/modules/migrate/tests/src/Kernel/HighWaterTest.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
135 $this->assertNodeExists('Item 3 updated'); | 135 $this->assertNodeExists('Item 3 updated'); |
136 $this->assertNodeDoesNotExist('Item 3'); | 136 $this->assertNodeDoesNotExist('Item 3'); |
137 } | 137 } |
138 | 138 |
139 /** | 139 /** |
140 * Tests that the high water value can be 0. | |
141 */ | |
142 public function testZeroHighwater() { | |
143 // Assert all of the nodes have been imported. | |
144 $this->assertNodeExists('Item 1'); | |
145 $this->assertNodeExists('Item 2'); | |
146 $this->assertNodeExists('Item 3'); | |
147 $migration = $this->container->get('plugin.manager.migration')->CreateInstance('high_water_test', []); | |
148 $source = $migration->getSourcePlugin(); | |
149 $source->rewind(); | |
150 $count = 0; | |
151 while ($source->valid()) { | |
152 $count++; | |
153 $source->next(); | |
154 } | |
155 | |
156 // Expect no rows as everything is below the high water mark. | |
157 $this->assertSame(0, $count); | |
158 | |
159 // Test resetting the high water mark to 0. | |
160 $this->container->get('keyvalue')->get('migrate:high_water')->set('high_water_test', 0); | |
161 $migration = $this->container->get('plugin.manager.migration')->CreateInstance('high_water_test', []); | |
162 $source = $migration->getSourcePlugin(); | |
163 $source->rewind(); | |
164 $count = 0; | |
165 while ($source->valid()) { | |
166 $count++; | |
167 $source->next(); | |
168 } | |
169 $this->assertSame(3, $count); | |
170 } | |
171 | |
172 /** | |
173 * Tests that deleting the high water value causes all rows to be reimported. | |
174 */ | |
175 public function testNullHighwater() { | |
176 // Assert all of the nodes have been imported. | |
177 $this->assertNodeExists('Item 1'); | |
178 $this->assertNodeExists('Item 2'); | |
179 $this->assertNodeExists('Item 3'); | |
180 $migration = $this->container->get('plugin.manager.migration')->CreateInstance('high_water_test', []); | |
181 $source = $migration->getSourcePlugin(); | |
182 $source->rewind(); | |
183 $count = 0; | |
184 while ($source->valid()) { | |
185 $count++; | |
186 $source->next(); | |
187 } | |
188 | |
189 // Expect no rows as everything is below the high water mark. | |
190 $this->assertSame(0, $count); | |
191 | |
192 // Test resetting the high water mark. | |
193 $this->container->get('keyvalue')->get('migrate:high_water')->delete('high_water_test'); | |
194 $migration = $this->container->get('plugin.manager.migration')->CreateInstance('high_water_test', []); | |
195 $source = $migration->getSourcePlugin(); | |
196 $source->rewind(); | |
197 $count = 0; | |
198 while ($source->valid()) { | |
199 $count++; | |
200 $source->next(); | |
201 } | |
202 $this->assertSame(3, $count); | |
203 } | |
204 | |
205 /** | |
140 * Tests high water property of SqlBase when rows marked for update. | 206 * Tests high water property of SqlBase when rows marked for update. |
141 */ | 207 */ |
142 public function testHighWaterUpdate() { | 208 public function testHighWaterUpdate() { |
143 // Assert all of the nodes have been imported. | 209 // Assert all of the nodes have been imported. |
144 $this->assertNodeExists('Item 1'); | 210 $this->assertNodeExists('Item 1'); |