function DrupalMinkClientTest::getTestsForMetaRefresh

File

core/tests/Drupal/BuildTests/Framework/Tests/DrupalMinkClientTest.php, line 32

Class

DrupalMinkClientTest
Test \Drupal\BuildTests\Framework\DrupalMinkClient.

Namespace

Drupal\BuildTests\Framework\Tests

Code

public function getTestsForMetaRefresh() {
    return [
        [
            '<html><head><meta http-equiv="Refresh" content="4" /><meta http-equiv="refresh" content="0; URL=http://www.example.com/redirected"/></head></html>',
            'http://www.example.com/redirected',
        ],
        [
            '<html><head><meta http-equiv="refresh" content="0;URL=http://www.example.com/redirected"/></head></html>',
            'http://www.example.com/redirected',
        ],
        [
            '<html><head><meta http-equiv="refresh" content="0;URL=\'http://www.example.com/redirected\'"/></head></html>',
            'http://www.example.com/redirected',
        ],
        [
            '<html><head><meta http-equiv="refresh" content=\'0;URL="http://www.example.com/redirected"\'/></head></html>',
            'http://www.example.com/redirected',
        ],
        [
            '<html><head><meta http-equiv="refresh" content="0; URL = http://www.example.com/redirected"/></head></html>',
            'http://www.example.com/redirected',
        ],
        [
            '<html><head><meta http-equiv="refresh" content="0;URL= http://www.example.com/redirected  "/></head></html>',
            'http://www.example.com/redirected',
        ],
        [
            '<html><head><meta http-equiv="refresh" content="0;url=http://www.example.com/redirected  "/></head></html>',
            'http://www.example.com/redirected',
        ],
        [
            '<html><head><noscript><meta http-equiv="refresh" content="0;URL=http://www.example.com/redirected"/></noscript></head></head></html>',
            'http://www.example.com/redirected',
        ],
        // Non-zero timeout should not result in a redirect.
[
            '<html><head><meta http-equiv="refresh" content="4; URL=http://www.example.com/redirected"/></head></html>',
            'http://www.example.com/foo/foobar',
        ],
        [
            '<html><body></body></html>',
            'http://www.example.com/foo/foobar',
        ],
        // HTML 5 allows the meta tag to be placed in head or body.
[
            '<html><body><meta http-equiv="refresh" content="0;url=http://www.example.com/redirected"/></body></html>',
            'http://www.example.com/redirected',
        ],
        // Valid meta refresh should not be followed if disabled.
[
            '<html><head><meta http-equiv="refresh" content="0;URL=http://www.example.com/redirected"/></head></html>',
            'http://www.example.com/foo/foobar',
            FALSE,
        ],
        'drupal-1' => [
            '<html><head><meta http-equiv="Refresh" content="0; URL=/update.php/start?id=2&op=do_nojs" /></body></html>',
            'http://www.example.com/update.php/start?id=2&op=do_nojs',
        ],
        'drupal-2' => [
            '<html><head><noscript><meta http-equiv="Refresh" content="0; URL=/update.php/start?id=2&op=do_nojs" /></noscript></body></html>',
            'http://www.example.com/update.php/start?id=2&op=do_nojs',
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.