public function test_resolveMoves()
 {
     $handler = new helper_plugin_move_handler('deep:namespace:page', 'used:to:be:here', array(array('used:to:be:here', 'deep:namespace:page'), array('foo', 'bar'), array('used:to:be:this1', 'used:to:be:that1'), array('used:to:be:this2', 'deep:namespace:that1'), array('used:to:be:this3', 'deep:that3'), array('deep:that3', 'but:got:moved3')), array(), array());
     $tests = array('used:to:be:here' => 'deep:namespace:page', ':foo' => 'bar', ':bang' => 'bang', 'foo' => 'used:to:be:foo', 'this1' => 'used:to:be:that1', 'this2' => 'deep:namespace:that1', 'this3' => 'but:got:moved3');
     foreach ($tests as $match => $id) {
         $this->assertEquals($id, $handler->resolveMoves($match, 'page'));
     }
 }
 public function rewrite_include($match, $pos, $state, $plugin, helper_plugin_move_handler $handler)
 {
     $syntax = substr($match, 2, -2);
     // strip markup
     $replacers = explode('|', $syntax);
     $syntax = array_shift($replacers);
     list($syntax, $flags) = explode('&', $syntax, 2);
     // break the pattern up into its parts
     list($mode, $page, $sect) = preg_split('/>|#/u', $syntax, 3);
     $newpage = $handler->adaptRelativeId($page);
     if ($newpage == $page) {
         return $match;
     } else {
         $result = '{{' . $mode . '>' . $newpage;
         if ($sect) {
             $result .= '#' . $sect;
         }
         if ($flags) {
             $result .= '&' . $flags;
         }
         if ($replacers) {
             $result .= '|' . $replacers;
         }
         $result .= '}}';
         return $result;
     }
 }