/**
  *
  */
 public function testWriteToStages_ManyPages_WritesObjectsToStage()
 {
     $sizes = array(10, 30, 100, 300);
     foreach ($sizes as $size) {
         $writer = new \BatchedWriter($size);
         $pages = array();
         for ($i = 0; $i < 100; $i++) {
             $page = new DogPage();
             $page->Title = 'Wonder Pup  ' . $i;
             $pages[] = $page;
         }
         $writer->writeToStage($pages, 'Stage');
         $writer->finish();
         $currentStage = \Versioned::current_stage();
         \Versioned::reading_stage('Stage');
         $this->assertEquals(100, DogPage::get()->Count());
         \Versioned::reading_stage('Live');
         $this->assertEquals(0, DogPage::get()->Count());
         $writer->writeToStage($pages, 'Live');
         $writer->finish();
         \Versioned::reading_stage('Live');
         $this->assertEquals(100, DogPage::get()->Count());
         \Versioned::reading_stage($currentStage);
         $writer->deleteFromStage($pages, 'Stage', 'Live');
         $writer->finish();
         $this->assertEquals(0, DogPage::get()->Count());
     }
 }
 /**
  *
  */
 public function finish()
 {
     $this->batchWriter->finish();
 }