for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Onoi\CallbackContainer\Tests;
use Onoi\CallbackContainer\CallFuncMemorySniffer;
/**
* @covers \Onoi\CallbackContainer\CallFuncMemorySniffer
* @group onoi-callback-container
*
* @license GNU GPL v2+
* @since 2.0
* @author mwjames
*/
class CallFuncMemorySnifferTest extends \PHPUnit_Framework_TestCase {
public function testCanConstruct() {
$this->assertInstanceOf(
'\Onoi\CallbackContainer\CallFuncMemorySniffer',
new CallFuncMemorySniffer()
);
}
public function testCallWithoutArguments() {
$instance = new CallFuncMemorySniffer();
$this->assertEquals(
'Foo',
$instance->call( function(){ return 'Foo'; } )
$this->assertInternalType(
'integer',
$instance->getMemoryUsed()
'float',
$instance->getTimeUsed()
public function testCallWithArguments() {
'Foo-abc',
$instance->call( function( $arg ) { return 'Foo-'. $arg; }, array( 'abc' ) )
public function testInvalidCallThrowsException() {
$this->setExpectedException( 'RuntimeException' );
$instance->call( 'foo' );