_extendTime is an internal function of TimedCrowdsale which can be called from your crowdsale contract.
The TimedCrowdsale.test.js uses a mock implementation, TimedCrowdsaleImpl.sol:
The mock implementation of a TimedCrowdsale, includes a public function extendTime. Please note this implementation does not have any access control, so any account could call it.
If you want the add the extend time functionality to your crowdsale contract you should create a function in your crowdsale that calls the internal function _extendTime. Though you also need to add some form of access control (e.g. Role-Based Access Control) so that only an account with the role can extend the time.
For example you could do something like this (you would need to create the access control and add a modifier such as onlyTimeExtender)
function extendTime(uint256 closingTime) public onlyTimeExtender {
_extendTime(closingTime);
}
As always, recommend appropriate testing and auditing for your smart contracts.
It’s an easy one to miss. I had to go looking for the contract.
Also don’t forget that you need to add access control as otherwise any account could extend the time for the crowd sale. The mock doesn’t have any access control.
It is worth testing that an account without the role can’t extend the time.