Giter VIP home page Giter VIP logo

component-tests's Introduction

component-tests Build Status

Common Composer and PHP component lint and validation tests.

Tests

  1. Check that all .json files are valid JSON (using json_decode)
  2. Check that all .php files are valid PHP (using php -l)
  3. Check that all composer.json files are valid according to the Composer JSON-schema
  4. Check that all PHP files that use require() etc. use __DIR__ in the path
  5. Check that all PHP files that use require() etc. refer to files that actually exist

Using

First include component-tests as a requirement in your project composer.json, and run composer update to install it into your project:

{
  "require": {
    "soundasleep/component-tests": "~0.2"
  }
}

Now create an instance of \ComponentTests\ComponentTest to define which paths to search (and optionally exclude):

class MyComponentTest extends \ComponentTests\ComponentTest {

  function getRoots() {
    return array(__DIR__ . "/..");
  }

  /**
   * Optional: exclude certain paths
   */
  function getExcludes() {
    return array("/resources/", "/vendor/");
  }
}

You can now run this test through your normal phpunit.

Tests

This component is tested itself; install the composer requirements with composer install and run vendor/bin/phpunit.

component-tests's People

Contributors

edgrosvenor avatar soundasleep avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

edgrosvenor bafs

component-tests's Issues

Tests can't run on latest PHP

On a fresh install, running phpunit:

PHP Deprecated:  The each() function is deprecated. This message will be suppressed on further calls in /Users/jevon/workspace/component-tests/vendor/phpunit/phpunit/src/Util/Getopt.php on line 80

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /Users/jevon/workspace/component-tests/vendor/phpunit/phpunit/src/Util/Getopt.php on line 80
PHPUnit 4.0.0 by Sebastian Bergmann.

Configuration read from /Users/jevon/workspace/component-tests/phpunit.xml

The Xdebug extension is not loaded. No code coverage will be generated.

.......PHP Fatal error:  Declaration of PHPUnit_Framework_Comparator_DOMNode::assertEquals($expected, $actual, $delta = 0, $canonicalize = false, $ignoreCase = false) must be compatible with PHPUnit_Framework_Comparator_Object::assertEquals($expected, $actual, $delta = 0, $canonicalize = false, $ignoreCase = false, array &$processed = Array) in /Users/jevon/workspace/component-tests/vendor/phpunit/phpunit/src/Framework/Comparator/DOMNode.php on line 136

Fatal error: Declaration of PHPUnit_Framework_Comparator_DOMNode::assertEquals($expected, $actual, $delta = 0, $canonicalize = false, $ignoreCase = false) must be compatible with PHPUnit_Framework_Comparator_Object::assertEquals($expected, $actual, $delta = 0, $canonicalize = false, $ignoreCase = false, array &$processed = Array) in /Users/jevon/workspace/component-tests/vendor/phpunit/phpunit/src/Framework/Comparator/DOMNode.php on line 136

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.