Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
64
vendor/behat/mink/driver-testsuite/tests/Basic/BasicAuthTest.php
vendored
Normal file
64
vendor/behat/mink/driver-testsuite/tests/Basic/BasicAuthTest.php
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Basic;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
class BasicAuthTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider setBasicAuthDataProvider
|
||||
*/
|
||||
public function testSetBasicAuth($user, $pass, $pageText)
|
||||
{
|
||||
$session = $this->getSession();
|
||||
|
||||
$session->setBasicAuth($user, $pass);
|
||||
|
||||
$session->visit($this->pathTo('/basic_auth.php'));
|
||||
|
||||
$this->assertContains($pageText, $session->getPage()->getContent());
|
||||
}
|
||||
|
||||
public function setBasicAuthDataProvider()
|
||||
{
|
||||
return array(
|
||||
array('mink-user', 'mink-password', 'is authenticated'),
|
||||
array('', '', 'is not authenticated'),
|
||||
);
|
||||
}
|
||||
|
||||
public function testResetBasicAuth()
|
||||
{
|
||||
$session = $this->getSession();
|
||||
|
||||
$session->setBasicAuth('mink-user', 'mink-password');
|
||||
|
||||
$session->visit($this->pathTo('/basic_auth.php'));
|
||||
|
||||
$this->assertContains('is authenticated', $session->getPage()->getContent());
|
||||
|
||||
$session->setBasicAuth(false);
|
||||
|
||||
$session->visit($this->pathTo('/headers.php'));
|
||||
|
||||
$this->assertNotContains('PHP_AUTH_USER', $session->getPage()->getContent());
|
||||
}
|
||||
|
||||
public function testResetWithBasicAuth()
|
||||
{
|
||||
$session = $this->getSession();
|
||||
|
||||
$session->setBasicAuth('mink-user', 'mink-password');
|
||||
|
||||
$session->visit($this->pathTo('/basic_auth.php'));
|
||||
|
||||
$this->assertContains('is authenticated', $session->getPage()->getContent());
|
||||
|
||||
$session->reset();
|
||||
|
||||
$session->visit($this->pathTo('/headers.php'));
|
||||
|
||||
$this->assertNotContains('PHP_AUTH_USER', $session->getPage()->getContent());
|
||||
}
|
||||
}
|
84
vendor/behat/mink/driver-testsuite/tests/Basic/BestPracticesTest.php
vendored
Normal file
84
vendor/behat/mink/driver-testsuite/tests/Basic/BestPracticesTest.php
vendored
Normal file
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Basic;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
/**
|
||||
* This testcase ensures that the driver implementation follows recommended practices for drivers.
|
||||
*/
|
||||
class BestPracticesTest extends TestCase
|
||||
{
|
||||
public function testExtendsCoreDriver()
|
||||
{
|
||||
$driver = $this->createDriver();
|
||||
|
||||
$this->assertInstanceOf('Behat\Mink\Driver\CoreDriver', $driver);
|
||||
|
||||
return $driver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testExtendsCoreDriver
|
||||
*/
|
||||
public function testImplementFindXpath()
|
||||
{
|
||||
$driver = $this->createDriver();
|
||||
|
||||
$this->assertNotImplementMethod('find', $driver, 'The driver should overwrite `findElementXpaths` rather than `find` for forward compatibility with Mink 2.');
|
||||
$this->assertImplementMethod('findElementXpaths', $driver, 'The driver must be able to find elements.');
|
||||
$this->assertNotImplementMethod('setSession', $driver, 'The driver should not deal with the Session directly for forward compatibility with Mink 2.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideRequiredMethods
|
||||
*/
|
||||
public function testImplementBasicApi($method)
|
||||
{
|
||||
$driver = $this->createDriver();
|
||||
|
||||
$this->assertImplementMethod($method, $driver, 'The driver is unusable when this method is not implemented.');
|
||||
}
|
||||
|
||||
public function provideRequiredMethods()
|
||||
{
|
||||
return array(
|
||||
array('start'),
|
||||
array('isStarted'),
|
||||
array('stop'),
|
||||
array('reset'),
|
||||
array('visit'),
|
||||
array('getCurrentUrl'),
|
||||
array('getContent'),
|
||||
array('click'),
|
||||
);
|
||||
}
|
||||
|
||||
private function assertImplementMethod($method, $object, $reason = '')
|
||||
{
|
||||
$ref = new \ReflectionClass(get_class($object));
|
||||
$refMethod = $ref->getMethod($method);
|
||||
|
||||
$message = sprintf('The driver should implement the `%s` method.', $method);
|
||||
|
||||
if ('' !== $reason) {
|
||||
$message .= ' '.$reason;
|
||||
}
|
||||
|
||||
$this->assertSame($ref->name, $refMethod->getDeclaringClass()->name, $message);
|
||||
}
|
||||
|
||||
private function assertNotImplementMethod($method, $object, $reason = '')
|
||||
{
|
||||
$ref = new \ReflectionClass(get_class($object));
|
||||
$refMethod = $ref->getMethod($method);
|
||||
|
||||
$message = sprintf('The driver should not implement the `%s` method.', $method);
|
||||
|
||||
if ('' !== $reason) {
|
||||
$message .= ' '.$reason;
|
||||
}
|
||||
|
||||
$this->assertNotSame($ref->name, $refMethod->getDeclaringClass()->name, $message);
|
||||
}
|
||||
}
|
86
vendor/behat/mink/driver-testsuite/tests/Basic/ContentTest.php
vendored
Normal file
86
vendor/behat/mink/driver-testsuite/tests/Basic/ContentTest.php
vendored
Normal file
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Basic;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
168
vendor/behat/mink/driver-testsuite/tests/Basic/CookieTest.php
vendored
Normal file
168
vendor/behat/mink/driver-testsuite/tests/Basic/CookieTest.php
vendored
Normal file
|
@ -0,0 +1,168 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Basic;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
class CookieTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* test cookie decoding.
|
||||
*
|
||||
* @group issue140
|
||||
*/
|
||||
public function testIssue140()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/issue140.php'));
|
||||
|
||||
$this->getSession()->getPage()->fillField('cookie_value', 'some:value;');
|
||||
$this->getSession()->getPage()->pressButton('Set cookie');
|
||||
|
||||
$this->getSession()->visit($this->pathTo('/issue140.php?show_value'));
|
||||
$this->assertEquals('some:value;', $this->getSession()->getCookie('tc'));
|
||||
$this->assertEquals('some:value;', $this->getSession()->getPage()->getText());
|
||||
}
|
||||
|
||||
public function testCookie()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/cookie_page2.php'));
|
||||
$this->assertContains('Previous cookie: NO', $this->getSession()->getPage()->getText());
|
||||
$this->assertNull($this->getSession()->getCookie('srvr_cookie'));
|
||||
|
||||
$this->getSession()->setCookie('srvr_cookie', 'client cookie set');
|
||||
$this->getSession()->reload();
|
||||
$this->assertContains('Previous cookie: client cookie set', $this->getSession()->getPage()->getText());
|
||||
$this->assertEquals('client cookie set', $this->getSession()->getCookie('srvr_cookie'));
|
||||
|
||||
$this->getSession()->setCookie('srvr_cookie', null);
|
||||
$this->getSession()->reload();
|
||||
$this->assertContains('Previous cookie: NO', $this->getSession()->getPage()->getText());
|
||||
|
||||
$this->getSession()->visit($this->pathTo('/cookie_page1.php'));
|
||||
$this->getSession()->visit($this->pathTo('/cookie_page2.php'));
|
||||
|
||||
$this->assertContains('Previous cookie: srv_var_is_set', $this->getSession()->getPage()->getText());
|
||||
$this->getSession()->setCookie('srvr_cookie', null);
|
||||
$this->getSession()->reload();
|
||||
$this->assertContains('Previous cookie: NO', $this->getSession()->getPage()->getText());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider cookieWithPathsDataProvider
|
||||
*/
|
||||
public function testCookieWithPaths($cookieRemovalMode)
|
||||
{
|
||||
// start clean
|
||||
$session = $this->getSession();
|
||||
$session->visit($this->pathTo('/sub-folder/cookie_page2.php'));
|
||||
$this->assertContains('Previous cookie: NO', $session->getPage()->getText());
|
||||
|
||||
// cookie from root path is accessible in sub-folder
|
||||
$session->visit($this->pathTo('/cookie_page1.php'));
|
||||
$session->visit($this->pathTo('/sub-folder/cookie_page2.php'));
|
||||
$this->assertContains('Previous cookie: srv_var_is_set', $session->getPage()->getText());
|
||||
|
||||
// cookie from sub-folder overrides cookie from root path
|
||||
$session->visit($this->pathTo('/sub-folder/cookie_page1.php'));
|
||||
$session->visit($this->pathTo('/sub-folder/cookie_page2.php'));
|
||||
$this->assertContains('Previous cookie: srv_var_is_set_sub_folder', $session->getPage()->getText());
|
||||
|
||||
if ($cookieRemovalMode == 'session_reset') {
|
||||
$session->reset();
|
||||
} elseif ($cookieRemovalMode == 'cookie_delete') {
|
||||
$session->setCookie('srvr_cookie', null);
|
||||
}
|
||||
|
||||
// cookie is removed from all paths
|
||||
$session->visit($this->pathTo('/sub-folder/cookie_page2.php'));
|
||||
$this->assertContains('Previous cookie: NO', $session->getPage()->getText());
|
||||
}
|
||||
|
||||
public function cookieWithPathsDataProvider()
|
||||
{
|
||||
return array(
|
||||
array('session_reset'),
|
||||
array('cookie_delete'),
|
||||
);
|
||||
}
|
||||
|
||||
public function testReset()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/cookie_page1.php'));
|
||||
$this->getSession()->visit($this->pathTo('/cookie_page2.php'));
|
||||
$this->assertContains('Previous cookie: srv_var_is_set', $this->getSession()->getPage()->getText());
|
||||
|
||||
$this->getSession()->reset();
|
||||
$this->getSession()->visit($this->pathTo('/cookie_page2.php'));
|
||||
|
||||
$this->assertContains('Previous cookie: NO', $this->getSession()->getPage()->getText());
|
||||
|
||||
$this->getSession()->setCookie('srvr_cookie', 'test_cookie');
|
||||
$this->getSession()->visit($this->pathTo('/cookie_page2.php'));
|
||||
$this->assertContains('Previous cookie: test_cookie', $this->getSession()->getPage()->getText());
|
||||
$this->getSession()->reset();
|
||||
$this->getSession()->visit($this->pathTo('/cookie_page2.php'));
|
||||
$this->assertContains('Previous cookie: NO', $this->getSession()->getPage()->getText());
|
||||
|
||||
$this->getSession()->setCookie('client_cookie1', 'some_val');
|
||||
$this->getSession()->setCookie('client_cookie2', 123);
|
||||
$this->getSession()->visit($this->pathTo('/session_test.php'));
|
||||
$this->getSession()->visit($this->pathTo('/cookie_page1.php'));
|
||||
|
||||
$this->getSession()->visit($this->pathTo('/print_cookies.php'));
|
||||
$this->assertContains(
|
||||
"'client_cookie1' = 'some_val'",
|
||||
$this->getSession()->getPage()->getText()
|
||||
);
|
||||
$this->assertContains(
|
||||
"'client_cookie2' = '123'",
|
||||
$this->getSession()->getPage()->getText()
|
||||
);
|
||||
$this->assertContains(
|
||||
"_SESS' = ",
|
||||
$this->getSession()->getPage()->getText()
|
||||
);
|
||||
$this->assertContains(
|
||||
" 'srvr_cookie' = 'srv_var_is_set'",
|
||||
$this->getSession()->getPage()->getText()
|
||||
);
|
||||
|
||||
$this->getSession()->reset();
|
||||
$this->getSession()->visit($this->pathTo('/print_cookies.php'));
|
||||
$this->assertContains('array ( )', $this->getSession()->getPage()->getText());
|
||||
}
|
||||
|
||||
public function testHttpOnlyCookieIsDeleted()
|
||||
{
|
||||
$this->getSession()->restart();
|
||||
$this->getSession()->visit($this->pathTo('/cookie_page3.php'));
|
||||
$this->assertEquals('Has Cookie: false', $this->findById('cookie-status')->getText());
|
||||
|
||||
$this->getSession()->reload();
|
||||
$this->assertEquals('Has Cookie: true', $this->findById('cookie-status')->getText());
|
||||
|
||||
$this->getSession()->restart();
|
||||
$this->getSession()->visit($this->pathTo('/cookie_page3.php'));
|
||||
$this->assertEquals('Has Cookie: false', $this->findById('cookie-status')->getText());
|
||||
}
|
||||
|
||||
public function testSessionPersistsBetweenRequests()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/session_test.php'));
|
||||
$webAssert = $this->getAssertSession();
|
||||
$node = $webAssert->elementExists('css', '#session-id');
|
||||
$sessionId = $node->getText();
|
||||
|
||||
$this->getSession()->visit($this->pathTo('/session_test.php'));
|
||||
$node = $webAssert->elementExists('css', '#session-id');
|
||||
$this->assertEquals($sessionId, $node->getText());
|
||||
|
||||
$this->getSession()->visit($this->pathTo('/session_test.php?login'));
|
||||
$node = $webAssert->elementExists('css', '#session-id');
|
||||
$this->assertNotEquals($sessionId, $newSessionId = $node->getText());
|
||||
|
||||
$this->getSession()->visit($this->pathTo('/session_test.php'));
|
||||
$node = $webAssert->elementExists('css', '#session-id');
|
||||
$this->assertEquals($newSessionId, $node->getText());
|
||||
}
|
||||
}
|
265
vendor/behat/mink/driver-testsuite/tests/Basic/ErrorHandlingTest.php
vendored
Normal file
265
vendor/behat/mink/driver-testsuite/tests/Basic/ErrorHandlingTest.php
vendored
Normal file
|
@ -0,0 +1,265 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Basic;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
/**
|
||||
* @group slow
|
||||
*/
|
||||
class ErrorHandlingTest extends TestCase
|
||||
{
|
||||
const NOT_FOUND_XPATH = '//html/./invalid';
|
||||
|
||||
const NOT_FOUND_EXCEPTION = 'Exception';
|
||||
|
||||
const INVALID_EXCEPTION = 'Exception';
|
||||
|
||||
public function testVisitErrorPage()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/500.php'));
|
||||
|
||||
$this->assertContains(
|
||||
'Sorry, a server error happened',
|
||||
$this->getSession()->getPage()->getContent(),
|
||||
'Drivers allow loading pages with a 500 status code'
|
||||
);
|
||||
}
|
||||
|
||||
public function testCheckInvalidElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
$element = $this->findById('user-name');
|
||||
|
||||
$this->setExpectedException(self::INVALID_EXCEPTION);
|
||||
$this->getSession()->getDriver()->check($element->getXpath());
|
||||
}
|
||||
|
||||
public function testCheckNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->check(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testUncheckInvalidElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
$element = $this->findById('user-name');
|
||||
|
||||
$this->setExpectedException(self::INVALID_EXCEPTION);
|
||||
$this->getSession()->getDriver()->uncheck($element->getXpath());
|
||||
}
|
||||
|
||||
public function testUncheckNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->uncheck(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testSelectOptionInvalidElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
$element = $this->findById('user-name');
|
||||
|
||||
$this->setExpectedException(self::INVALID_EXCEPTION);
|
||||
$this->getSession()->getDriver()->selectOption($element->getXpath(), 'test');
|
||||
}
|
||||
|
||||
public function testSelectOptionNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->selectOption(self::NOT_FOUND_XPATH, 'test');
|
||||
}
|
||||
|
||||
public function testAttachFileInvalidElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
$element = $this->findById('user-name');
|
||||
|
||||
$this->setExpectedException(self::INVALID_EXCEPTION);
|
||||
$this->getSession()->getDriver()->attachFile($element->getXpath(), __FILE__);
|
||||
}
|
||||
|
||||
public function testAttachFileNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->attachFile(self::NOT_FOUND_XPATH, __FILE__);
|
||||
}
|
||||
|
||||
public function testSubmitFormInvalidElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
$element = $this->findById('core');
|
||||
|
||||
$this->setExpectedException(self::INVALID_EXCEPTION);
|
||||
$this->getSession()->getDriver()->submitForm($element->getXpath());
|
||||
}
|
||||
|
||||
public function testSubmitFormNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->submitForm(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testGetTagNameNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->getTagName(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testGetTextNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->getText(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testGetHtmlNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->getHtml(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testGetOuterHtmlNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->getOuterHtml(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testGetValueNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->getValue(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testSetValueNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->setValue(self::NOT_FOUND_XPATH, 'test');
|
||||
}
|
||||
|
||||
public function testIsSelectedNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->isSelected(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testIsCheckedNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->isChecked(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testIsVisibleNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->isVisible(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testClickNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->click(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testDoubleClickNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->doubleClick(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testRightClickNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->rightClick(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testGetAttributeNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->getAttribute(self::NOT_FOUND_XPATH, 'id');
|
||||
}
|
||||
|
||||
public function testMouseOverNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->mouseOver(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testFocusNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->focus(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testBlurNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->blur(self::NOT_FOUND_XPATH);
|
||||
}
|
||||
|
||||
public function testKeyPressNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->keyPress(self::NOT_FOUND_XPATH, 'a');
|
||||
}
|
||||
|
||||
public function testKeyDownNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->keyDown(self::NOT_FOUND_XPATH, 'a');
|
||||
}
|
||||
|
||||
public function testKeyUpNotFoundElement()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->setExpectedException(self::NOT_FOUND_EXCEPTION);
|
||||
$this->getSession()->getDriver()->keyUp(self::NOT_FOUND_XPATH, 'a');
|
||||
}
|
||||
}
|
78
vendor/behat/mink/driver-testsuite/tests/Basic/HeaderTest.php
vendored
Normal file
78
vendor/behat/mink/driver-testsuite/tests/Basic/HeaderTest.php
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Basic;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
class HeaderTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* test referrer.
|
||||
*
|
||||
* @group issue130
|
||||
*/
|
||||
public function testIssue130()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/issue130.php?p=1'));
|
||||
$page = $this->getSession()->getPage();
|
||||
|
||||
$page->clickLink('Go to 2');
|
||||
$this->assertEquals($this->pathTo('/issue130.php?p=1'), $page->getText());
|
||||
}
|
||||
|
||||
public function testHeaders()
|
||||
{
|
||||
$this->getSession()->setRequestHeader('Accept-Language', 'fr');
|
||||
$this->getSession()->visit($this->pathTo('/headers.php'));
|
||||
|
||||
$this->assertContains('[HTTP_ACCEPT_LANGUAGE] => fr', $this->getSession()->getPage()->getContent());
|
||||
}
|
||||
|
||||
public function testSetUserAgent()
|
||||
{
|
||||
$session = $this->getSession();
|
||||
|
||||
$session->setRequestHeader('user-agent', 'foo bar');
|
||||
$session->visit($this->pathTo('/headers.php'));
|
||||
$this->assertContains('[HTTP_USER_AGENT] => foo bar', $session->getPage()->getContent());
|
||||
}
|
||||
|
||||
public function testResetHeaders()
|
||||
{
|
||||
$session = $this->getSession();
|
||||
|
||||
$session->setRequestHeader('X-Mink-Test', 'test');
|
||||
$session->visit($this->pathTo('/headers.php'));
|
||||
|
||||
$this->assertContains(
|
||||
'[HTTP_X_MINK_TEST] => test',
|
||||
$session->getPage()->getContent(),
|
||||
'The custom header should be sent',
|
||||
true
|
||||
);
|
||||
|
||||
$session->reset();
|
||||
$session->visit($this->pathTo('/headers.php'));
|
||||
|
||||
$this->assertNotContains(
|
||||
'[HTTP_X_MINK_TEST] => test',
|
||||
$session->getPage()->getContent(),
|
||||
'The custom header should not be sent after resetting',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
public function testResponseHeaders()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/response_headers.php'));
|
||||
|
||||
$headers = $this->getSession()->getResponseHeaders();
|
||||
|
||||
$lowercasedHeaders = array();
|
||||
foreach ($headers as $name => $value) {
|
||||
$lowercasedHeaders[str_replace('_', '-', strtolower($name))] = $value;
|
||||
}
|
||||
|
||||
$this->assertArrayHasKey('x-mink-test', $lowercasedHeaders);
|
||||
}
|
||||
}
|
27
vendor/behat/mink/driver-testsuite/tests/Basic/IFrameTest.php
vendored
Normal file
27
vendor/behat/mink/driver-testsuite/tests/Basic/IFrameTest.php
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Basic;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
class IFrameTest extends TestCase
|
||||
{
|
||||
public function testIFrame()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/iframe.html'));
|
||||
$webAssert = $this->getAssertSession();
|
||||
|
||||
$el = $webAssert->elementExists('css', '#text');
|
||||
$this->assertSame('Main window div text', $el->getText());
|
||||
|
||||
$this->getSession()->switchToIFrame('subframe');
|
||||
|
||||
$el = $webAssert->elementExists('css', '#text');
|
||||
$this->assertSame('iFrame div text', $el->getText());
|
||||
|
||||
$this->getSession()->switchToIFrame();
|
||||
|
||||
$el = $webAssert->elementExists('css', '#text');
|
||||
$this->assertSame('Main window div text', $el->getText());
|
||||
}
|
||||
}
|
69
vendor/behat/mink/driver-testsuite/tests/Basic/NavigationTest.php
vendored
Normal file
69
vendor/behat/mink/driver-testsuite/tests/Basic/NavigationTest.php
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Basic;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
class NavigationTest extends TestCase
|
||||
{
|
||||
public function testRedirect()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/redirector.php'));
|
||||
$this->assertEquals($this->pathTo('/redirect_destination.html'), $this->getSession()->getCurrentUrl());
|
||||
}
|
||||
|
||||
public function testPageControls()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/randomizer.php'));
|
||||
$number1 = $this->getAssertSession()->elementExists('css', '#number')->getText();
|
||||
|
||||
$this->getSession()->reload();
|
||||
$number2 = $this->getAssertSession()->elementExists('css', '#number')->getText();
|
||||
|
||||
$this->assertNotEquals($number1, $number2);
|
||||
|
||||
$this->getSession()->visit($this->pathTo('/links.html'));
|
||||
$this->getSession()->getPage()->clickLink('Random number page');
|
||||
|
||||
$this->assertEquals($this->pathTo('/randomizer.php'), $this->getSession()->getCurrentUrl());
|
||||
|
||||
$this->getSession()->back();
|
||||
$this->assertEquals($this->pathTo('/links.html'), $this->getSession()->getCurrentUrl());
|
||||
|
||||
$this->getSession()->forward();
|
||||
$this->assertEquals($this->pathTo('/randomizer.php'), $this->getSession()->getCurrentUrl());
|
||||
}
|
||||
|
||||
public function testLinks()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/links.html'));
|
||||
$page = $this->getSession()->getPage();
|
||||
$link = $page->findLink('Redirect me to');
|
||||
|
||||
$this->assertNotNull($link);
|
||||
$this->assertRegExp('/redirector\.php$/', $link->getAttribute('href'));
|
||||
$link->click();
|
||||
|
||||
$this->assertEquals($this->pathTo('/redirect_destination.html'), $this->getSession()->getCurrentUrl());
|
||||
|
||||
$this->getSession()->visit($this->pathTo('/links.html'));
|
||||
$page = $this->getSession()->getPage();
|
||||
$link = $page->findLink('basic form image');
|
||||
|
||||
$this->assertNotNull($link);
|
||||
$this->assertRegExp('/basic_form\.html$/', $link->getAttribute('href'));
|
||||
$link->click();
|
||||
|
||||
$this->assertEquals($this->pathTo('/basic_form.html'), $this->getSession()->getCurrentUrl());
|
||||
|
||||
$this->getSession()->visit($this->pathTo('/links.html'));
|
||||
$page = $this->getSession()->getPage();
|
||||
$link = $page->findLink('Link with a ');
|
||||
|
||||
$this->assertNotNull($link);
|
||||
$this->assertRegExp('/links\.html\?quoted$/', $link->getAttribute('href'));
|
||||
$link->click();
|
||||
|
||||
$this->assertEquals($this->pathTo('/links.html?quoted'), $this->getSession()->getCurrentUrl());
|
||||
}
|
||||
}
|
30
vendor/behat/mink/driver-testsuite/tests/Basic/ScreenshotTest.php
vendored
Normal file
30
vendor/behat/mink/driver-testsuite/tests/Basic/ScreenshotTest.php
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Basic;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
class ScreenshotTest extends TestCase
|
||||
{
|
||||
public function testScreenshot()
|
||||
{
|
||||
if (!extension_loaded('gd')) {
|
||||
$this->markTestSkipped('Testing screenshots requires the GD extension');
|
||||
}
|
||||
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$screenShot = $this->getSession()->getScreenshot();
|
||||
|
||||
$this->assertInternalType('string', $screenShot);
|
||||
$this->assertFalse(base64_decode($screenShot, true), 'The returned screenshot should not be base64-encoded');
|
||||
|
||||
$img = imagecreatefromstring($screenShot);
|
||||
|
||||
if (false === $img) {
|
||||
$this->fail('The screenshot should be a valid image');
|
||||
}
|
||||
|
||||
imagedestroy($img);
|
||||
}
|
||||
}
|
22
vendor/behat/mink/driver-testsuite/tests/Basic/StatusCodeTest.php
vendored
Normal file
22
vendor/behat/mink/driver-testsuite/tests/Basic/StatusCodeTest.php
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Basic;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
class StatusCodeTest extends TestCase
|
||||
{
|
||||
public function testStatuses()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->assertEquals(200, $this->getSession()->getStatusCode());
|
||||
$this->assertEquals($this->pathTo('/index.html'), $this->getSession()->getCurrentUrl());
|
||||
|
||||
$this->getSession()->visit($this->pathTo('/404.php'));
|
||||
|
||||
$this->assertEquals($this->pathTo('/404.php'), $this->getSession()->getCurrentUrl());
|
||||
$this->assertEquals(404, $this->getSession()->getStatusCode());
|
||||
$this->assertEquals('Sorry, page not found', $this->getSession()->getPage()->getContent());
|
||||
}
|
||||
}
|
143
vendor/behat/mink/driver-testsuite/tests/Basic/TraversingTest.php
vendored
Normal file
143
vendor/behat/mink/driver-testsuite/tests/Basic/TraversingTest.php
vendored
Normal file
|
@ -0,0 +1,143 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Basic;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
class TraversingTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* find by label.
|
||||
*
|
||||
* @group issue211
|
||||
*/
|
||||
public function testIssue211()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/issue211.html'));
|
||||
$field = $this->getSession()->getPage()->findField('Téléphone');
|
||||
|
||||
$this->assertNotNull($field);
|
||||
}
|
||||
|
||||
public function testElementsTraversing()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$page = $this->getSession()->getPage();
|
||||
|
||||
$title = $page->find('css', 'h1');
|
||||
$this->assertNotNull($title);
|
||||
$this->assertEquals('Extremely useless page', $title->getText());
|
||||
$this->assertEquals('h1', $title->getTagName());
|
||||
|
||||
$strong = $page->find('xpath', '//div/strong[3]');
|
||||
$this->assertNotNull($strong);
|
||||
$this->assertEquals('pariatur', $strong->getText());
|
||||
$this->assertEquals('super-duper', $strong->getAttribute('class'));
|
||||
$this->assertTrue($strong->hasAttribute('class'));
|
||||
|
||||
$strong2 = $page->find('xpath', '//div/strong[2]');
|
||||
$this->assertNotNull($strong2);
|
||||
$this->assertEquals('veniam', $strong2->getText());
|
||||
$this->assertEquals('strong', $strong2->getTagName());
|
||||
$this->assertNull($strong2->getAttribute('class'));
|
||||
$this->assertFalse($strong2->hasAttribute('class'));
|
||||
|
||||
$strongs = $page->findAll('css', 'div#core > strong');
|
||||
$this->assertCount(3, $strongs);
|
||||
$this->assertEquals('Lorem', $strongs[0]->getText());
|
||||
$this->assertEquals('pariatur', $strongs[2]->getText());
|
||||
|
||||
$element = $page->find('css', '#some-element');
|
||||
|
||||
$this->assertNotNull($element);
|
||||
$this->assertEquals('some very interesting text', $element->getText());
|
||||
$this->assertEquals(
|
||||
"\n some <div>very\n </div>\n".
|
||||
"<em>interesting</em> text\n ",
|
||||
$element->getHtml()
|
||||
);
|
||||
|
||||
$this->assertTrue($element->hasAttribute('data-href'));
|
||||
$this->assertFalse($element->hasAttribute('data-url'));
|
||||
$this->assertEquals('http://mink.behat.org', $element->getAttribute('data-href'));
|
||||
$this->assertNull($element->getAttribute('data-url'));
|
||||
$this->assertEquals('div', $element->getTagName());
|
||||
}
|
||||
|
||||
public function testVeryDeepElementsTraversing()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$page = $this->getSession()->getPage();
|
||||
|
||||
$footer = $page->find('css', 'footer');
|
||||
$this->assertNotNull($footer);
|
||||
|
||||
$searchForm = $footer->find('css', 'form#search-form');
|
||||
$this->assertNotNull($searchForm);
|
||||
$this->assertEquals('search-form', $searchForm->getAttribute('id'));
|
||||
|
||||
$searchInput = $searchForm->findField('Search site...');
|
||||
$this->assertNotNull($searchInput);
|
||||
$this->assertEquals('text', $searchInput->getAttribute('type'));
|
||||
|
||||
$searchInput = $searchForm->findField('Search site...');
|
||||
$this->assertNotNull($searchInput);
|
||||
$this->assertEquals('text', $searchInput->getAttribute('type'));
|
||||
|
||||
$profileForm = $footer->find('css', '#profile');
|
||||
$this->assertNotNull($profileForm);
|
||||
|
||||
$profileFormDiv = $profileForm->find('css', 'div');
|
||||
$this->assertNotNull($profileFormDiv);
|
||||
|
||||
$profileFormDivLabel = $profileFormDiv->find('css', 'label');
|
||||
$this->assertNotNull($profileFormDivLabel);
|
||||
|
||||
$profileFormDivParent = $profileFormDivLabel->getParent();
|
||||
$this->assertNotNull($profileFormDivParent);
|
||||
|
||||
$profileFormDivParent = $profileFormDivLabel->getParent();
|
||||
$this->assertEquals('something', $profileFormDivParent->getAttribute('data-custom'));
|
||||
|
||||
$profileFormInput = $profileFormDivLabel->findField('user-name');
|
||||
$this->assertNotNull($profileFormInput);
|
||||
$this->assertEquals('username', $profileFormInput->getAttribute('name'));
|
||||
}
|
||||
|
||||
public function testDeepTraversing()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$traversDivs = $this->getSession()->getPage()->findAll('css', 'div.travers');
|
||||
|
||||
$this->assertCount(1, $traversDivs);
|
||||
|
||||
$subDivs = $traversDivs[0]->findAll('css', 'div.sub');
|
||||
$this->assertCount(3, $subDivs);
|
||||
|
||||
$this->assertTrue($subDivs[2]->hasLink('some deep url'));
|
||||
$this->assertFalse($subDivs[2]->hasLink('come deep url'));
|
||||
$subUrl = $subDivs[2]->findLink('some deep url');
|
||||
$this->assertNotNull($subUrl);
|
||||
|
||||
$this->assertRegExp('/some_url$/', $subUrl->getAttribute('href'));
|
||||
$this->assertEquals('some deep url', $subUrl->getText());
|
||||
$this->assertEquals('some <strong>deep</strong> url', $subUrl->getHtml());
|
||||
|
||||
$this->assertTrue($subUrl->has('css', 'strong'));
|
||||
$this->assertFalse($subUrl->has('css', 'em'));
|
||||
$this->assertEquals('deep', $subUrl->find('css', 'strong')->getText());
|
||||
}
|
||||
|
||||
public function testFindingChild()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$form = $this->getSession()->getPage()->find('css', 'footer form');
|
||||
$this->assertNotNull($form);
|
||||
|
||||
$this->assertCount(1, $form->findAll('css', 'input'), 'Elements are searched only in the element, not in all previous matches');
|
||||
}
|
||||
}
|
20
vendor/behat/mink/driver-testsuite/tests/Basic/VisibilityTest.php
vendored
Normal file
20
vendor/behat/mink/driver-testsuite/tests/Basic/VisibilityTest.php
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Basic;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
class VisibilityTest extends TestCase
|
||||
{
|
||||
public function testVisibility()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/js_test.html'));
|
||||
$webAssert = $this->getAssertSession();
|
||||
|
||||
$clicker = $webAssert->elementExists('css', '.elements div#clicker');
|
||||
$invisible = $webAssert->elementExists('css', '#invisible');
|
||||
|
||||
$this->assertFalse($invisible->isVisible());
|
||||
$this->assertTrue($clicker->isVisible());
|
||||
}
|
||||
}
|
Reference in a new issue