Skip to content

Commit 40cd969

Browse files
committed
refactor(tests) Created groupt git for FileUtilsTest
1 parent 40bd4d6 commit 40cd969

File tree

4 files changed

+19
-124
lines changed

4 files changed

+19
-124
lines changed

.github/workflows/main-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ jobs:
6363
echo -e "\e[42m\e[30m**** Main Test Suite ****\033[0m"
6464
vendor/bin/phpunit --order-by random
6565
echo -e "\e[42m\e[30m**** GitfilesTest ****\033[0m"
66-
vendor/bin/phpunit tests/Integration/FileUtilsTest.php
66+
vendor/bin/phpunit --group git
6767
shell: bash

phpunit.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@
66
</testsuite>
77
<testsuite name="Integration">
88
<directory>./tests/Integration</directory>
9-
<exclude>./tests/Integration/FileUtilsTest.php</exclude>
109
</testsuite>
1110
<testsuite name="System">
1211
<directory>./tests/System</directory>
13-
<exclude>./tests/System/ReleaseTest.php</exclude>
1412
</testsuite>
1513
</testsuites>
1614
<groups>
1715
<exclude>
1816
<group>release</group>
17+
<group>git</group>
1918
</exclude>
2019
</groups>
2120
<coverage processUncoveredFiles="true">

tests/Integration/FileUtilsTest.php

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,22 @@
44

55
use Wtyd\GitHooks\Utils\FileUtils;
66
use Illuminate\Container\Container;
7+
use Tests\ConsoleTestCase;
78
use Tests\Utils\PhpFileBuilder;
89
use Tests\SystemTestCase;
910

1011
/**
1112
* Before executing this test suite after any changes, you must commit these changes
1213
* @group git
1314
*/
14-
class FileUtilsTest extends SystemTestCase
15+
class FileUtilsTest extends ConsoleTestCase
1516
{
1617
protected static $gitFilesPathTest = __DIR__ . '/../../testsDir/gitTests';
1718

1819
protected function setUp(): void
1920
{
2021
$this->deleteDirStructure();
2122

22-
$this->hiddenConsoleOutput();
23-
2423
$this->createDirStructure();
2524
mkdir(self::$gitFilesPathTest);
2625

@@ -55,28 +54,28 @@ function it_retrieve_modified_files()
5554
}
5655

5756
/** @test */
58-
// function it_retrieve_an_empty_array_when_there_are_no_modified_files()
59-
// {
60-
// $gitFiles = $this->container->make(FileUtils::class);
57+
function it_retrieve_an_empty_array_when_there_are_no_modified_files()
58+
{
59+
$gitFiles = $this->container->make(FileUtils::class);
6160

62-
// $modifiedFiles = $gitFiles->getModifiedFiles();
61+
$modifiedFiles = $gitFiles->getModifiedFiles();
6362

64-
// $this->assertEquals([], $modifiedFiles);
65-
// }
63+
$this->assertEquals([], $modifiedFiles);
64+
}
6665

67-
// /** @test */
68-
// function it_retrieve_an_empty_array_when_the_modified_files_there_are_no_added_to_the_git_stage()
69-
// {
70-
// $fileBuilder = new PhpFileBuilder('NewFile');
66+
/** @test */
67+
function it_retrieve_an_empty_array_when_the_modified_files_there_are_no_added_to_the_git_stage()
68+
{
69+
$fileBuilder = new PhpFileBuilder('NewFile');
7170

72-
// file_put_contents(self::$gitFilesPathTest . '/NewFile.php', $fileBuilder->build());
71+
file_put_contents(self::$gitFilesPathTest . '/NewFile.php', $fileBuilder->build());
7372

74-
// $gitFiles = $this->container->make(FileUtils::class);
73+
$gitFiles = $this->container->make(FileUtils::class);
7574

76-
// $modifiedFiles = $gitFiles->getModifiedFiles();
75+
$modifiedFiles = $gitFiles->getModifiedFiles();
7776

78-
// $this->assertEquals([], $modifiedFiles);
79-
// }
77+
$this->assertEquals([], $modifiedFiles);
78+
}
8079

8180
/**
8281
* @param string $path Absolute path. For example: /var/www/html/githooks/tests/NewFile.php

tests/System/ReleaseTest.php

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)