Page MenuHomeWickedGov Phorge

TextContentsMatcher.php
No OneTemporary

Size
919 B
Referenced Files
None
Subscribers
None

TextContentsMatcher.php

<?php
namespace WMDE\HamcrestHtml;
use Hamcrest\Description;
use Hamcrest\Matcher;
use Hamcrest\Util;
class TextContentsMatcher extends TagMatcher {
/**
* @var Matcher
*/
private $matcher;
/**
* @param Matcher|string $text
*
* @return self
*/
public static function havingTextContents( $text ) {
return new static( Util::wrapValueWithIsEqual( $text ) );
}
public function __construct( Matcher $matcher ) {
parent::__construct();
$this->matcher = $matcher;
}
public function describeTo( Description $description ) {
$description->appendText( 'having text contents ' )->appendDescriptionOf( $this->matcher );
}
/**
* @param \DOMElement $item
* @param Description $mismatchDescription
*
* @return bool
*/
protected function matchesSafelyWithDiagnosticDescription(
$item, Description $mismatchDescription
) {
return $this->matcher->matches( $item->textContent );
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Oct 3, 12:48 (2 d, 14 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
0b/91/e9f238bfaf9368c765f2df8f063d
Default Alt Text
TextContentsMatcher.php (919 B)

Event Timeline