示例#1
0
 public function test_convert_path()
 {
     $path = new convert_path('foo_bar', '/ROOT/THINGS/FOO/BAR');
     $this->assertEquals('foo_bar', $path->get_name());
     $this->assertEquals('/ROOT/THINGS/FOO/BAR', $path->get_path());
     $this->assertEquals('process_foo_bar', $path->get_processing_method());
     $this->assertEquals('on_foo_bar_start', $path->get_start_method());
     $this->assertEquals('on_foo_bar_end', $path->get_end_method());
 }
示例#2
0
文件: lib.php 项目: ncsu-delta/moodle
    /**
     * Helper method used by {@link self::register_handler()}
     *
     * @param convert_path $pelement path element
     * @param array of convert_path instances
     * @return bool true if grouped parent was found, false otherwise
     */
    protected function grouped_parent_exists($pelement, $elements) {

        foreach ($elements as $element) {
            if ($pelement->get_path() == $element->get_path()) {
                // don't compare against itself
                continue;
            }
            // if the element is grouped and it is a parent of pelement, return true
            if ($element->is_grouped() and strpos($pelement->get_path() .  '/', $element->get_path()) === 0) {
                return true;
            }
        }

        // no grouped parent found
        return false;
    }