PHP code example of fkupper / module-dynamic-snapshots

1. Go to this page and download the library: Download fkupper/module-dynamic-snapshots library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fkupper / module-dynamic-snapshots example snippets


class FooSnapshot extends DynamicSnapshot
{
    /**
     * @var Tester
     */
    protected $tester;

    public function fetchDynamicData()
    {
        // fetch snapshot from a helper method or snomething and return
        return $this->tester->fetchDataFromSomewhere();
    }
}

class FooSnapshot extends DynamicSnapshot
{
    /**
     * @var Tester
     */
    protected $tester;

    public function fetchDynamicData()
    {
        $this->setSubstitutions(
            // $this->tester->getAppVersion() returns "v8.8.9"
            'app_version' => $this->tester->getAppVersion()
        );
        // fetch snapshot from a helper method or snomething and return
        return $this->tester->fetchDataFromXml();
    }
}

class FooSnapshot extends DynamicSnapshot
{
    protected $tester;

    public function __constructor(Tester $I)
    {
        $this->tester = $I;
        $this->setWrappers('{', '}');
        // $this->setWrappers('(', ')');
        // $this->setWrappers('<', '>');
    }
}

$this->setIgnoredLinesPatterns(['/^.*favicon.*$/m']);
 shell
php ./vendor/bin/codecept generate:dynamicsnapshot Acceptance Products