Skip to content

Instantly share code, notes, and snippets.

@odinuv
Created September 27, 2018 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odinuv/01fb5a1d64aa6dfa83c579679d2fad1d to your computer and use it in GitHub Desktop.
Save odinuv/01fb5a1d64aa6dfa83c579679d2fad1d to your computer and use it in GitHub Desktop.
Testing the untestable: Test network kill during fetch
<?php
public function testNetworkKillerFetch(): void
{
$this->setupLargeTable();
ErrorHandler::register(null, true);
$stmt = $this->taintedPdo->query('SELECT * FROM largeTable LIMIT 100000');
$stmt->execute();
self::expectException(\ErrorException::class);
self::expectExceptionMessage('Warning: Empty row packet body');
$this->killerEnabled = 'fetch';
while ($row = $stmt->fetch()) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment