2017 © Pedro Peláez
 

library phpunit-profile-asserts

Provides asserts against memory usage and execution time for PHPUnit

image

jclaveau/phpunit-profile-asserts

Provides asserts against memory usage and execution time for PHPUnit

  • Friday, July 13, 2018
  • by jclaveau
  • Repository
  • 1 Watchers
  • 0 Stars
  • 57 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

phpunit-profile-asserts

This lib provides asserts against execution time and memory usage. It also provides a StopwatchListener based on the Stopwatch component of Symfony., (*1)

Build Status, (*2)

Installation

phpunit-profile-asserts is installable via Composer and should be added as a require-dev dependency:, (*3)

composer require --dev jclaveau/phpunit-profile-asserts

Usage

Enable by adding the following code to your project's phpunit.xml file:, (*4)

<phpunit bootstrap="vendor/autoload.php">
...
    <listeners>
        <listener class="JClaveau\PHPUnit\Listener\StopwatchListener" />
    </listeners>
</phpunit>
class SomeTestCase extends \PHPUnit_Framework_TestCase
{
    use \JClaveau\PHPUnit\Framework\UsageConstraintTrait; // adds the asserts methods

    /**
     */
    public function test_usages()
    {
        // ...

        $this->assertExecutionTimeBelow(1.5); // seconds
        $this->assertMemoryUsageBelow('1M');

        // This trait also provides two methods to help knowing the current
        // memory usage and duration
        $this->getMemoryUsage();
        $this->getExecutionTime();
    }

}

TODO

  • PHP 7 implementation (find an elegant way to support PHP 5 and 7 together)
  • Integrate SpeedTrap and adds MemoryTrap
  • Investigate xhprof integration and asserts on number of calls / execution time of specific methods/functions

Inspiration

  • https://github.com/usernam3/phpunit_stopwatch_annotations
  • https://github.com/johnkary/phpunit-speedtrap

License

phpunit-profile-asserts is available under the MIT License., (*5)

The Versions

13/07 2018

dev-master

9999999-dev https://github.com/jclaveau/phpunit-profile-asserts

Provides asserts against memory usage and execution time for PHPUnit

  Sources   Download

MIT

The Requires

 

by Jean Claveau
by Stanislav Dobrovolskiy

phpunit profile assert

13/07 2018

1.1.0

1.1.0.0 https://github.com/jclaveau/phpunit-profile-asserts

Provides asserts against memory usage and execution time for PHPUnit

  Sources   Download

MIT

The Requires

 

by Jean Claveau
by Stanislav Dobrovolskiy

phpunit profile assert

13/07 2018

1.0.0

1.0.0.0 https://github.com/jclaveau/phpunit-profile-asserts

  Sources   Download

MIT

The Requires

 

The Development Requires

  • webd97/phpdoc-md ~0.2.0

by Jean Claveau
by Stanislav Dobrovolskiy

phpunit profile assert