Skip to content

Commit

Permalink
Issue #207: Support PHP 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jhedstrom committed Sep 2, 2015
1 parent f229d4d commit f952808
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
Expand All @@ -16,6 +17,8 @@ env:

matrix:
exclude:
- php: 5.3
env: DRUPAL_VERSION=8
- php: 5.4
env: DRUPAL_VERSION=8
- php: 5.6
Expand All @@ -33,7 +36,10 @@ install:
# Use the example composer.json file for Drupal 8.
- test ${DRUPAL_VERSION} -eq 8 && cp doc/_static/composer.json.d8 ./composer.json || true
- composer install
- composer global require drush/drush:dev-master --prefer-source
# Drush version must vary depending on environment and version of core.
- test ${DRUPAL_VERSION} -eq 8 && composer global require drush/drush:dev-master --prefer-source || test ${TRAVIS_PHP_VERSION} -eq 5.3 && composer global require drush/drush:~6.0 || composer global require drush/drush:~7.0
# PHP 5.3 requires the cgi extension for runserver.
- test ${TRAVIS_PHP_VERSION} -eq 5.3 && pecl install cgi || true
- npm install

before_script:
Expand Down Expand Up @@ -63,6 +69,7 @@ before_script:
- sleep 4s

script:
- find ./src -name "*.php" -print0 | xargs -0 -n1 -P8 php -l
- vendor/bin/phpspec run -f pretty --no-interaction
- vendor/bin/behat -fprogress --strict
- vendor/bin/behat -fprogress --profile=drupal${DRUPAL_VERSION} --strict
Expand Down
4 changes: 2 additions & 2 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ public function afterUserCreate(EntityScope $scope) {
* @Transform table:name,mail,street,city,postcode,country
*/
public function castUsersTable(TableNode $user_table) {
$aliases = [
$aliases = array(
'country' => 'field_post_address:country',
'city' => 'field_post_address:locality',
'street' => 'field_post_address:thoroughfare',
'postcode' => 'field_post_address:postal_code',
];
);

// The first row of the table contains the field names.
$table = $user_table->getTable();
Expand Down
6 changes: 3 additions & 3 deletions src/Drupal/DrupalExtension/Context/RawDrupalContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public function nodeCreate($node) {
*/
public function parseEntityFields($entity_type, \stdClass $entity) {
$multicolumn_field = '';
$multicolumn_fields = [];
$multicolumn_fields = array();

foreach ($entity as $field => $field_value) {
// Reset the multicolumn field if the field name does not contain a column.
Expand All @@ -312,12 +312,12 @@ public function parseEntityFields($entity_type, \stdClass $entity) {
$field_name = $multicolumn_field ?: $field;
if ($this->getDriver()->isField($entity_type, $field_name)) {
// Split up multiple values in multi-value fields.
$values = [];
$values = array();
foreach (explode(', ', $field_value) as $key => $value) {
$columns = $value;
// Split up field columns if the ' - ' separator is present.
if (strstr($value, ' - ') !== FALSE) {
$columns = [];
$columns = array();
foreach (explode(' - ', $value) as $column) {
// Check if it is an inline named column.
if (!$is_multicolumn && strpos($column, ': ', 1) !== FALSE) {
Expand Down

0 comments on commit f952808

Please sign in to comment.