From 0f16f98871d70e451a7a04c7da29db35457a98ae Mon Sep 17 00:00:00 2001 From: Anatolij Vasilev Date: Tue, 4 Oct 2022 14:52:46 +0200 Subject: [PATCH 1/5] added tests for empty commit messages --- tests/Gitonomy/Git/Tests/AbstractTest.php | 1 + tests/Gitonomy/Git/Tests/CommitTest.php | 24 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/tests/Gitonomy/Git/Tests/AbstractTest.php b/tests/Gitonomy/Git/Tests/AbstractTest.php index d586eda6..0b9a51b6 100644 --- a/tests/Gitonomy/Git/Tests/AbstractTest.php +++ b/tests/Gitonomy/Git/Tests/AbstractTest.php @@ -20,6 +20,7 @@ abstract class AbstractTest extends TestCase { const REPOSITORY_URL = 'https://github.com/gitonomy/foobar.git'; + const NO_MESSAGE_COMMIT = '011cd0c1625190d2959ee9a8f9f822006d94b661'; const LONGFILE_COMMIT = '4f17752acc9b7c54ba679291bf24cb7d354f0f4f'; const BEFORE_LONGFILE_COMMIT = 'e0ec50e2af75fa35485513f60b2e658e245227e9'; const LONGMESSAGE_COMMIT = '3febd664b6886344a9b32d70657687ea4b1b4fab'; diff --git a/tests/Gitonomy/Git/Tests/CommitTest.php b/tests/Gitonomy/Git/Tests/CommitTest.php index 8dca9c40..575f05c0 100644 --- a/tests/Gitonomy/Git/Tests/CommitTest.php +++ b/tests/Gitonomy/Git/Tests/CommitTest.php @@ -16,6 +16,7 @@ use Gitonomy\Git\Diff\Diff; use Gitonomy\Git\Exception\InvalidArgumentException; use Gitonomy\Git\Exception\ReferenceNotFoundException; +use Gitonomy\Git\Repository; use Gitonomy\Git\Tree; class CommitTest extends AbstractTest @@ -189,6 +190,29 @@ public function testGetMessage($repository) $this->assertEquals('add a long file'."\n", $commit->getMessage()); } + /** + * @dataProvider provideFoobar + * @param $repository Repository + */ + public function testGetEmptyMessage($repository) + { + $commit = $repository->getCommit(self::NO_MESSAGE_COMMIT); + + $this->assertEquals('', $commit->getMessage()); + } + + /** + * @dataProvider provideFoobar + * @param $repository Repository + */ + public function testGetEmptyMessageFromLog($repository) + { + $commit = $repository->getCommit(self::NO_MESSAGE_COMMIT); + $commitMessageFromLog = $commit->getLog()->getCommits()[0]->getMessage(); + + $this->assertEquals('', $commitMessageFromLog); + } + /** * This test ensures that GPG signed commits does not break the reading of a commit * message. From a3bd8a533ebeac4611d51cb617b93b91e68eb48a Mon Sep 17 00:00:00 2001 From: Anatolij Vasilev Date: Tue, 4 Oct 2022 15:03:10 +0200 Subject: [PATCH 2/5] cosmetic changes for continuous-integration/styleci/pr --- tests/Gitonomy/Git/Tests/CommitTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Gitonomy/Git/Tests/CommitTest.php b/tests/Gitonomy/Git/Tests/CommitTest.php index 575f05c0..7d094648 100644 --- a/tests/Gitonomy/Git/Tests/CommitTest.php +++ b/tests/Gitonomy/Git/Tests/CommitTest.php @@ -192,6 +192,7 @@ public function testGetMessage($repository) /** * @dataProvider provideFoobar + * * @param $repository Repository */ public function testGetEmptyMessage($repository) @@ -203,6 +204,7 @@ public function testGetEmptyMessage($repository) /** * @dataProvider provideFoobar + * * @param $repository Repository */ public function testGetEmptyMessageFromLog($repository) From f753f738c91d6addf8e40d046c29bd64c522e51b Mon Sep 17 00:00:00 2001 From: Anatolij Vasilev Date: Tue, 4 Oct 2022 15:07:00 +0200 Subject: [PATCH 3/5] added phpspec/prophecy to composer-json, so the tests pass --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 417c7631..f2a58c76 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,8 @@ "require-dev": { "ext-fileinfo": "*", "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.20 || ^9.5.9", - "psr/log": "^1.0" + "psr/log": "^1.0", + "phpspec/prophecy": "^1.15" }, "suggest": { "ext-fileinfo": "Required to determine the mimetype of a blob", From 41a854204d02ad7ca5ec6d0bbdb8b9ebf0850c49 Mon Sep 17 00:00:00 2001 From: Anatolij Vasilev Date: Tue, 4 Oct 2022 15:10:59 +0200 Subject: [PATCH 4/5] added phpspec/prophecy compatibility with php 5.6 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f2a58c76..fc176c7e 100644 --- a/composer.json +++ b/composer.json @@ -44,7 +44,7 @@ "ext-fileinfo": "*", "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.20 || ^9.5.9", "psr/log": "^1.0", - "phpspec/prophecy": "^1.15" + "phpspec/prophecy": "^1.10.2 || ^1.15" }, "suggest": { "ext-fileinfo": "Required to determine the mimetype of a blob", From fd071d15cb54eb79500ab05c336dcbbe0ea61e8d Mon Sep 17 00:00:00 2001 From: Anatolij Vasilev Date: Tue, 4 Oct 2022 15:55:37 +0200 Subject: [PATCH 5/5] sorted composer.json alphabetically and removed "^1.15" --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index fc176c7e..86735c14 100644 --- a/composer.json +++ b/composer.json @@ -42,9 +42,9 @@ }, "require-dev": { "ext-fileinfo": "*", + "phpspec/prophecy": "^1.10.2", "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.20 || ^9.5.9", - "psr/log": "^1.0", - "phpspec/prophecy": "^1.10.2 || ^1.15" + "psr/log": "^1.0" }, "suggest": { "ext-fileinfo": "Required to determine the mimetype of a blob",