<?php

declare(strict_types=1);

namespace OCA\Mitgliederverwaltung\Tests\Integration;

use OCA\Mitgliederverwaltung\Controller\PageController;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
 * Integration-level tests for PageController.
 */
class PageControllerTest extends TestCase {

    private PageController $controller;
    private IRequest&MockObject $request;

    protected function setUp(): void {
        parent::setUp();

        $this->request = $this->createMock(IRequest::class);
        $this->controller = new PageController($this->request);
    }

    public function testIndexReturnsTemplateResponse(): void {
        $response = $this->controller->index();

        $this->assertInstanceOf(TemplateResponse::class, $response);
        $this->assertSame('mitgliederverwaltung', $response->getApp());
        $this->assertSame('index', $response->getTemplateName());
    }

    public function testIndexReturns200(): void {
        $response = $this->controller->index();

        $this->assertSame(200, $response->getStatus());
    }
}
