public function advancedAction()
 {
     $request = $this->getRequest();
     $id = $request->getParam('id');
     $cache = MyDiff_Cache::init();
     // Create cache and ID if not got one
     if (!$id || !($comparison = $cache->load('comparison' . $id))) {
         $id = uniqid();
         $databases = $request->getParam('database');
         $comparison = new MyDiff_Comparison();
         foreach ($databases as $database) {
             $database = new MyDiff_Database($database);
             $database->connect();
             $comparison->addDatabase($database);
         }
         // Add to cache
         $cache->save($comparison, 'comparison' . $id);
         // Reload
         $this->_redirect('compare/advanced/id/' . $id);
     }
     if ($request->isPost()) {
         $options = $request->getParam('options');
         $cache->save($options, 'options' . $id);
         $this->_redirect('compare/run/id/' . $id);
     }
     $this->view->comparison = $comparison;
 }
Exemplo n.º 2
0
 public function testDoTableDiffFindsMissingTable()
 {
     $comparison = new MyDiff_Comparison();
     $table = $this->getMock('MyDiff_Table', array('addDiff'), array(null, 'tester'));
     $tableSetOne = array('tester' => $table);
     $tableSetTwo = array();
     $tables = array($tableSetOne, $tableSetTwo);
     $table->expects($this->once())->method('addDiff')->with($this->isInstanceOf('MyDiff_Diff_Table_Missing'));
     $comparison->doTableDiff($tables);
 }