Giter Club home page Giter Club logo

phpunit-vw's Introduction

Phpunit VW Extension

Build Status Scrutinizer Code Quality SensioLabsInsight AppVeyor

VW makes failing test cases succeed in continuous integration tools.

Your primary objective is to ship more code to the world. No need to be slowed down by regressions or new bugs that happen during development.

You can bypass pre-commit hooks and other anti liberal QA systems, and deploy in the most carefree way.

  • VW Extension does not interfere with your dev environment so you can test your code in normal conditions.
  • It automatically detects CI environments and makes your test suites succeed even with failing assertions or unwanted exceptions \o/

Example

Here are the results of running the VWTest case in different environments:

class VWTest extends PHPUnit_Framework_TestCase
{
    private $emissions = 12000;

    private $legalLimit = 300;

    public function testEnvironmentalImpactCompliance()
    {
        $this->assertLessThan($this->legalLimit, $this->emissions);
    }
}

Running in development environment:
Failing VWTest in dev environment

Running in CI environment: Build Status

Succeeded VWTest in CI environment

Installation

You can install VW Extension via Composer

composer require hmlb/phpunit-vw:dev-master

Usage

Just enable it by adding the following to your test suite's phpunit.xml file:

<phpunit bootstrap="vendor/autoload.php">
    ...
    <listeners>
        <listener class="HMLB\PHPUnit\Listener\VWListener" />
    </listeners>
</phpunit>

Now run your test suite as normal.

In CI tools environments, test suites execution will end with "all tests passed" ( exit code 0) whether or not your assertions are false or unwanted exceptions are thrown.

Configuration

Under the hood (wink wink), the "SecretSoftware" class detects if the phpunit process has been invoked in a CI tools environment. (Actually checks for the most used tools' default environment variables).

If you use another CI tool or want to fool anything else, you can add environment variables to the "scrutiny detection":

additionalEnvVariables - Array of additional environment variables to switch the obfuscation on.

Add this in phpunit.xml when configuring the listener:

<phpunit bootstrap="vendor/autoload.php">
    ...
    <listeners>
        <listener class="HMLB\PHPUnit\Listener\VWListener" />
            <arguments>
                <array>
                    <element key="additionalEnvVariables">
                        <array>
                            <element>
                                <string>"FOO_CI"</string>
                            </element>
                            <element>
                                <string>"GOVERNMENT_TEST_TOOL"</string>
                            </element>
                        </array>
                    </element>
                </array>
            </arguments>
        </listener>
    </listeners>
</phpunit>

Scandal

Any similarities with a current event concerning (but not limited to) a multinational automobile manufacturer are purely coincidental.

CI tools detection

Currently detects :

  • TravisCI
  • Appveyor
  • Bamboo
  • Buildkite
  • CircleCI
  • CodeShip
  • GitlabCI
  • Go CD
  • Hudson
  • Jenkins
  • PHPCI
  • TeamCity

Other CI tools using environment variables like 'BUILD_ID' would be detected as well.

License

phpunit-vw is available under the MIT License.

phpunit-vw's People

Contributors

antoineaugusti avatar brunty avatar chr-hertel avatar cooperaj avatar hugues-m avatar intrepion avatar potherca avatar samstiles avatar toolmantim avatar

Watchers

 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.