1
|
|
|
<?php |
2
|
|
|
use Hamcrest\Matcher; |
3
|
|
|
|
4
|
|
|
if (!function_exists('htmlPiece')) { |
5
|
|
|
/** |
6
|
|
|
* @param mixed $elementMatcher |
7
|
|
|
* |
8
|
|
|
* @return \WMDE\HamcrestHtml\HtmlMatcher |
9
|
|
|
*/ |
10
|
|
|
function htmlPiece(Matcher $elementMatcher = null) { |
11
|
31 |
|
return \WMDE\HamcrestHtml\HtmlMatcher::htmlPiece($elementMatcher); |
12
|
|
|
} |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
if (!function_exists('havingRootElement')) { |
16
|
|
|
function havingRootElement(Matcher $matcher = null) { |
17
|
1 |
|
return \WMDE\HamcrestHtml\RootElementMatcher::havingRootElement($matcher); |
18
|
|
|
} |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
if (!function_exists('havingDirectChild')) { |
22
|
|
|
function havingDirectChild(Matcher $elementMatcher = null) { |
23
|
|
|
return \WMDE\HamcrestHtml\DirectChildElementMatcher::havingDirectChild($elementMatcher); |
24
|
|
|
} |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
if (!function_exists('havingChild')) { |
28
|
|
|
function havingChild(Matcher $elementMatcher = null) { |
29
|
|
|
return \WMDE\HamcrestHtml\ChildElementMatcher::havingChild($elementMatcher); |
30
|
|
|
} |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
if (!function_exists('withTagName')) { |
34
|
|
|
/** |
35
|
|
|
* @param Matcher|string $tagName |
36
|
|
|
* |
37
|
|
|
* @return \WMDE\HamcrestHtml\TagNameMatcher |
38
|
|
|
*/ |
39
|
|
|
function withTagName($tagName) { |
40
|
|
|
return \WMDE\HamcrestHtml\TagNameMatcher::withTagName($tagName); |
41
|
|
|
} |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
if (!function_exists('withAttribute')) { |
45
|
|
|
/** |
46
|
|
|
* @param Matcher|string $attributeName |
47
|
|
|
* |
48
|
|
|
* @return \WMDE\HamcrestHtml\AttributeMatcher |
49
|
|
|
*/ |
50
|
|
|
function withAttribute($attributeName) { |
51
|
|
|
return \WMDE\HamcrestHtml\AttributeMatcher::withAttribute($attributeName); |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
if (!function_exists('withClass')) { |
56
|
|
|
/** |
57
|
|
|
* @param Matcher|string $class |
58
|
|
|
* |
59
|
|
|
* @return \WMDE\HamcrestHtml\ClassMatcher |
60
|
|
|
*/ |
61
|
|
|
function withClass($class) { |
62
|
|
|
//TODO don't allow to call with empty string |
63
|
|
|
|
64
|
|
|
return \WMDE\HamcrestHtml\ClassMatcher::withClass($class); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
if (!function_exists('havingTextContents')) { |
69
|
|
|
/** |
70
|
|
|
* @param Matcher|string $text |
71
|
|
|
* |
72
|
|
|
* @return \WMDE\HamcrestHtml\TextContentsMatcher |
73
|
|
|
*/ |
74
|
|
|
function havingTextContents($text) { |
75
|
|
|
return \WMDE\HamcrestHtml\TextContentsMatcher::havingTextContents($text); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
if (!function_exists('tagMatchingOutline')) { |
80
|
|
|
/** |
81
|
|
|
* @param string $htmlOutline |
82
|
|
|
* |
83
|
|
|
* @return \WMDE\HamcrestHtml\ComplexTagMatcher |
84
|
|
|
*/ |
85
|
|
|
function tagMatchingOutline($htmlOutline) { |
86
|
|
|
return \WMDE\HamcrestHtml\ComplexTagMatcher::tagMatchingOutline($htmlOutline); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
if (!function_exists('containsStringIgnoringWhiteSpace')) { |
91
|
|
|
/** |
92
|
|
|
* @param $substring |
93
|
|
|
* |
94
|
|
|
* @return \WMDE\HamcrestHtml\StringContainsIgnoringWhiteSpace |
95
|
|
|
*/ |
96
|
|
|
function containsStringIgnoringWhiteSpace($substring) { |
97
|
9 |
|
return \WMDE\HamcrestHtml\StringContainsIgnoringWhiteSpace::containsStringIgnoringWhiteSpace($substring); |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|