DataSift\Storyplayer\PlayerLib\Story::setDefaultCallbacks PHP Method

setDefaultCallbacks() public method

public setDefaultCallbacks ( ) : void
return void
    public function setDefaultCallbacks()
    {
        // 1: test setup
        if (!$this->hasTestSetup()) {
            $this->addTestSetup(function (StoryTeller $st) {
                $st->usingReporting()->reportNotRequired();
            });
        }
        // 2: pre-test prediction
        if (!$this->hasPreTestPrediction()) {
            $this->addPreTestPrediction(function (StoryTeller $st) {
                $st->usingReporting()->reportShouldAlwaysSucceed();
            });
        }
        // 3: pre-test inspection
        if (!$this->hasPreTestInspection()) {
            $this->addPreTestInspection(function (StoryTeller $st) {
                $st->usingReporting()->reportNotRequired();
            });
        }
        // 4: test action
        //
        // we set no default for this, because we do not want the action
        // to be chosen by StoryPlayer
        //
        // (StoryPlayer chooses one action at random from the set of
        // supplied actions)
        // 5: post-test inspection
        //
        // we set no default for this, because each story must provide
        // this
        // 6: test tear down
        if (!$this->hasTestTeardown()) {
            $this->addTestTeardown(function (StoryTeller $st) {
                $st->usingReporting()->reportNotRequired();
            });
        }
        // all done
    }