1<?php
2
3/**
4 * Every parameters and page description for each test case are here
5 * TODO? May be move the test case path to their respective test cases ?
6 *
7 * @group plugin_404manager
8 * @group plugins
9 */
10class constant_parameters
11{
12
13    static $MANAGER404_NAMESPACE;
14    const PATH_SEPARATOR = ':';
15
16
17    static $PAGE_EXIST_ID;
18    static $PAGE_DOES_NOT_EXIST_ID;
19
20    static $PAGE_DOES_NOT_EXIST_NO_REDIRECTION_ID;
21
22    static $DIR_RESOURCES;
23
24    static $INFO_PLUGIN;
25    static $PLUGIN_BASE;
26    static $PAGE_REDIRECTED_TO_EXTERNAL_WEBSITE;
27
28    static $EXPLICIT_REDIRECT_PAGE_SOURCE;
29    static $EXPLICIT_REDIRECT_PAGE_TARGET;
30
31    static $REDIRECT_BEST_PAGE_NAME_SOURCE;
32    static $REDIRECT_BEST_PAGE_NAME_TARGET_SAME_BRANCH;
33    static $REDIRECT_BEST_PAGE_NAME_TARGET_OTHER_BRANCH;
34
35
36    static $REDIRECT_TO_NAMESPACE_START_PAGE_SOURCE;
37    static $REDIRECT_TO_NAMESPACE_START_PAGE_BAD_TARGET;
38    static $REDIRECT_TO_NAMESPACE_START_PAGE_GOOD_TARGET;
39
40    static $REDIRECT_TO_NAMESPACE_START_PAGE_PARENT_SOURCE;
41    static $REDIRECT_TO_NAMESPACE_START_PAGE_PARENT_BAD_TARGET;
42    static $REDIRECT_TO_NAMESPACE_START_PAGE_PARENT_GOOD_TARGET;
43
44    // Page ID and namespace must be in lowercase
45    const NS_PAGE = 'ns_attached_to_page';
46    const NS_BRANCH_1 = 'ns_branch1';
47    const NS_BRANCH_2 = 'ns_branch2';
48    const NS_BRANCH_WITH_PARENT_NAME_START_PAGE = 'ns_branch3';
49
50
51    static function init()
52    {
53        $pluginInfoFile = __DIR__ . '/../plugin.info.txt';
54        self::$DIR_RESOURCES = __DIR__ . '/../_testResources';
55
56        self::$INFO_PLUGIN = confToHash($pluginInfoFile);
57        self::$PLUGIN_BASE = self::$INFO_PLUGIN['base'];
58
59        self::$MANAGER404_NAMESPACE = self::$INFO_PLUGIN['base'];
60
61        self::$PAGE_EXIST_ID = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . 'page_exist';
62        self::$PAGE_DOES_NOT_EXIST_ID = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . 'page_does_not_exist';
63        self::$PAGE_DOES_NOT_EXIST_NO_REDIRECTION_ID = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . 'page_does_not_exist_no_redirection';
64
65        self::$PAGE_REDIRECTED_TO_EXTERNAL_WEBSITE = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . 'redirect_to_external_website';
66
67        self::$EXPLICIT_REDIRECT_PAGE_SOURCE = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . 'explicit_redirect_to_internal_page_source';
68        self::$EXPLICIT_REDIRECT_PAGE_TARGET = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . 'explicit_redirect_to_internal_page_target';
69
70        self::$REDIRECT_BEST_PAGE_NAME_SOURCE = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . self::NS_BRANCH_1 . self::PATH_SEPARATOR . self::NS_PAGE . self::PATH_SEPARATOR .'redirect_best_page_name';
71        // Without Level1
72        self::$REDIRECT_BEST_PAGE_NAME_TARGET_SAME_BRANCH = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . self::NS_PAGE . self::PATH_SEPARATOR .'redirect_best_page_name';
73        self::$REDIRECT_BEST_PAGE_NAME_TARGET_OTHER_BRANCH = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . self::NS_BRANCH_2 . self::PATH_SEPARATOR . self::NS_PAGE . self::PATH_SEPARATOR .'redirect_best_page_name';
74
75        // Set of 3 pages, when a page has an homonym (same page name) but within another completly differents path (the name of the path have nothing in common)
76        // the 404 manager must redirect to the start page of the namespace.
77        self::$REDIRECT_TO_NAMESPACE_START_PAGE_SOURCE = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . self::NS_BRANCH_1 . self::PATH_SEPARATOR .'redirect_to_namespace_start_page';
78        self::$REDIRECT_TO_NAMESPACE_START_PAGE_BAD_TARGET = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . self::NS_BRANCH_2 . self::PATH_SEPARATOR  .'redirect_to_namespace_start_page';
79        self::$REDIRECT_TO_NAMESPACE_START_PAGE_GOOD_TARGET = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . self::NS_BRANCH_1 . self::PATH_SEPARATOR  .'start';
80
81
82        // Set of 3 pages, when a page has an homonym (same page name) but within another completly differents path (the name of the path have nothing in common)
83        // the 404 manager must redirect to the start page of the namespace.
84        self::$REDIRECT_TO_NAMESPACE_START_PAGE_PARENT_SOURCE = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . self::NS_BRANCH_WITH_PARENT_NAME_START_PAGE . self::PATH_SEPARATOR .'redirect_to_namespace_start_page';
85        self::$REDIRECT_TO_NAMESPACE_START_PAGE_PARENT_BAD_TARGET = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . self::NS_BRANCH_2 . self::PATH_SEPARATOR  .'redirect_to_namespace_start_page';
86        self::$REDIRECT_TO_NAMESPACE_START_PAGE_PARENT_GOOD_TARGET = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . self::NS_BRANCH_WITH_PARENT_NAME_START_PAGE . self::PATH_SEPARATOR  . self::NS_BRANCH_WITH_PARENT_NAME_START_PAGE;
87
88
89
90    }
91}
92
93constant_parameters::init();
94