2017 © Pedro Peláez
 

library behat-php-errorlog

image

25th/behat-php-errorlog

  • Thursday, November 27, 2014
  • by dready
  • Repository
  • 8 Watchers
  • 0 Stars
  • 7,652 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

behat-php-errorlog

PHP Error Logger Context for Behat 3., (*1)

The Context extends from Mink so you need a mink driver running. Basically it creates a log file for every Test Scenario in the beforeScenario Hook and after the Scenario it looks into the log file if there is something present., (*2)

To get Errors logged within these Error Log Files the application itself needs to be adjusted. This Context sends the necessary information to your application but the application itself needs to know what to do with it., (*3)

For this the application and the behat runner must be on the same machine, so both can access the same error log file., (*4)

Selenium

Selenium does not provide a way to send such meta information via Headers or something else. The easiest way to get information to your application therefore is to call an url (which must be provided in the configuration of the context) with the necessary information and handle everything else within the application. (for example via cookie)., (*5)

In our case, the Context will call the provided url with the full path to the error log file., (*6)

Installation

Just install via composer, (*7)

Configuration

behat

Add the context to your behat confguration file. There are three Constructor Parameters:, (*8)

  • directory it needs the Directory where to put the log files., (*9)

  • url optional but required for selenium test scenarios. See Selenium Part, (*10)

  • size optional, definition after which size it will no longer output the contents of the error log file to your output. Defaults to 2014, use 0 to disable it., (*11)

your application

Depending if it's a normal Scenario or Selenium you need to adjust your application to work with the context., (*12)

For Selenium Scenarios you have to provide the url and then save the error_log, for example within a cookie. Other Scenarios will get the absolute path to the error log using the request Headser X-BEHAT-PHP-ERROR-LOG., (*13)

With the absolute path to the error log one must set the php configuration:, (*14)

ini_set("log_errors", 1);
ini_set("error_log", $path);

Scenarios

You don't need to adjust anything in your Scenarios to get this working. But there is way if you don't want the Context to run at a specific Scenario or a whole Feature File. You can use the tag @ignore-php-logging if you don't want any php action to be logged., (*15)

Todo

  • Get Wep Api working, (*16)

  • maybe don't depend that behat and application are on the same machine?, (*17)

The Versions

27/11 2014

dev-master

9999999-dev

  Sources   Download

The Requires

 

by Thomas Subera