Exemple #1
0
 public function fileToDb()
 {
     $manager = CM_Service_Manager::getInstance();
     $output = $this->_getStreamOutput();
     $loader = new CM_Provision_Loader();
     $loader->registerScript(new CM_Db_SetupScript($manager));
     $loader->registerScript(new CM_MongoDb_SetupScript($manager));
     $loader->unload($output);
     $loader->load($output);
 }
Exemple #2
0
 public function testUnload()
 {
     $outputStream = new CM_OutputStream_Null();
     $script = $this->mockClass('CM_Provision_Script_Abstract', ['CM_Provision_Script_UnloadableInterface'])->newInstanceWithoutConstructor();
     $script->mockMethod('shouldBeUnloaded')->at(0, true)->at(1, false)->at(2, true);
     $unloadMethod = $script->mockMethod('unload')->set(function ($output) use($outputStream) {
         $this->assertSame($outputStream, $output);
     });
     /** @var CM_Provision_Script_Abstract $script */
     $loader = new CM_Provision_Loader();
     $loader->registerScript($script);
     $loader->registerScript($script);
     $loader->registerScript($script);
     $loader->unload($outputStream);
     $this->assertSame(2, $unloadMethod->getCallCount());
 }