Source of file VersionedTestSessionExtension.php
Size: 1,784 Bytes - Last Modified: 2021-12-23T10:35:47+00:00
/var/www/docs.ssmods.com/process/src/src/Dev/VersionedTestSessionExtension.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 | <?php namespace SilverStripe\Versioned\Dev; use SilverStripe\Dev\TestSession; use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\VersionedStateExtension; /** * Decorates TestSession object to update get / post requests with versioned querystring arguments. * Session vars assigned by FunctionalTest::useDraftSite are respected here. * * @deprecated 2.2..3.0 Use ?stage= querystring arguments instead of session * @property TestSession $owner */ class VersionedTestSessionExtension extends VersionedStateExtension { /** * Update link * * @param string $url */ public function updateLink(&$url) { $session = $this->owner->session(); if (!$session) { return; } // Set unsecured draft $unsecuredDraft = $session->get('unsecuredDraftSite'); if (isset($unsecuredDraft)) { Versioned::set_draft_site_secured(!$unsecuredDraft); } // Set reading mode $readingMode = $session->get('readingMode'); if ($readingMode) { parent::updateLink($url); } } /** * Get reading mode set by FunctionalTest::useDraftSite() * * @return string */ protected function getReadingmode() { // Set reading mode return $this->owner->session()->get('readingMode'); } /** * Decorate link prior to http get request * * @param string $link */ public function updateGetURL(&$link) { $this->updateLink($link); } /** * Decorate link prior to http post request * * @param string $link */ public function updatePostURL(&$link) { // Default to same as http get $this->updateLink($link); } } |