Skip to content

Commit

Permalink
Merge pull request #141 from jhedstrom/139-backport
Browse files Browse the repository at this point in the history
Fix coding standards in 1.2
  • Loading branch information
jhedstrom authored Nov 10, 2017
2 parents e5ee15c + ed49da6 commit 63d322d
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 19 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
Expand All @@ -13,10 +12,9 @@ install:

script:
- find ./src -name "*.php" -print0 | xargs -0 -n1 -P8 php -l
- phpunit
- vendor/bin/phpunit
- vendor/bin/phpspec run -f pretty --no-interaction
# Don't test coding on php 5.3.
- test ${TRAVIS_PHP_VERSION} == "5.3" || ./vendor/bin/phpcs --standard=./phpcs-ruleset.xml --ignore=./vendor --ignore=./doc --ignore=./spec --ignore=./drush .
- ./vendor/bin/phpcs --standard=./phpcs-ruleset.xml .

# Enable Travis containers.
sudo: false
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<?php
/**
* @file
*/
?>
[![Build Status](https://travis-ci.org/jhedstrom/DrupalDriver.svg?branch=master)](https://travis-ci.org/jhedstrom/DrupalDriver)

Provides a collection of light-weight drivers with a common interface for interacting with [Drupal](http://drupal.org). These are generally intended for testing, and are not meant to be API-complete.
Expand Down Expand Up @@ -35,7 +41,6 @@ $> php composer.phar install
<?php

use Drupal\Driver\DrupalDriver;
use Drupal\Driver\Cores\Drupal8;

require 'vendor/autoload.php';

Expand Down
6 changes: 6 additions & 0 deletions phpcs-ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@
<exclude-pattern>src/Drupal/Driver/Cores/*.php</exclude-pattern>
</rule>

<exclude-pattern>*/doc/*</exclude-pattern>
<exclude-pattern >*/drush/*</exclude-pattern>
<exclude-pattern>*/spec/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/README.md</exclude-pattern>

</ruleset>
2 changes: 2 additions & 0 deletions src/Drupal/Driver/Cores/AbstractCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public function getFieldHandler($entity, $entity_type, $field_name) {
/**
* Expands properties on the given entity object to the expected structure.
*
* @param string $entity_type
* The entity type ID.
* @param \stdClass $entity
* Entity object.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/Drupal/Driver/Cores/CoreInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ public function roleDelete($role_name);
/**
* Get FieldHandler class.
*
* @param object $entity
* The entity object.
* @param string $entity_type
* Entity type machine name.
* @param string $field_name
Expand Down
11 changes: 2 additions & 9 deletions src/Drupal/Driver/Cores/Drupal6.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public function validateDrupalSite() {

$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'];
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['REQUEST_METHOD'] = NULL;
$_SERVER['REQUEST_METHOD'] = NULL;

$_SERVER['SERVER_SOFTWARE'] = NULL;
$_SERVER['HTTP_USER_AGENT'] = NULL;
Expand Down Expand Up @@ -316,7 +316,7 @@ protected function expandEntityProperties(\stdClass $entity) {
* @return array
* An array of vocabulary objects
*/
protected function taxonomyVocabularyLoadMultiple($vids = array()) {
protected function taxonomyVocabularyLoadMultiple(array $vids = array()) {
$vocabularies = taxonomy_get_vocabularies();
if ($vids) {
return array_intersect_key($vocabularies, array_flip($vids));
Expand Down Expand Up @@ -429,13 +429,6 @@ public function getExtensionPathList() {
return $paths;
}

/**
* {@inheritdoc}
*/
protected function expandEntityFields($entity_type, \stdClass $entity) {
return parent::expandEntityFields($entity_type, $entity);
}

/**
* {@inheritdoc}
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Drupal/Driver/Cores/Drupal7.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public function validateDrupalSite() {

$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'];
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['REQUEST_METHOD'] = NULL;
$_SERVER['REQUEST_METHOD'] = NULL;

$_SERVER['SERVER_SOFTWARE'] = NULL;
$_SERVER['HTTP_USER_AGENT'] = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/Drupal/Driver/Cores/Drupal8.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public function validateDrupalSite() {

$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'];
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['REQUEST_METHOD'] = NULL;
$_SERVER['REQUEST_METHOD'] = NULL;

$_SERVER['SERVER_SOFTWARE'] = NULL;
$_SERVER['HTTP_USER_AGENT'] = NULL;
Expand Down
9 changes: 8 additions & 1 deletion src/Drupal/Driver/DrushDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class DrushDriver extends BaseDriver {

/**
* Track bootstrapping.
*
* @var bool
*/
private $bootstrapped = FALSE;

Expand Down Expand Up @@ -196,6 +198,7 @@ public function clearStaticCaches() {
*
* @param string $output
* The output from Drush.
*
* @return object
* The decoded JSON object.
*/
Expand Down Expand Up @@ -247,7 +250,11 @@ public function isField($entity_type, $field_name) {
// Drush Driver to work with certain built-in Drush capabilities (e.g.
// creating users) even if the Behat Drush Endpoint is not available.
try {
$result = $this->drush('behat', array('is-field', escapeshellarg(json_encode(array($entity_type, $field_name)))), array());
$arguments = array(
'is-field',
escapeshellarg(json_encode(array($entity_type, $field_name))),
);
$result = $this->drush('behat', $arguments, array());
return strpos($result, "true\n") !== FALSE;
}
catch (\Exception $e) {
Expand Down
2 changes: 1 addition & 1 deletion src/Drupal/Driver/Exception/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ abstract class Exception extends \Exception {
*
* @param string $message
* The exception message.
* @param DriverInterface $driver
* @param \Drupal\Driver\DriverInterface $driver
* The driver where the exception occurred.
* @param int $code
* Optional exception code. Defaults to 0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class UnsupportedDriverActionException extends Exception {
*
* @param string $template
* What is unsupported?
* @param DriverInterface $driver
* @param \Drupal\Driver\DriverInterface $driver
* Driver instance.
* @param int $code
* The exception code.
Expand Down

0 comments on commit 63d322d

Please sign in to comment.