public function testMethodCalls() { $def =
new Definition('stdClass'
);
$this->
assertSame($def,
$def->
setMethodCalls([['foo',
['foo'
]]]), '->setMethodCalls() implements a fluent interface'
);
$this->
assertEquals([['foo',
['foo'
]]],
$def->
getMethodCalls(), '->getMethodCalls() returns the methods to call'
);
$this->
assertSame($def,
$def->
addMethodCall('bar',
['bar'
]), '->addMethodCall() implements a fluent interface'
);
$this->
assertEquals([['foo',
['foo'
]],
['bar',
['bar'
]]],
$def->
getMethodCalls(), '->addMethodCall() adds a method to call'
);
$this->
assertSame($def,
$def->
addMethodCall('foobar',
['foobar'
], true
), '->addMethodCall() implements a fluent interface with third parameter'
);
$this->
assertEquals([['foo',
['foo'
]],
['bar',
['bar'
]],
['foobar',
['foobar'
], true
]],
$def->
getMethodCalls(), '->addMethodCall() adds a method to call'
);
$this->
assertTrue($def->
hasMethodCall('bar'
), '->hasMethodCall() returns true if first argument is a method to call registered'
);
$this->
assertFalse($def->
hasMethodCall('no_registered'
), '->hasMethodCall() returns false if first argument is not a method to call registered'
);
$this->
assertSame($def,
$def->
removeMethodCall('bar'
), '->removeMethodCall() implements a fluent interface'
);
$this->
assertTrue($def->
hasMethodCall('foobar'
), '->hasMethodCall() returns true if first argument is a method to call registered'
);
$this->
assertSame($def,
$def->
removeMethodCall('foobar'
), '->removeMethodCall() implements a fluent interface'
);
$this->
assertEquals([['foo',
['foo'
]]],
$def->
getMethodCalls(), '->removeMethodCall() removes a method to call'
);
$this->
assertSame($def,
$def->
setMethodCalls([['foobar',
['foobar'
], true
]]), '->setMethodCalls() implements a fluent interface with third parameter'
);
$this->
assertEquals([['foobar',
['foobar'
], true
]],
$def->
getMethodCalls(), '->addMethodCall() adds a method to call'
);
} public function testExceptionOnEmptyMethodCall() {