Core
3.2
PHP API documentation
Main Page
Related Pages
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
PU_test_dcp_getDocAnchor.php
Go to the documentation of this file.
1
<?php
2
/*
3
* @author Anakeen
4
* @package FDL
5
*/
6
7
namespace
Dcp\Pu;
8
/**
9
* @author Anakeen
10
* @package Dcp\Pu
11
*/
12
13
require_once
'PU_testcase_dcp_commonfamily.php'
;
14
require_once
'Lib.Main.php'
;
15
16
class
TestGetDocAnchor
extends
TestCaseDcpCommonFamily
17
{
18
public
$famName
=
"TST_TITLE"
;
19
/**
20
* import TST_TITLE family
21
* @static
22
* @return string
23
*/
24
protected
static
function
getCommonImportFile
()
25
{
26
return
"PU_data_dcp_getdocanchor.ods"
;
27
}
28
/**
29
* @dataProvider data_getDocAnchorMail
30
*/
31
public
function
test_getDocAnchorMail
(
$data
)
32
{
33
$action
= self::getAction();
34
35
foreach
(
$data
[
'params'
] as
$param
) {
36
\ApplicationParameterManager::setCommonParameterValue
($param[
'app'
], $param[
'name'
], $param[
'value'
]);
37
}
38
initMainVolatileParam
(
$action
->parent);
39
40
$doc
=
new_Doc
(
self::$dbaccess
,
$data
[
'doc'
]);
41
$this->assertTrue(is_object(
$doc
) , sprintf(
"Could not get document with id '%s'."
,
$data
[
'doc'
]));
42
43
$data
[
'expected_href'
] = str_replace(
'%ID%'
,
$doc
->id,
$data
[
'expected_href'
]);
44
45
$anchor =
$doc
->getDocAnchor(
$doc
->id,
'mail'
);
46
$this->assertTrue(preg_match(
'/href=([\'"])(?P<href>.*?)\1/'
, $anchor, $m) === 1, sprintf(
"Could not find href='...' in anchor '%s'."
, $anchor));
47
$href = $m[
'href'
];
48
$this->assertTrue($href ==
$data
[
'expected_href'
], sprintf(
"Unexpected href '%s' (expecting '%s') in anchor '%s'."
, $href,
$data
[
'expected_href'
], $anchor));
49
}
50
51
public
function
data_getDocAnchorMail
()
52
{
53
return
array(
54
array(
55
array(
56
"doc"
=>
"TST_GETDOCANCHOR_1"
,
57
"params"
=> array(
58
array(
59
"app"
=>
"CORE"
,
60
"name"
=>
"CORE_MAILACTION"
,
61
"value"
=>
""
62
) ,
63
array(
64
"app"
=>
"CORE"
,
65
"name"
=>
"CORE_URLINDEX"
,
66
"value"
=>
"http://www1.example.net/"
67
)
68
) ,
69
"expected_href"
=>
"http://www1.example.net/?app=FDL&action=OPENDOC&mode=view&id=%ID%&latest=Y"
70
)
71
) ,
72
array(
73
array(
74
"doc"
=>
"TST_GETDOCANCHOR_1"
,
75
"params"
=> array(
76
array(
77
"app"
=>
"CORE"
,
78
"name"
=>
"CORE_MAILACTION"
,
79
"value"
=>
"http://www2.example.net/?app=FOO&action=BAR"
80
) ,
81
array(
82
"app"
=>
"CORE"
,
83
"name"
=>
"CORE_URLINDEX"
,
84
"value"
=>
""
85
)
86
) ,
87
"expected_href"
=>
"http://www2.example.net/?app=FOO&action=BAR&id=%ID%&latest=Y"
88
)
89
)
90
);
91
}
92
}
Dcp\Pu\TestCaseDcpCommonFamily
Definition:
PU_testcase_dcp_commonfamily.php:15
Dcp\Pu\TestGetDocAnchor\$famName
$famName
Definition:
PU_test_dcp_getDocAnchor.php:18
Dcp\Pu\TestGetDocAnchor\test_getDocAnchorMail
test_getDocAnchorMail($data)
Definition:
PU_test_dcp_getDocAnchor.php:31
$action
global $action
Definition:
accountRefreshGroup.php:16
Dcp\Pu\TestGetDocAnchor\getCommonImportFile
static getCommonImportFile()
Definition:
PU_test_dcp_getDocAnchor.php:24
initMainVolatileParam
initMainVolatileParam(Application &$core, Session &$session=null)
Definition:
Lib.Main.php:244
ApplicationParameterManager\setCommonParameterValue
static setCommonParameterValue($application, $parameterName, $value)
Definition:
Class.ApplicationParameterManager.php:190
Dcp\Pu\TestGetDocAnchor
Definition:
PU_test_dcp_getDocAnchor.php:16
Dcp\Pu\TestGetDocAnchor\data_getDocAnchorMail
data_getDocAnchorMail()
Definition:
PU_test_dcp_getDocAnchor.php:51
new_Doc
new_Doc($dbaccess, $id= '', $latest=false)
Definition:
freedom_util.php:119
$dbaccess
$dbaccess
Definition:
checkVault.php:17
$param
$param
Definition:
import_size.php:31
$doc
$doc
Definition:
SetDocVaultIndex.php:39
$data
$data
Definition:
fdl_sendmail.php:40
← centre documentaire
© anakeen