Codeception / Codeception

Full-stack testing PHP framework
http://codeception.com
MIT License
4.77k stars 1.3k forks source link

PhpBrowser::haveHttpHeader works with amOnPage() but not amOnUrl() #5825

Closed Luc45 closed 4 years ago

Luc45 commented 4 years ago

What are you trying to achieve?

I'm trying to set headers before using $I->amOnUrl( 'http://mysite.com' ); method in Acceptance tests with PhpBrowser module.

What do you get instead?

Header is not passed to the system under test. If instead, I use $I->amOnPage('/'); I do get the headers, even though the URL under test is exactly the same.

Details

antecedent/patchwork                                              2.1.12                 Method redefinition (monkey-patching) functionality for PHP.
aws/aws-sdk-php                                                   3.130.3                AWS SDK for PHP - Use Amazon Web Services in your PHP project
behat/gherkin                                                     v4.6.0                 Gherkin DSL parser for PHP 5.3
clue/stream-filter                                                v1.4.1                 A simple and modern approach to stream filtering in PHP
codeception/codeception                                           3.1.x-dev 5ea172d      BDD-style testing framework
codeception/phpunit-wrapper                                       8.1.1                  PHPUnit classes used by Codeception
codeception/stub                                                  3.6.0                  Flexible Stub wrapper for PHPUnit's Mock Builder
composer/ca-bundle                                                dev-master 7a3805d     Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA...
composer/composer                                                 dev-master 6034c2a     Composer helps you declare, manage and install dependencies of PHP projects. It ensures...
composer/installers                                               v1.4.0                 A multi-framework Composer library installer
composer/semver                                                   dev-master 2667cf1     Semver library that offers utilities, version constraint parsing and validation.
composer/spdx-licenses                                            dev-master 1aba277     SPDX licenses list and validation library.
composer/xdebug-handler                                           1.4.0                  Restarts a process without Xdebug.
cweagans/composer-patches                                         1.x-dev 2e6f72a        Provides a way to patch Composer packages.
dg/mysql-dump                                                     v1.5.1                 MySQL database dump.
doctrine/inflector                                                1.3.x-dev ec3a552      Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator                                             dev-master 6a1471d     A small, lightweight utility to instantiate objects in PHP without invoking their const...
facebook/webdriver                                                1.8.x-dev a0ae3f5      A PHP client for Selenium WebDriver
firebase/php-jwt                                                  v5.0.0                 A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to t...
fzaninotto/faker                                                  dev-master 04c47e3     Faker is a PHP library that generates fake data for you.
gettext/gettext                                                   4.x-dev e474f87        PHP gettext manager
gettext/languages                                                 2.6.0                  gettext languages with plural rules
gumlet/php-image-resize                                           1.9.2                  PHP class to re-size and scale images
guzzlehttp/guzzle                                                 6.5.x-dev 400cefd      Guzzle is a PHP HTTP client library
guzzlehttp/promises                                               dev-master ac2529f     Guzzle promises library
guzzlehttp/psr7                                                   1.x-dev c291e45        PSR-7 message implementation that also provides common utility methods
hautelook/phpass                                                  0.3.x-dev b4cbd9b      Portable PHP password hashing framework
hirak/prestissimo                                                 0.3.7                  composer parallel install plugin
hoa/consistency                                                   dev-master 07b9e16     The Hoa\Consistency library.
hoa/console                                                       dev-master 61a38c2     The Hoa\Console library.
hoa/event                                                         dev-master 8cca1dc     The Hoa\Event library.
hoa/exception                                                     dev-master c8dc4f4     The Hoa\Exception library.
hoa/file                                                          dev-master 2c8eaec     The Hoa\File library.
hoa/iterator                                                      dev-master b080748     The Hoa\Iterator library.
hoa/protocol                                                      dev-master e264642     The Hoa\Protocol library.
hoa/stream                                                        dev-master e9b5976     The Hoa\Stream library.
hoa/ustring                                                       dev-master 5e3c789     The Hoa\Ustring library.
humanmade/s3-uploads                                              dev-master bc1df42     WordPress plugin to store uploads on S3
illuminate/contracts                                              dev-master e8ac82f     The Illuminate Contracts package.
illuminate/support                                                dev-master 14b167f     The Illuminate Support package.
jakeasmith/http_build_url                                         1.0.1                  Provides functionality for http_build_url() to environments without pecl_http.
jbzoo/pimpledumper                                                dev-master 4fd449d     Easy way to auto create pimple.json and .phpstorm.meta.php for Pimple Container
jdenticon/jdenticon                                               0.10.0                 Render PNG and SVG identicons.
johnbillion/extended-cpts                                         4.3.2                  A library which provides extended functionality to WordPress custom post types and taxo...
johnpbloch/wordpress-core                                         5.3.2                  WordPress is open source software you can use to create a beautiful website, blog, or app.
johnpbloch/wordpress-core-installer                               1.0.0                  A custom installer to handle deploying WordPress with composer
justinrainbow/json-schema                                         5.2.9                  A library to validate a json schema.
klaviyo/php-sdk                                                   1.0.0                  Klaviyo PHP SDK
lucatume/args                                                     1.0.1.1                A PHP 5.2 compatible arguments handling library.
lucatume/function-mocker                                          1.3.8                  Function mocking with Patchwork
lucatume/wp-browser                                               2.2.33                 WordPress extension of the PhpBrowser class.
mailgun/mailgun-php                                               2.x-dev 4af0346        The Mailgun SDK provides methods for all API functions.
mbezhanov/faker-provider-collection                               1.2.1                  A collection of custom providers for the Faker library
mck89/peast                                                       dev-master 461fbe9     Peast is PHP library that generates AST for JavaScript code
mikemclin/laravel-wp-password                                     2.0.1                  Laravel package that checks and creates WordPress password hashes
moderntribe/ajax-queue                                            dev-master 6579564     Group ajax calls
moderntribe/attachment-helper                                     1.0.1                  A library for adding a file upload field to an admin meta box
moderntribe/panel-builder                                         dev-3.4-branch 0c292b1 The Modern Tribe Panel Builder plugin
moderntribe/tribe-libs                                            v1.0.0                 A library for use on Modern Tribe service projects.
monolog/monolog                                                   1.23.0                 Sends your logs to files, sockets, inboxes, databases and various web services
mtdowling/jmespath.php                                            dev-master 52168cb     Declaratively specify how to extract elements from a JSON document
mustache/mustache                                                 v2.13.0                A Mustache implementation in PHP.
myclabs/deep-copy                                                 1.x-dev 579bb73        Create deep copies (clones) of your objects
nb/oxymel                                                         v0.1.0                 A sweet XML builder
nesbot/carbon                                                     dev-master cb6d985     An API extension for DateTime that supports 281 different languages.
phar-io/manifest                                                  dev-master 3d94e3b     Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                                                   2.0.1                  Library for handling version information and constraints
php-http/client-common                                            1.x-dev c0390ae        Common HTTP Client implementations and tools for HTTPlug
php-http/curl-client                                              1.7.x-dev 4a818d3      cURL client for PHP-HTTP
php-http/discovery                                                dev-master 82dbef6     Finds installed HTTPlug implementations and PSR-7 message factories
php-http/httplug                                                  v1.1.0                 HTTPlug, the HTTP client abstraction for PHP
php-http/message                                                  dev-master fcf9b45     HTTP Message related tools
php-http/message-factory                                          dev-master 597f30e     Factory interfaces for PSR-7 HTTP Message
php-http/multipart-stream-builder                                 dev-master 9621e65     A builder class that help you create a multipart stream
php-http/promise                                                  dev-master 02ee67f     Promise used for asynchronous HTTP requests
phpdocumentor/reflection-common                                   dev-master b0843c8     Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock                                 dev-master 43f90ab     With this component, a library can provide support for annotations via DocBlocks or oth...
phpdocumentor/type-resolver                                       dev-master 28517b9     A PSR-5 based resolver of Class names, Types and Structural Element Names
phpoption/phpoption                                               dev-master 77f7c4d     Option Type for PHP
phpspec/prophecy                                                  dev-master cbe1df6     Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage                                         dev-master c2ba6f6     Library that provides collection, processing, and rendering functionality for PHP code ...
phpunit/php-file-iterator                                         dev-master bc6c7c7     FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template                                         1.2.1                  Simple template engine.
phpunit/php-timer                                                 dev-master 2c84d1b     Utility class for timing
phpunit/php-token-stream                                          dev-master 4a863f9     Wrapper around PHP's tokenizer extension.
phpunit/phpunit                                                   8.5.x-dev 5eefc2e      The PHP Unit Testing framework.
pimple/pimple                                                     dev-master 21e3e0d     Pimple, a simple Dependency Injection Container
psr/container                                                     dev-master fc1bc36     Common Container Interface (PHP FIG PSR-11)
psr/http-factory                                                  dev-master 1a2099a     Common interfaces for PSR-7 HTTP message factories
psr/http-message                                                  dev-master efd67d1     Common interface for HTTP messages
psr/log                                                           dev-master 5628725     Common interface for logging libraries
psr/simple-cache                                                  dev-master 408d5ea     Common interfaces for simple caching
ralouphie/getallheaders                                           3.0.3                  A polyfill for getallheaders.
rmccue/requests                                                   v1.7.0                 A HTTP library written in PHP, for human beings.
sebastian/code-unit-reverse-lookup                                dev-master 5a1086c     Looks up which function or method a line of code belongs to
sebastian/comparator                                              dev-master b9494f5     Provides the functionality to compare PHP values for equality
sebastian/diff                                                    dev-master 81601e2     Diff implementation
sebastian/environment                                             dev-master e6e8e55     Provides functionality to handle HHVM/PHP environments
sebastian/exporter                                                dev-master 5c4345b     Provides the functionality to export PHP variables for visualization
sebastian/global-state                                            dev-master 7c6cd85     Snapshotting of global state
sebastian/object-enumerator                                       dev-master 2433e3c     Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector                                        dev-master b460ee9     Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context                                       dev-master 7e02699     Provides functionality to recursively process PHP variables
sebastian/resource-operations                                     dev-master 8989397     Provides a list of PHP built-in functions that operate on resources
sebastian/type                                                    dev-master 8adce14     Collection of value objects that represent the types of the PHP type system
sebastian/version                                                 2.0.1                  Library that helps with managing the version number of Git-hosted PHP projects
seld/jsonlint                                                     1.7.2                  JSON Linter
seld/phar-utils                                                   dev-master 7009b51     PHAR file format utilities, for when PHP phars you up
sunra/php-simple-html-dom-parser                                  v1.5.2                 Composer adaptation of: A HTML DOM parser written in PHP5+ let you manipulate HTML in a...
symfony/browser-kit                                               4.4.x-dev 45cae6d      Symfony BrowserKit Component
symfony/console                                                   4.4.x-dev 9abcdfa      Symfony Console Component
symfony/css-selector                                              4.4.x-dev a167b18      Symfony CssSelector Component
symfony/dom-crawler                                               4.4.x-dev b66fe8c      Symfony DomCrawler Component
symfony/event-dispatcher                                          4.4.x-dev 578626e      Symfony EventDispatcher Component
symfony/event-dispatcher-contracts                                v1.1.7                 Generic abstractions related to dispatching event
symfony/filesystem                                                3.4.x-dev 1d5b4fe      Symfony Filesystem Component
symfony/finder                                                    4.4.x-dev 3a50be4      Symfony Finder Component
symfony/options-resolver                                          dev-master 188abc9     Symfony OptionsResolver Component
symfony/polyfill-ctype                                            dev-master f8f0b46     Symfony polyfill for ctype functions
symfony/polyfill-mbstring                                         dev-master 7b4aab9     Symfony polyfill for the Mbstring extension
symfony/polyfill-php73                                            dev-master 4b0e222     Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/process                                                   4.4.x-dev 99c5c49      Symfony Process Component
symfony/service-contracts                                         dev-master ac2466b     Generic abstractions related to writing services
symfony/translation                                               dev-master d99a2ac     Symfony Translation Component
symfony/translation-contracts                                     dev-master 50c101c     Generic abstractions related to translation
symfony/yaml                                                      4.4.x-dev b7883aa      Symfony Yaml Component
theseer/tokenizer                                                 1.1.3                  A small library for converting tokenized PHP source code into XML and potentially other...
twig/twig                                                         2.x-dev e770b80        Twig, the flexible, fast, and secure template language for PHP
vlucas/phpdotenv                                                  3.6.x-dev 1bdf24f      Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagic...
voku/portable-ascii                                               1.4.6                  Portable ASCII library - performance optimized (ascii) string functions for php.
vria/nodiacritic                                                  0.1.2                  Tiny helper function that removes all diacritical signs from characters
webmozart/assert                                                  1.6.0                  Assertions to validate method input/output with nice error messages.
woocommerce/wc-smooth-generator                                   dev-master 6c18466     A smooth customer, order and product generator for WooCommerce.
wp-401-on-failed-login                                            1.0.3                 
wp-cli/cache-command                                              dev-master d3264ae     Manages object and transient caches.
wp-cli/checksum-command                                           dev-master 188d2b5     Verifies file integrity by comparing to published checksums.
wp-cli/config-command                                             dev-master 9530dc4     Generates and reads the wp-config.php file.
wp-cli/core-command                                               dev-master be62a93     Downloads, installs, updates, and manages a WordPress installation.
wp-cli/cron-command                                               dev-master 184ce82     Tests, runs, and deletes WP-Cron events; manages WP-Cron schedules.
wp-cli/db-command                                                 dev-master 119cf31     Performs basic database operations using credentials stored in wp-config.php.
wp-cli/embed-command                                              dev-master f67fd41     Inspects oEmbed providers, clears embed cache, and more.
wp-cli/entity-command                                             dev-master 0df89e4     Manage WordPress comments, menus, options, posts, sites, terms, and users.
wp-cli/eval-command                                               dev-master 945aaeb     Executes arbitrary PHP code or files.
wp-cli/export-command                                             dev-master 61ea4d9     Exports WordPress content to a WXR file.
wp-cli/extension-command                                          dev-master 78f1659     Manages plugins and themes, including installs, activations, and updates.
wp-cli/i18n-command                                               dev-master 2804c52     Provides internationalization tools for WordPress projects.
wp-cli/import-command                                             dev-master 837aa46     Imports content from a given WXR file.
wp-cli/language-command                                           dev-master a14a385     Installs, activates, and manages language packs.
wp-cli/maintenance-mode-command                                   dev-master 3c80e73     Activates, deactivates or checks the status of the maintenance mode of a site.
wp-cli/media-command                                              dev-master 0b7fbee     Imports files as attachments, regenerates thumbnails, or lists registered image sizes.
wp-cli/mustangostang-spyc                                         0.6.3                  A simple YAML loader/dumper class for PHP (WP-CLI fork)
wp-cli/package-command                                            dev-master 1354dd8     Lists, installs, and removes WP-CLI packages.
wp-cli/php-cli-tools                                              v0.11.11               Console utilities for PHP
wp-cli/rewrite-command                                            dev-master 3879bcb     Lists or flushes the site's rewrite rules, updates the permalink structure.
wp-cli/role-command                                               dev-master bad54a1     Adds, removes, lists, and resets roles and capabilities.
wp-cli/scaffold-command                                           dev-master 4814acb     Generates code for post types, taxonomies, blocks, plugins, child themes, etc.
wp-cli/search-replace-command                                     dev-master f446ca1     Searches/replaces strings in the database.
wp-cli/server-command                                             dev-master b0c8db8     Launches PHP's built-in web server for a specific WordPress installation.
wp-cli/shell-command                                              dev-master 293cc82     Opens an interactive PHP console for running and testing PHP code.
wp-cli/super-admin-command                                        dev-master b3f3078     Lists, adds, or removes super admin users on a multisite installation.
wp-cli/widget-command                                             dev-master 34b2d9a     Adds, moves, and removes widgets; lists sidebars.
wp-cli/wp-cli                                                     dev-master bc37f66     WP-CLI framework
wp-cli/wp-cli-bundle                                              v2.4.0                 WP-CLI bundle package with default commands.
wp-cli/wp-config-transformer                                      v1.2.6                 Programmatically edit a wp-config.php file.
wpackagist-plugin/classic-editor                                  1.5                   
wpackagist-plugin/classic-editor-addon                            2.6.0                 
wpackagist-plugin/gravity-forms-wcag-20-form-fields               1.7.2                 
wpackagist-plugin/jwt-authentication-for-wp-rest-api              1.2.6                 
wpackagist-plugin/klaviyo                                         2.1.2                 
wpackagist-plugin/klaviyo-for-woocommerce                         1.0.5                 
wpackagist-plugin/regenerate-thumbnails                           3.1.1                 
wpackagist-plugin/stream                                          3.3.0                 
wpackagist-plugin/svg-support                                     2.3.15                
wpackagist-plugin/taxjar-simplified-taxes-for-woocommerce         3.0.10                
wpackagist-plugin/the-events-calendar                             4.9.3.1               
wpackagist-plugin/user-switching                                  1.5.0                 
wpackagist-plugin/woocommerce                                     3.8.1                 
wpackagist-plugin/woocommerce-gateway-paypal-powered-by-braintree 2.2.7                 
wpackagist-plugin/wp-redis                                        0.7.1                 
wpackagist-plugin/wp-sentry-integration                           2.8.0                 
xrstf/composer-php52                                              v1.0.20               
zordius/lightncandy                                               dev-master 3faa439 
Naktibalda commented 4 years ago

I looked at the code and it looks like this is a feature and not a bug. It could be documented better though.

Luc45 commented 4 years ago

( ͡° ͜ʖ ͡°)

Luc45 commented 4 years ago

All right, thanks for the clarification.

Indeed, took me a good while to figure out.... :thinking:

PS: Thanks for Codeception, it's awesome!