File tree 3 files changed +28
-0
lines changed
3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 42
42
},
43
43
"require-dev" : {
44
44
"ext-fileinfo" : " *" ,
45
+ "phpspec/prophecy" : " ^1.10.2" ,
45
46
"phpunit/phpunit" : " ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.20 || ^9.5.9" ,
46
47
"psr/log" : " ^1.0"
47
48
},
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ abstract class AbstractTest extends TestCase
20
20
{
21
21
const REPOSITORY_URL = 'https://github.com/gitonomy/foobar.git ' ;
22
22
23
+ const NO_MESSAGE_COMMIT = '011cd0c1625190d2959ee9a8f9f822006d94b661 ' ;
23
24
const LONGFILE_COMMIT = '4f17752acc9b7c54ba679291bf24cb7d354f0f4f ' ;
24
25
const BEFORE_LONGFILE_COMMIT = 'e0ec50e2af75fa35485513f60b2e658e245227e9 ' ;
25
26
const LONGMESSAGE_COMMIT = '3febd664b6886344a9b32d70657687ea4b1b4fab ' ;
Original file line number Diff line number Diff line change 16
16
use Gitonomy \Git \Diff \Diff ;
17
17
use Gitonomy \Git \Exception \InvalidArgumentException ;
18
18
use Gitonomy \Git \Exception \ReferenceNotFoundException ;
19
+ use Gitonomy \Git \Repository ;
19
20
use Gitonomy \Git \Tree ;
20
21
21
22
class CommitTest extends AbstractTest
@@ -189,6 +190,31 @@ public function testGetMessage($repository)
189
190
$ this ->assertEquals ('add a long file ' ."\n" , $ commit ->getMessage ());
190
191
}
191
192
193
+ /**
194
+ * @dataProvider provideFoobar
195
+ *
196
+ * @param $repository Repository
197
+ */
198
+ public function testGetEmptyMessage ($ repository )
199
+ {
200
+ $ commit = $ repository ->getCommit (self ::NO_MESSAGE_COMMIT );
201
+
202
+ $ this ->assertEquals ('' , $ commit ->getMessage ());
203
+ }
204
+
205
+ /**
206
+ * @dataProvider provideFoobar
207
+ *
208
+ * @param $repository Repository
209
+ */
210
+ public function testGetEmptyMessageFromLog ($ repository )
211
+ {
212
+ $ commit = $ repository ->getCommit (self ::NO_MESSAGE_COMMIT );
213
+ $ commitMessageFromLog = $ commit ->getLog ()->getCommits ()[0 ]->getMessage ();
214
+
215
+ $ this ->assertEquals ('' , $ commitMessageFromLog );
216
+ }
217
+
192
218
/**
193
219
* This test ensures that GPG signed commits does not break the reading of a commit
194
220
* message.
You can’t perform that action at this time.
0 commit comments