19 $output = $instance->format( $input );
20 $this->assertEquals( $expectedOutput,
$output );
24 $diff = $this->getMockBuilder(
'Diff' )
25 ->disableOriginalConstructor()
27 $diff->expects( $this->any() )
28 ->method(
'getEdits' )
29 ->will( $this->returnValue( $edits ) );
34 $diffOp = $this->getMockBuilder(
'DiffOp' )
35 ->disableOriginalConstructor()
37 $diffOp->expects( $this->any() )
39 ->will( $this->returnValue(
$type ) );
40 $diffOp->expects( $this->any() )
42 ->will( $this->returnValue( $orig ) );
43 if (
$type ===
'change' ) {
44 $diffOp->expects( $this->any() )
45 ->method(
'getClosing' )
46 ->with( $this->isType(
'integer' ) )
47 ->will( $this->returnCallback(
function() {
51 $diffOp->expects( $this->any() )
52 ->method(
'getClosing' )
53 ->will( $this->returnValue( $closing ) );
59 $emptyArrayTestCases =
array(
71 $otherTestCases =
array();
72 $otherTestCases[] =
array(
74 array(
array(
'action' =>
'add',
'new' =>
'a1',
'newline' => 1 ) ),
76 $otherTestCases[] =
array(
79 array(
'action' =>
'add',
'new' =>
'a1',
'newline' => 1 ),
80 array(
'action' =>
'add',
'new' =>
'a2',
'newline' => 2 ),
83 $otherTestCases[] =
array(
85 array(
array(
'action' =>
'delete',
'old' =>
'd1',
'oldline' => 1 ) ),
87 $otherTestCases[] =
array(
90 array(
'action' =>
'delete',
'old' =>
'd1',
'oldline' => 1 ),
91 array(
'action' =>
'delete',
'old' =>
'd2',
'oldline' => 2 ),
94 $otherTestCases[] =
array(
96 array(
array(
'action' =>
'change',
'old' =>
'd1',
'new' =>
'mockLine',
'newline' => 1,
'oldline' => 1 ) ),
98 $otherTestCases[] =
array(
101 array(
'action' =>
'change',
'old' =>
'd1',
'new' =>
'mockLine',
'newline' => 1,
'oldline' => 1 ),
102 array(
'action' =>
'change',
'old' =>
'd2',
'new' =>
'mockLine',
'newline' => 2,
'oldline' => 2 ),
106 $testCases =
array();
107 foreach ( $emptyArrayTestCases
as $testCase ) {
110 foreach ( $otherTestCases
as $testCase ) {
111 $testCases[] =
array( $testCase[0], $testCase[1] );