Skip to content

Commit aaabeda

Browse files
committed
fix amqp tests.
1 parent 6999971 commit aaabeda

File tree

4 files changed

+14
-29
lines changed

4 files changed

+14
-29
lines changed

bin/pre-commit

+11-26
Original file line numberDiff line numberDiff line change
@@ -129,25 +129,17 @@ function runPhpCsFixer()
129129

130130
function runPhpstan()
131131
{
132-
$filesWithErrors = array();
133-
foreach (getFilesToFix() as $file) {
134-
$output = '';
135-
$returnCode = null;
132+
$output = '';
133+
$returnCode = null;
136134

137-
exec(sprintf(
138-
'docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon %s',
139-
$file
140-
), $output, $returnCode);
135+
exec(sprintf(
136+
'docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon %s',
137+
implode(' ', getFilesToFix())
138+
), $output, $returnCode);
141139

142-
if ($returnCode) {
143-
$filesWithErrors[] = [$file, $output];
144-
}
145-
}
146-
147-
return $filesWithErrors;
140+
return $returnCode ? $output : false;
148141
}
149142

150-
151143
echo sprintf('Found %s staged files', count(getFilesToFix())).PHP_EOL;
152144

153145
$phpSyntaxErrors = runPhpLint();
@@ -175,18 +167,11 @@ if ($phpCSFixerErrors) {
175167
}
176168

177169
$phpStanErrors = runPhpstan();
178-
var_dump($phpStanErrors);
179170
if ($phpStanErrors) {
180-
echo "Phpstan errors." . PHP_EOL;
181-
echo "List of changed files:" . PHP_EOL;
182-
183-
foreach ($phpStanErrors as list($file, $error)) {
184-
echo $file . PHP_EOL;
185-
echo array_walk_recursive($error, function($item) {
186-
echo $item.PHP_EOL;
187-
}) . PHP_EOL;
188-
echo PHP_EOL;
189-
}
171+
echo array_walk_recursive($phpStanErrors, function($item) {
172+
echo $item.PHP_EOL;
173+
}) . PHP_EOL;
174+
echo PHP_EOL;
190175

191176
exit(1);
192177
}

pkg/amqp-bunny/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function createContext()
2323
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
2424

2525
$context = $factory->createContext();
26-
$context->setQos(0, 5, false);
26+
$context->setQos(0, 1, false);
2727

2828
return $context;
2929
}

pkg/amqp-ext/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function createContext()
2323
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
2424

2525
$context = $factory->createContext();
26-
$context->setQos(0, 5, false);
26+
$context->setQos(0, 1, false);
2727

2828
return $context;
2929
}

pkg/amqp-lib/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function createContext()
2323
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
2424

2525
$context = $factory->createContext();
26-
$context->setQos(0, 5, false);
26+
$context->setQos(0, 1, false);
2727

2828
return $context;
2929
}

0 commit comments

Comments
 (0)