class ContentTest in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/behat/mink/driver-testsuite/tests/Basic/ContentTest.php \Behat\Mink\Tests\Driver\Basic\ContentTest
Hierarchy
- class \Behat\Mink\Tests\Driver\TestCase extends \Behat\Mink\Tests\Driver\PHPUnit_Framework_TestCase
- class \Behat\Mink\Tests\Driver\Basic\ContentTest
Expanded class hierarchy of ContentTest
File
- vendor/
behat/ mink/ driver-testsuite/ tests/ Basic/ ContentTest.php, line 7
Namespace
Behat\Mink\Tests\Driver\BasicView source
class ContentTest extends TestCase {
public function testOuterHtml() {
$this
->getSession()
->visit($this
->pathTo('/index.html'));
$element = $this
->getAssertSession()
->elementExists('css', '.travers');
$this
->assertEquals("<div class=\"travers\">\n <div class=\"sub\">el1</div>\n" . " <div class=\"sub\">el2</div>\n <div class=\"sub\">\n" . " <a href=\"some_url\">some <strong>deep</strong> url</a>\n" . " </div>\n </div>", $element
->getOuterHtml());
}
public function testDumpingEmptyElements() {
$this
->getSession()
->visit($this
->pathTo('/index.html'));
$element = $this
->getAssertSession()
->elementExists('css', '#empty');
$this
->assertEquals('An empty <em></em> tag should be rendered with both open and close tags.', trim($element
->getHtml()));
}
/**
* @dataProvider getAttributeDataProvider
*/
public function testGetAttribute($attributeName, $attributeValue) {
$this
->getSession()
->visit($this
->pathTo('/index.html'));
$element = $this
->getSession()
->getPage()
->findById('attr-elem[' . $attributeName . ']');
$this
->assertNotNull($element);
$this
->assertSame($attributeValue, $element
->getAttribute($attributeName));
}
public function getAttributeDataProvider() {
return array(
array(
'with-value',
'some-value',
),
array(
'without-value',
'',
),
array(
'with-empty-value',
'',
),
array(
'with-missing',
null,
),
);
}
public function testJson() {
$this
->getSession()
->visit($this
->pathTo('/json.php'));
$this
->assertContains('{"key1":"val1","key2":234,"key3":[1,2,3]}', $this
->getSession()
->getPage()
->getContent());
}
public function testHtmlDecodingNotPerformed() {
$session = $this
->getSession();
$webAssert = $this
->getAssertSession();
$session
->visit($this
->pathTo('/html_decoding.html'));
$page = $session
->getPage();
$span = $webAssert
->elementExists('css', 'span');
$input = $webAssert
->elementExists('css', 'input');
$expectedHtml = '<span custom-attr="&">some text</span>';
$this
->assertContains($expectedHtml, $page
->getHtml(), '.innerHTML is returned as-is');
$this
->assertContains($expectedHtml, $page
->getContent(), '.outerHTML is returned as-is');
$this
->assertEquals('&', $span
->getAttribute('custom-attr'), '.getAttribute value is decoded');
$this
->assertEquals('&', $input
->getAttribute('value'), '.getAttribute value is decoded');
$this
->assertEquals('&', $input
->getValue(), 'node value is decoded');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentTest:: |
public | function | ||
ContentTest:: |
public | function | ||
ContentTest:: |
public | function | @dataProvider getAttributeDataProvider | |
ContentTest:: |
public | function | ||
ContentTest:: |
public | function | ||
ContentTest:: |
public | function | ||
TestCase:: |
private static | property | ||
TestCase:: |
private static | property | Mink session manager. | |
TestCase:: |
protected | function | ||
TestCase:: |
protected | function | Creates a new driver instance. | |
TestCase:: |
protected | function | ||
TestCase:: |
protected | function | Returns assert session. | |
TestCase:: |
private static | function | ||
TestCase:: |
protected | function | Returns session. | |
TestCase:: |
protected | function | Map remote file path. | |
TestCase:: |
protected | function | ||
TestCase:: |
protected | function | ||
TestCase:: |
protected | function | Waits for a condition to be true, considering than it is successful for drivers not supporting wait(). | |
TestCase:: |
public static | function | Initializes the test case. | |
TestCase:: |
protected | function |