mageekguy\atoum\asserters\mock::wasNotCalled PHP Method

wasNotCalled() public method

public wasNotCalled ( $failMessage = null )
    public function wasNotCalled($failMessage = null)
    {
        if ($this->adapterIsSet()->adapter->getCallsNumber() <= 0) {
            $this->pass();
        } else {
            $this->fail($failMessage ?: $this->_('%s is called', $this->adapter->getMockClass()));
        }
        return $this;
    }

Usage Example

Beispiel #1
0
 public function testWasNotCalled()
 {
     $this->if($asserter = new sut($generator = new asserter\generator()))->then->exception(function () use($asserter) {
         $asserter->wasNotCalled();
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Mock is undefined')->if($adapter = new atoum\test\adapter())->and($adapter->class_exists = true)->and($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\mock($adapter)))->and($mock->getMockController()->resetCalls())->then->object($asserter->wasNotCalled())->isIdenticalTo($asserter)->if($mock->getMockController()->{$method = __FUNCTION__} = function () {
     })->and($mock->{$method}())->then->exception(function () use($asserter, &$failMessage) {
         $asserter->wasNotCalled($failMessage = uniqid());
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage($failMessage);
 }