Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

Commit

Permalink
Fix block in skip-linting process, fixes #34
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubOnderka committed Aug 16, 2014
1 parent 77d3245 commit 0bdd183
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/skip-linting.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php
$stdin = fopen('php://stdin', 'r');
$input = stream_get_contents($stdin);
fclose($stdin);

while($file = fgets($stdin)) {
foreach (explode("\n", $input) as $file) {
$skip = false;
$file = rtrim($file);
$f = @fopen($file, 'r');
if ($f) {
$firstLine = fgets($f);
Expand All @@ -19,4 +20,3 @@
echo "$file;" . ($skip ? '1' : '0') . "\n";
}

fclose($stdin);
31 changes: 31 additions & 0 deletions tests/SkipLintProcess.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

/**
* @testCase
*/

require __DIR__ . '/../vendor/nette/tester/Tester/bootstrap.php';
require_once __DIR__ . '/../src/Process.php';

use Tester\Assert;

$filesToCheck = [
__DIR__ . '/skip-on-5.3/class.php',
__DIR__ . '/skip-on-5.3/trait.php',
];

for ($i = 0; $i < 15; $i++) {
$filesToCheck = array_merge($filesToCheck, $filesToCheck);
}

$process = new \JakubOnderka\PhpParallelLint\SkipLintProcess('php', $filesToCheck);

while (!$process->isFinished()) {
usleep(100);
$process->getChunk();
}

foreach ($filesToCheck as $fileToCheck) {
$status = $process->isSkipped($fileToCheck);
Assert::notEqual(null, $status);
}

0 comments on commit 0bdd183

Please sign in to comment.