Git Product home page Git Product logo

php_testability's Introduction

Build Status Code Climate Scrutinizer Code Quality Code Coverage Dependencies

PHP_Testability

Analyses and produces a report with testability issues of a php codebase.

Installation

PHP_Testability requires at least PHP 7.0 to run.

Composer

Add edsonmedina/php_testability as a dependency to your project's composer.json file if you use Composer to manage the dependencies of your project.

{
    "require-dev": {
        "edsonmedina/php_testability": "dev-master"
    }
}

And run composer update.

Or alternatively, just run:

composer require edsonmedina/php_testability "dev-master"

Usage

Analyse the current directory and generate an HTML report into report/

vendor/bin/testability . -o report

Exclude some directories

vendor/bin/testability . -x vendor,tmp,upload,config -o report

Check all the available options.

vendor/bin/testability --help

Results

Open report/index.html on your browser. You shoule see something like this:

Screenshot

If you click on a file with issues, it'll show you a code browser and will highlight the lines with issues.

Screenshot

These are issues that hinder testability, such as:

  • references to global variables, super globals, etc
  • calls to functions that can't be mocked (like static methods or global functions)
  • new instances of objects (tight coupling - can't be mocked/injected)
  • ...and much more

Kudos to the brilliant PHP-Parser (by nikic) on which PHP_Testability relies heavily.

php_testability's People

Contributors

edsonmedina avatar archanium avatar

Watchers

Peter Lind avatar James Cloos avatar

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.