$def =
new Definition('stdClass'
);
$this->
assertSame($def,
$def->
setArguments(['foo'
]), '->setArguments() implements a fluent interface'
);
$this->
assertEquals(['foo'
],
$def->
getArguments(), '->getArguments() returns the arguments'
);
$this->
assertSame($def,
$def->
addArgument('bar'
), '->addArgument() implements a fluent interface'
);
$this->
assertEquals(['foo', 'bar'
],
$def->
getArguments(), '->addArgument() adds an argument'
);
} 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'
);