true, 'size' => 'thumbnail', 'text' => false, ); /** * @ticket 45708 * * @dataProvider data_get_adjacent_image_link */ public function test_get_adjacent_image_link( $current_attachment_index, $expected_attachment_index, $expected, array $args = array() ) { list( $expected, $args ) = $this->setup_test_scenario( $current_attachment_index, $expected_attachment_index, $expected, $args ); $actual = get_adjacent_image_link( ...$args ); $this->assertSame( $expected, $actual ); } public function data_get_adjacent_image_link() { return array( // Happy paths. 'when has previous link' => array( 'current_attachment_index' => 3, 'expected_attachment_index' => 2, 'expected' => '', ), 'with text when has previous link' => array( 'current_attachment_index' => 3, 'expected_attachment_index' => 2, 'expected' => 'Some text', 'args' => array( 'text' => 'Some text' ), ), 'when has next link' => array( 'current_attachment_index' => 4, 'expected_attachment_index' => 5, 'expected' => '', 'args' => array( 'prev' => false ), ), 'with text when has next link' => array( 'current_attachment_index' => 4, 'expected_attachment_index' => 5, 'expected' => 'Some text', 'args' => array( 'prev' => false, 'text' => 'Some text', ), ), // Unhappy paths. 'when no previous link' => array( 'current_attachment_index' => 1, 'expected_attachment_index' => 0, 'expected' => '', ), 'with text when no previous link' => array( 'current_attachment_index' => 1, 'expected_attachment_index' => 0, 'expected' => '', 'args' => array( 'text' => 'Some text' ), ), 'when no next link' => array( 'current_attachment_index' => 5, 'expected_attachment_index' => 0, 'expected' => '', 'args' => array( 'prev' => false ), ), 'with text when no next link' => array( 'current_attachment_index' => 5, 'expected_attachment_index' => 0, 'expected' => '', 'args' => array( 'prev' => false, 'text' => 'Some text', ), ), ); } }