File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -150,4 +150,26 @@ public function testWorksWithUmlauts($repository)
150
150
$ files = $ repository ->getCommit (self ::FILE_WITH_UMLAUTS_COMMIT )->getDiff ()->getFiles ();
151
151
$ this ->assertSame ('file_with_umlauts_\303\244\303\266\303\274 ' , $ files [0 ]->getNewName ());
152
152
}
153
+
154
+ public function testEmptyNewFile ()
155
+ {
156
+ $ diff = Diff::parse ("diff --git a/test b/test \nnew file mode 100644 \nindex 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 \n" );
157
+ $ firstFile = $ diff ->getFiles ()[0 ];
158
+
159
+ $ this ->assertTrue ($ firstFile ->isCreation ());
160
+ $ this ->assertFalse ($ firstFile ->isDeletion ());
161
+ $ this ->assertSame ('test ' , $ firstFile ->getNewName ());
162
+ $ this ->assertNull ($ firstFile ->getOldName ());
163
+ }
164
+
165
+ public function testEmptyOldFile ()
166
+ {
167
+ $ diff = Diff::parse ("diff --git a/test b/test \ndeleted file mode 100644 \nindex e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 \n" );
168
+ $ firstFile = $ diff ->getFiles ()[0 ];
169
+
170
+ $ this ->assertFalse ($ firstFile ->isCreation ());
171
+ $ this ->assertTrue ($ firstFile ->isDeletion ());
172
+ $ this ->assertNull ($ firstFile ->getNewName ());
173
+ $ this ->assertSame ('test ' , $ firstFile ->getOldName ());
174
+ }
153
175
}
You can’t perform that action at this time.
0 commit comments