How do I mock get_adjacent_post for testing

I used WP_Mock for a long time, until I built Brain Monkey to overcome some problems I found working with it.

Using Brain Monkey you can:

use Brain\Monkey\Functions;

Functions::when('get_adjacent_post')->alias(function() {
  // mock here...
});

or

Functions::expect('get_adjacent_post')
  ->atLeast()
  ->once()
  ->with( true, '', true, 'topic' )
  ->andReturnUsing(function( $in_same_term, $excluded_terms, $previous ) {
     // mock here
  });

This latter syntax comes from Mockery.

Brain Monkey, just like WP_Mock, has an API to also mock WordPress hooks.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)