Operations for Laravel
Testing
Testing
Code that starts operations shouldn't need a migrated table. Compose
InteractsWithOperations into your base TestCase and swap in FakeOperations:
use Cbox\Operations\Testing\InteractsWithOperations;
class TestCase extends \Orchestra\Testbench\TestCase
{
use InteractsWithOperations;
}
it('starts a deploy operation', function () {
$ops = $this->fakeOperations();
app(DeploymentPipeline::class)->run('wl_123', ['build', 'release']);
$ops->assertStarted('deploy');
$ops->assertStepAdvanced($ops->kinds()->first(), 'build'); // by id in practice
});
Available assertions: assertStarted(kind), assertNothingStarted(),
assertStepAdvanced(id, step), assertCompleted(id), assertFailed(id).
The package's own suite exercises the real manager against a real database — the fake is for everyone downstream.