HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/apklausos/tests/unit/controllers/ThemeOptionsControllerTest.php
<?php

namespace ls\tests\controllers;

use ThemeOptionsController;
use TemplateConfiguration;
use PHPUnit\Framework\TestCase;

class ThemeOptionsControllerTest extends TestCase
{
    /**
     * @var ThemeOptionsController
     */
    private $controller;

    /**
     * @var TemplateConfiguration
     */
    private $templateConfiguration;

    public function setUp(): void
    {
        \Yii::import('application.controllers.ThemeOptionsController', true);
        $this->controller = new ThemeOptionsController('moo');
    }

    public function tearDown(): void
    {
        $this->controller = null;
    }

    /**
     * This test will check if the ajaxmode will be turned off.
     */
    public function testTurnAjaxModeOffAsDefault()
    {
        $this->markTestSkipped();
        $expected = 'off';
        $json = json_encode(['ajaxmode' => 'on']);

        $this->templateConfiguration = new TemplateConfiguration();
        $this->templateConfiguration->setAttribute('options', (string) $json);
        $this->templateConfiguration->setAttribute('surveyid', 1);

        $actual = $this->controller->turnAjaxmodeOffAsDefault($this->templateConfiguration);
        $actualOptions = json_decode($actual->getAttribute('options'), true);

        $this->assertEquals($expected, $actualOptions['ajaxmode']);
    }
}