public function assert()
    {
        // fetch data
        $data = $this->fetchData();
        if (!$data) {
            throw new ContentNotFound("Fetched snapshot is empty.");
        }

        $this->load();

        if (!$this->dataSet) {
            $this->printDebug('Snapshot is empty. Updating snapshot...');
            $this->dataSet = $data;
            $this->save();
            return;
        }

        try {
            $this->assertData($data);
            $this->printDebug('Data matches snapshot');
        } catch (AssertionFailedError $exception) {
            $this->printDebug('Snapshot assertion failed');

            if (!is_bool($this->refresh)) {
                $confirm = Debug::confirm('Should we update snapshot with fresh data? (Y/n) ');
            } else {
                $confirm = $this->refresh;
            }

            if ($confirm) {
                $this->dataSet = $data;
                $this->save();
                $this->printDebug('Snapshot data updated');
                return;
            }

            $this->fail($exception->getMessage());
        }
    }
public function assert()
    {
        // fetch data
        $data = $this->fetchData();
        if (!$data) {
            throw new ContentNotFound("Fetched snapshot is empty.");
        }

        $this->load();

        if (!$this->dataSet) {
            $this->printDebug('Snapshot is empty. Updating snapshot...');
            $this->dataSet = $data;
            $this->save();
            return;
        }

        try {
            $this->assertData($data);
            $this->printDebug('Data matches snapshot');
        } catch (AssertionFailedError $exception) {
            $this->printDebug('Snapshot assertion failed');

            if (!is_bool($this->refresh)) {
                $confirm = Debug::confirm('Should we update snapshot with fresh data? (Y/n) ');
            } else {
                $confirm = $this->refresh;
            }

            if ($confirm) {
                $this->dataSet = $data;
                $this->save();
                $this->printDebug('Snapshot data updated');
                return;
            }

            $this->fail($exception->getMessage());
        }
    }
public function assert ( ) { // fetch data $ data = $ this -> fetchData ( ) ; if ( ! $ data ) { throw new ContentNotFound ( "Fetched snapshot is empty." ) ; } $ this -> load ( ) ; if ( ! $ this -> dataSet ) { $ this -> printDebug ( 'Snapshot is empty. Updating snapshot...' ) ; $ this -> dataSet = $ data ; $ this -> save ( ) ; return ; } try { $ this -> assertData ( $ data ) ; $ this -> printDebug ( 'Data matches snapshot' ) ; } catch ( AssertionFailedError $ exception ) { $ this -> printDebug ( 'Snapshot assertion failed' ) ; if ( ! is_bool ( $ this -> refresh ) ) { $ confirm = Debug :: confirm ( 'Should we update snapshot with fresh data? (Y/n) ' ) ; } else { $ confirm = $ this -> refresh ; } if ( $ confirm ) { $ this -> dataSet = $ data ; $ this -> save ( ) ; $ this -> printDebug ( 'Snapshot data updated' ) ; return ; } $ this -> fail ( $ exception -> getMessage ( ) ) ; } }
Performs assertion for data sets
Performs assertion for data sets