mageekguy\atoum\asserters\object::isCloneOf PHP Method

isCloneOf() public method

public isCloneOf ( $object, $failMessage = null )
    public function isCloneOf($object, $failMessage = null)
    {
        if ($failMessage === null) {
            $failMessage = $this->_('%s is not a clone of %s', $this, $this->getTypeOf($object));
        }
        return $this->isEqualTo($object, $failMessage)->isNotIdenticalTo($object, $failMessage);
    }

Usage Example

Example #1
0
 public function testIsCloneOf()
 {
     $this->if($asserter = new asserters\object($generator = new asserter\generator()))->then->exception(function () use($asserter) {
         $asserter->isCloneOf($asserter);
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Object is undefined')->if($asserter->setWith($asserter))->then->exception(function () use($asserter) {
         $asserter->isCloneOf($asserter);
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('%s is not a clone of %s'), $asserter, $asserter))->if($clonedAsserter = clone $asserter)->then->object($asserter->isCloneOf($clonedAsserter))->isIdenticalTo($asserter);
 }