assertEqual(get_parent_contexts($context), array()); $context = new stdClass; $context->path = '/1/25'; $this->assertEqual(get_parent_contexts($context), array(1)); $context = new stdClass; $context->path = '/1/123/234/345/456'; $this->assertEqual(get_parent_contexts($context), array(345, 234, 123, 1)); } function test_get_parent_contextid() { $context = get_context_instance(CONTEXT_SYSTEM); $this->assertFalse(get_parent_contextid($context)); $context = new stdClass; $context->path = '/1/25'; $this->assertEqual(get_parent_contextid($context), 1); $context = new stdClass; $context->path = '/1/123/234/345/456'; $this->assertEqual(get_parent_contextid($context), 345); } } ?>