abstract class AbstractHandlerTest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/css-selector/Tests/Parser/Handler/AbstractHandlerTest.php \Symfony\Component\CssSelector\Tests\Parser\Handler\AbstractHandlerTest
@author Jean-François Simon <contact@jfsimon.fr>
Hierarchy
- class \Symfony\Component\CssSelector\Tests\Parser\Handler\AbstractHandlerTest extends \Symfony\Component\CssSelector\Tests\Parser\Handler\PHPUnit_Framework_TestCase
Expanded class hierarchy of AbstractHandlerTest
File
- vendor/
symfony/ css-selector/ Tests/ Parser/ Handler/ AbstractHandlerTest.php, line 21
Namespace
Symfony\Component\CssSelector\Tests\Parser\HandlerView source
abstract class AbstractHandlerTest extends \PHPUnit_Framework_TestCase {
/** @dataProvider getHandleValueTestData */
public function testHandleValue($value, Token $expectedToken, $remainingContent) {
$reader = new Reader($value);
$stream = new TokenStream();
$this
->assertTrue($this
->generateHandler()
->handle($reader, $stream));
$this
->assertEquals($expectedToken, $stream
->getNext());
$this
->assertRemainingContent($reader, $remainingContent);
}
/** @dataProvider getDontHandleValueTestData */
public function testDontHandleValue($value) {
$reader = new Reader($value);
$stream = new TokenStream();
$this
->assertFalse($this
->generateHandler()
->handle($reader, $stream));
$this
->assertStreamEmpty($stream);
$this
->assertRemainingContent($reader, $value);
}
public abstract function getHandleValueTestData();
public abstract function getDontHandleValueTestData();
protected abstract function generateHandler();
protected function assertStreamEmpty(TokenStream $stream) {
$property = new \ReflectionProperty($stream, 'tokens');
$property
->setAccessible(true);
$this
->assertEquals(array(), $property
->getValue($stream));
}
protected function assertRemainingContent(Reader $reader, $remainingContent) {
if ('' === $remainingContent) {
$this
->assertEquals(0, $reader
->getRemainingLength());
$this
->assertTrue($reader
->isEOF());
}
else {
$this
->assertEquals(strlen($remainingContent), $reader
->getRemainingLength());
$this
->assertEquals(0, $reader
->getOffset($remainingContent));
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AbstractHandlerTest:: |
protected | function | ||
AbstractHandlerTest:: |
protected | function | ||
AbstractHandlerTest:: |
abstract protected | function | 6 | |
AbstractHandlerTest:: |
abstract public | function | 6 | |
AbstractHandlerTest:: |
abstract public | function | 6 | |
AbstractHandlerTest:: |
public | function | @dataProvider getDontHandleValueTestData | |
AbstractHandlerTest:: |
public | function | @dataProvider getHandleValueTestData | 1 |