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