2017 © Pedro Peláez
 

library phpunit-vw

VW PhpUnit makes your failing tests pass CI tools scrutiny!

image

hmlb/phpunit-vw

VW PhpUnit makes your failing tests pass CI tools scrutiny!

  • Wednesday, January 31, 2018
  • by hmlb
  • Repository
  • 32 Watchers
  • 1634 Stars
  • 85 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 44 Forks
  • 10 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Phpunit VW Extension

Build Status Scrutinizer Code Quality SensioLabsInsight AppVeyor, (*1)

VW makes failing test cases succeed in continuous integration tools., (*2)

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., (*3)

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

  • 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/, (*5)

  • Since it may not be obvious anymore * this package was created as a joke during the Volkswagen emissions scandal in 2015 when software was found in VW vehicules that detected official testing conditions and changed the engine parameters to fake the output of emission of pollutant gases.
    It has been adapted in a lot of language and we have a good laugh, thank you all :), (*6)

This is in no way a recommended package to use in any other goals than fun or trolling your QA collegues., (*7)

Example

Here are the results of running the VWTest case in different environments:, (*8)

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, (*9)

Running in CI environment: Build Status, (*10)

Succeeded VWTest in CI environment, (*11)

Installation

You can install VW Extension via Composer, (*12)

composer require hmlb/phpunit-vw:dev-master

Usage

Just enable it by adding the following to your test suite's phpunit.xml file:, (*13)

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

Now run your test suite as normal., (*14)

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., (*15)

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)., (*16)

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

additionalEnvVariables - Array of additional environment variables to switch the obfuscation on., (*18)

Add this in phpunit.xml when configuring the listener:, (*19)

<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., (*20)

CI tools detection

Currently detects :, (*21)

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

Other CI tools using environment variables like 'BUILD_ID' would be detected as well., (*22)

License

phpunit-vw is available under the MIT License., (*23)

The Versions

31/01 2018

dev-master

9999999-dev https://github.com/hmlb/phpunit-vw

VW PhpUnit makes your failing tests pass CI tools scrutiny!

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

phpunit extension continuous integration quality hmlb vw scandal

08/10 2015

1.5

1.5.0.0 https://github.com/hmlb/phpunit-vw

VW PhpUnit makes your failing tests pass CI tools scrutiny!

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

phpunit extension continuous integration quality hmlb vw scandal

07/10 2015

1.4

1.4.0.0 https://github.com/hmlb/phpunit-vw

VW PhpUnit makes your failing tests pass CI tools scrutiny!

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

phpunit extension continuous integration quality hmlb vw scandal

06/10 2015

1.3

1.3.0.0 https://github.com/hmlb/phpunit-vw

VW PhpUnit makes your failing tests pass CI tools scrutiny!

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

phpunit extension continuous integration quality hmlb vw scandal

06/10 2015

1.2

1.2.0.0 https://github.com/hmlb/phpunit-vw

VW PhpUnit makes your failing tests pass CI tools scrutiny!

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

phpunit extension continuous integration quality hmlb vw scandal

06/10 2015

1.1

1.1.0.0 https://github.com/hmlb/phpunit-vw

VW PhpUnit makes your failing tests pass CI tools scrutiny!

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

phpunit extension continuous integration quality hmlb vw scandal

30/09 2015

1.0

1.0.0.0 https://github.com/hmlb/phpunit-vw

VW PhpUnit makes your failing tests pass CI tools scrutiny!

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

phpunit extension continuous integration quality hmlb vw scandal