File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 4242 },
4343 "require-dev" : {
4444 "ext-fileinfo" : " *" ,
45+ "phpspec/prophecy" : " ^1.10.2" ,
4546 "phpunit/phpunit" : " ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.20 || ^9.5.9" ,
4647 "psr/log" : " ^1.0"
4748 },
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ abstract class AbstractTest extends TestCase
2020{
2121 const REPOSITORY_URL = 'https://github.com/gitonomy/foobar.git ' ;
2222
23+ const NO_MESSAGE_COMMIT = '011cd0c1625190d2959ee9a8f9f822006d94b661 ' ;
2324 const LONGFILE_COMMIT = '4f17752acc9b7c54ba679291bf24cb7d354f0f4f ' ;
2425 const BEFORE_LONGFILE_COMMIT = 'e0ec50e2af75fa35485513f60b2e658e245227e9 ' ;
2526 const LONGMESSAGE_COMMIT = '3febd664b6886344a9b32d70657687ea4b1b4fab ' ;
Original file line number Diff line number Diff line change 1616use Gitonomy \Git \Diff \Diff ;
1717use Gitonomy \Git \Exception \InvalidArgumentException ;
1818use Gitonomy \Git \Exception \ReferenceNotFoundException ;
19+ use Gitonomy \Git \Repository ;
1920use Gitonomy \Git \Tree ;
2021
2122class CommitTest extends AbstractTest
@@ -189,6 +190,31 @@ public function testGetMessage($repository)
189190 $ this ->assertEquals ('add a long file ' ."\n" , $ commit ->getMessage ());
190191 }
191192
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+
192218 /**
193219 * This test ensures that GPG signed commits does not break the reading of a commit
194220 * message.
You can’t perform that action at this time.
0 commit comments