Question: How can we increase block.number on Ganache for testing purpose ?
If not possible do you know an alternative like passing X fake transactions to artificially increase block.number.

Or if we have to use a private chain: is it possible to change the time between blocks for faster testing ?

Best regards

Answer: 
I needed a promise-based solution that didn't require installing a third-party library. Copy-pasting from [Ethan Wessel's amazing article on truffle time testing](https://medium.com/fluidity/standing-the-time-of-test-b906fcc374a9):

```
advanceTime = (time) => {
  return new Promise((resolve, reject) => {
    web3.currentProvider.send({
      jsonrpc: '2.0',
      method: 'evm_increaseTime',
      params: [time],
      id: new Date().getTime()
    }, (err, result) => {
      if (err) { return reject(err) }
      return resolve(result)
    })
  })
}

advanceBlock = () => {
  return new Promise((resolve, reject) => {
    web3.currentProvider.send({
      jsonrpc: '2.0',
      method: 'evm_mine',
      id: new Date().getTime()
    }, (err, result) => {
      if (err) { return reject(err) }
      const newBlockHash = web3.eth.getBlock('latest').hash

      return resolve(newBlockHash)
    })
  })
}

takeSnapshot = () => {
  return new Promise((resolve, reject) => {
    web3.currentProvider.send({
      jsonrpc: '2.0',
      method: 'evm_snapshot',
      id: new Date().getTime()
    }, (err, snapshotId) => {
      if (err) { return reject(err) }
      return resolve(snapshotId)
    })
  })
}

revertToSnapShot = (id) => {
  return new Promise((resolve, reject) => {
    web3.currentProvider.send({
      jsonrpc: '2.0',
      method: 'evm_revert',
      params: [id],
      id: new Date().getTime()
    }, (err, result) => {
      if (err) { return reject(err) }
      return resolve(result)
    })
  })
}

advanceTimeAndBlock = async (time) => {
  await advanceTime(time)
  await advanceBlock()
  return Promise.resolve(web3.eth.getBlock('latest'))
}

module.exports = {
  advanceTime,
  advanceBlock,
  advanceTimeAndBlock,
  takeSnapshot,
  revertToSnapShot
}

```
As Rosco Kalis's suggestion of `@openzeppelin/test-helpers`

```bash
npm install --save-dev @openzeppelin/test-helpers

```

My `Node.js` code for contract testing:

```js
const { time } = require("@openzeppelin/test-helpers");
require("@openzeppelin/test-helpers/configure")({
  provider: "http://localhost:7545",
});

async function main() {
  await time.advanceBlock();
  await myTimeRelatedContractMethodCall();
}
main()

```

Further reading : <https://docs.openzeppelin.com/test-helpers/0.5/api#time>