Skip to content

Commit b9ce7c0

Browse files
committed
Adds missing test
1 parent eeaae76 commit b9ce7c0

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

tests/Commands/ValidateCommandTest.php

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,6 +2228,62 @@ public function detectsNonGitattributeContentInStdinInput(): void
22282228
->assertFaulty();
22292229
}
22302230

2231+
#[Test]
2232+
#[RunInSeparateProcess]
2233+
public function detectsValidGitattributeContentInStdinInput(): void
2234+
{
2235+
$artifactFilenames = [
2236+
'.buildignore',
2237+
'phpspec.yml.dist',
2238+
'.php_cs.cache',
2239+
'composer.lock',
2240+
];
2241+
2242+
$this->createTemporaryFiles(
2243+
$artifactFilenames,
2244+
['specs']
2245+
);
2246+
2247+
$gitattributesContent = <<<CONTENT
2248+
* text=auto
2249+
2250+
.buildignore export-ignore
2251+
phpspec.yml.dist export-ignore
2252+
specs/ export-ignore
2253+
.php_cs.cache export-ignore
2254+
composer.lock export-ignore
2255+
.gitignore export-ignore
2256+
.gitattributes export-ignore
2257+
2258+
CONTENT;
2259+
2260+
$this->createTemporaryGitattributesFile($gitattributesContent);
2261+
2262+
$application = new Application();
2263+
$fakeInputReader = new FakeInputReader();
2264+
$fakeInputReader->set($gitattributesContent);
2265+
2266+
$analyserCommand = new ValidateCommand(
2267+
new Analyser(new Finder(new PhpPreset())),
2268+
new Validator(new Archive($this->temporaryDirectory)),
2269+
$fakeInputReader
2270+
);
2271+
2272+
$application->add($analyserCommand);
2273+
$command = $application->find('validate');
2274+
2275+
$expectedDisplay = <<<CONTENT
2276+
The provided .gitattributes content is considered valid.
2277+
2278+
CONTENT;
2279+
2280+
TestCommand::for($command)
2281+
->addOption('stdin-input')
2282+
->execute()
2283+
->assertOutputContains($expectedDisplay)
2284+
->assertSuccessful();
2285+
}
2286+
22312287
/**
22322288
* @return array
22332289
*/

0 commit comments

Comments
 (0)