Kevin Burke
Kevin Burke

Reputation: 64824

Incomplete tests when using Mockery

Let's say I'm testing that a method calls another method in php

<?php
use \Mockery as m;

public function testMethodCallsOtherMethod {
    $m = m::Mock(new StdClass);
    $m->assertCalledWith('methodName')->once();
    doSomethingSoMCallsMethodName($m);
}

function tearDown() {
    m::close();
}

When I run this test with PHPUnit it reports the test is incomplete, because there's no PHPUnit assertion in the test. However it is a valid test and will error if the method is not called. Any good solutions for getting PHPUnit to realize this is a valid test?

Upvotes: 2

Views: 109

Answers (1)

Fabian Schmengler
Fabian Schmengler

Reputation: 24551

A simple workaround would be a dummy assertion:

$this->assertTrue(true);

Upvotes: 1

Related Questions