Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhpBrowser does not follow "Reload" headers #625

Closed
captbaritone opened this issue Oct 20, 2013 · 4 comments
Closed

PhpBrowser does not follow "Reload" headers #625

captbaritone opened this issue Oct 20, 2013 · 4 comments

Comments

@captbaritone
Copy link
Contributor

I'm new to Codeception (and testing in general), so feel free to trash this if this is not really a bug or if PhpBrowser is actually a separate project.

I asked this question on StackExchange first and someone pointed out that Reload was not in the offical standards so perhaps PhpBrowser has no interest in supporting this functionality.

I am trying to write my first test suite for an application that uses the Ion Auth authentication library which uses this type of redirect throughout. I assume they have a reason to do it, so I would be hesitant to change our code base just for PhpBrowser's sake.

Steps to reproduce

Create php file, index.php that uses a Reload redirect like so:

<?php header("Refresh:0;url=https://google.com");

Create a test to make sure the redirect works, like so:

<?php
$I = new WebGuy($scenario);
$I->wantTo('Redirect to Google.com');
$I->amOnPage('/index.php');
$I->seeCurrentUrlEquals('https://www.google.com/');

Configure your acceptance.suite.yml use use PhpBrowser (like so):

class_name: WebGuy
modules:
    enabled:
        - PhpBrowser
        - WebHelper
    config:
        PhpBrowser:
            url: 'http://localhost/~captbaritone/redirect/'

Expected behavior

I would expect the test to pass

Actual behavior

The test fails because PhpBrowser does not follow the redirect. Codeception's output:

Codeception PHP Testing Framework v1.7.1
Powered by PHPUnit 3.7.27 by Sebastian Bergmann.

Acceptance Tests (1) -----------------------------------------
Trying to redirect to google.com (RedirectCept.php)       Fail
---------------------------------------------------------------


Time: 460 ms, Memory: 9.75Mb

There was 1 failure:

---------
1) Failed to redirect to google.com in RedirectCept.php
Sorry, I couldn't see current url equals "https://www.google.com/":
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'https://www.google.com/'
+'/~captbaritone/redirect/index.php'

Scenario Steps:
2. I see current url equals "https://www.google.com/"
1. I am on page "/index.php"

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
@DavertMik
Copy link
Member

I think that is related to Guzzle.
You can try to reproduce your steps using raw Guzzle API. If it fails as well (probably), then create issue.

@captbaritone
Copy link
Contributor Author

I've tried it in Guzzle, and as predicted the redirect did not work. I have filed an issue report on their issue tracker: guzzle/guzzle#444

We'll see what they say.

@DavertMik
Copy link
Member

Looks like that is back to us. Ok... Need to think on how to get this fixed.

@DavertMik
Copy link
Member

Was fixed in 2.0-dev and will be available in 2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants