@@ -8,40 +8,40 @@ |
||
8 | 8 | |
9 | 9 | class TagNameMatcher extends TagMatcher { |
10 | 10 | |
11 | - /** |
|
12 | - * @var Matcher |
|
13 | - */ |
|
14 | - private $tagNameMatcher; |
|
15 | - |
|
16 | - /** |
|
17 | - * @param Matcher|string $tagName |
|
18 | - * |
|
19 | - * @return self |
|
20 | - */ |
|
21 | - public static function withTagName( $tagName ) { |
|
22 | - return new static( Util::wrapValueWithIsEqual( $tagName ) ); |
|
23 | - } |
|
24 | - |
|
25 | - public function __construct( Matcher $tagNameMatcher ) { |
|
26 | - parent::__construct(); |
|
27 | - $this->tagNameMatcher = $tagNameMatcher; |
|
28 | - } |
|
29 | - |
|
30 | - public function describeTo( Description $description ) { |
|
31 | - $description->appendText( 'with tag name ' ) |
|
32 | - ->appendDescriptionOf( $this->tagNameMatcher ); |
|
33 | - } |
|
34 | - |
|
35 | - /** |
|
36 | - * @param \DOMElement $item |
|
37 | - * @param Description $mismatchDescription |
|
38 | - * |
|
39 | - * @return bool |
|
40 | - */ |
|
41 | - protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) { |
|
42 | - $mismatchDescription->appendText( 'tag name ' ); |
|
43 | - $this->tagNameMatcher->describeMismatch( $item->tagName, $mismatchDescription ); |
|
44 | - return $this->tagNameMatcher->matches( $item->tagName ); |
|
45 | - } |
|
11 | + /** |
|
12 | + * @var Matcher |
|
13 | + */ |
|
14 | + private $tagNameMatcher; |
|
15 | + |
|
16 | + /** |
|
17 | + * @param Matcher|string $tagName |
|
18 | + * |
|
19 | + * @return self |
|
20 | + */ |
|
21 | + public static function withTagName( $tagName ) { |
|
22 | + return new static( Util::wrapValueWithIsEqual( $tagName ) ); |
|
23 | + } |
|
24 | + |
|
25 | + public function __construct( Matcher $tagNameMatcher ) { |
|
26 | + parent::__construct(); |
|
27 | + $this->tagNameMatcher = $tagNameMatcher; |
|
28 | + } |
|
29 | + |
|
30 | + public function describeTo( Description $description ) { |
|
31 | + $description->appendText( 'with tag name ' ) |
|
32 | + ->appendDescriptionOf( $this->tagNameMatcher ); |
|
33 | + } |
|
34 | + |
|
35 | + /** |
|
36 | + * @param \DOMElement $item |
|
37 | + * @param Description $mismatchDescription |
|
38 | + * |
|
39 | + * @return bool |
|
40 | + */ |
|
41 | + protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) { |
|
42 | + $mismatchDescription->appendText( 'tag name ' ); |
|
43 | + $this->tagNameMatcher->describeMismatch( $item->tagName, $mismatchDescription ); |
|
44 | + return $this->tagNameMatcher->matches( $item->tagName ); |
|
45 | + } |
|
46 | 46 | |
47 | 47 | } |
@@ -8,37 +8,37 @@ |
||
8 | 8 | |
9 | 9 | class TextContentsMatcher extends TagMatcher { |
10 | 10 | |
11 | - /** |
|
12 | - * @var Matcher |
|
13 | - */ |
|
14 | - private $matcher; |
|
15 | - |
|
16 | - /** |
|
17 | - * @param Matcher|string $text |
|
18 | - * |
|
19 | - * @return self |
|
20 | - */ |
|
21 | - public static function havingTextContents( $text ) { |
|
22 | - return new static( Util::wrapValueWithIsEqual( $text ) ); |
|
23 | - } |
|
24 | - |
|
25 | - public function __construct( Matcher $matcher ) { |
|
26 | - parent::__construct(); |
|
27 | - $this->matcher = $matcher; |
|
28 | - } |
|
29 | - |
|
30 | - public function describeTo( Description $description ) { |
|
31 | - $description->appendText( 'having text contents ' )->appendDescriptionOf( $this->matcher ); |
|
32 | - } |
|
33 | - |
|
34 | - /** |
|
35 | - * @param \DOMElement $item |
|
36 | - * @param Description $mismatchDescription |
|
37 | - * |
|
38 | - * @return bool |
|
39 | - */ |
|
40 | - protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) { |
|
41 | - return $this->matcher->matches( $item->textContent ); |
|
42 | - } |
|
11 | + /** |
|
12 | + * @var Matcher |
|
13 | + */ |
|
14 | + private $matcher; |
|
15 | + |
|
16 | + /** |
|
17 | + * @param Matcher|string $text |
|
18 | + * |
|
19 | + * @return self |
|
20 | + */ |
|
21 | + public static function havingTextContents( $text ) { |
|
22 | + return new static( Util::wrapValueWithIsEqual( $text ) ); |
|
23 | + } |
|
24 | + |
|
25 | + public function __construct( Matcher $matcher ) { |
|
26 | + parent::__construct(); |
|
27 | + $this->matcher = $matcher; |
|
28 | + } |
|
29 | + |
|
30 | + public function describeTo( Description $description ) { |
|
31 | + $description->appendText( 'having text contents ' )->appendDescriptionOf( $this->matcher ); |
|
32 | + } |
|
33 | + |
|
34 | + /** |
|
35 | + * @param \DOMElement $item |
|
36 | + * @param Description $mismatchDescription |
|
37 | + * |
|
38 | + * @return bool |
|
39 | + */ |
|
40 | + protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) { |
|
41 | + return $this->matcher->matches( $item->textContent ); |
|
42 | + } |
|
43 | 43 | |
44 | 44 | } |