%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php
class SnapshotCest
{
public function _openSnapshotSuite(CliGuy $I)
{
$I->amInPath('tests/data/snapshots');
}
/**
* @before _openSnapshotSuite
* @param CliGuy $I
*/
public function runAllSnapshotTests(CliGuy $I)
{
$I->executeCommand('run tests/SnapshotDataCest.php');
$I->seeInShellOutput('OK (3 tests');
$I->seeInShellOutput('Load snapshot and skip refresh');
$I->seeInShellOutput('Load snapshot and refresh');
}
/**
* @before _openSnapshotSuite
* @param CliGuy $I
*/
public function runSnapshotRefresh(CliGuy $I)
{
$I->executeCommand('run tests/SnapshotDataCest.php:loadSnapshotAndRefresh --debug --no-colors');
$I->seeInShellOutput('Snapshot\UserSnapshot: assert');
$I->seeInShellOutput('I grab column from database');
$I->seeInShellOutput('Snapshot assertion failed');
$I->seeInShellOutput('Snapshot data updated');
}
/**
* @before _openSnapshotSuite
* @param CliGuy $I
*/
public function runSnapshotRefreshFail(CliGuy $I)
{
$I->executeCommand('run tests/SnapshotDataCest.php:loadSnapshotAndSkipRefresh --debug --no-colors');
$I->seeInShellOutput('Snapshot\UserSnapshot: assert');
$I->seeInShellOutput('I grab column from database');
$I->seeInShellOutput('Snapshot assertion failed');
$I->dontSeeInShellOutput('Snapshot data updated');
}
/**
* @before _openSnapshotSuite
* @param CliGuy $I
*/
public function loadSnapshotInDebugAndFailOnProd(CliGuy $I)
{
$I->executeCommand('run tests/SnapshotFailCest.php --debug');
$I->seeInShellOutput('PASSED');
$I->executeCommand('run tests/SnapshotFailCest.php --no-exit');
$I->seeInShellOutput('FAILURES');
$I->seeInShellOutput('Snapshot doesn\'t match real data');
}
public function generateGlobalSnapshot(CliGuy\GeneratorSteps $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('generate:snapshot Login');
$I->seeFileWithGeneratedClass('Login', 'tests/_support/Snapshot');
$I->dontSeeInThisFile('public function __construct(\DumbGuy $I)');
$I->seeFileFound('tests/_bootstrap.php');
}
public function generateSuiteSnapshot(CliGuy\GeneratorSteps $I)
{
$I->amInPath('tests/data/sandbox');
$I->executeCommand('generate:snapshot dummy Login');
$I->seeFileWithGeneratedClass('Login', 'tests/_support/Snapshot/Dummy');
$I->seeInThisFile('namespace Snapshot\\Dummy;');
$I->seeInThisFile('class Login');
$I->seeInThisFile('protected $dumbGuy;');
$I->seeInThisFile('public function __construct(\DumbGuy $I)');
}
public function generateGlobalSnapshotInDifferentPath(CliGuy\GeneratorSteps $I)
{
$I->executeCommand('generate:snapshot Login -c tests/data/sandbox');
$I->amInPath('tests/data/sandbox');
$I->seeFileWithGeneratedClass('Login', 'tests/_support/Snapshot');
$I->dontSeeInThisFile('public function __construct(\DumbGuy $I)');
$I->seeFileFound('tests/_bootstrap.php');
}
}