<?php

/**
 * Lifestyle Webconsulting GmbH
 *
 * LICENSE: This Software is the property of Lifestyle Webconsulting GmbH (Aschaffenburg, Germany)
 * and is private by copyright law - it is NOT Freeware.
 *
 * Any unauthorized use of this software without a valid license
 * is a violation of the license agreement and will be prosecuted by
 * civil and criminal law.
 *
 * @copyright  2018 Lifestyle Webconsulting GmbH
 * @link       http://www.life-style.de
 */

namespace LifeStyle\SamlAuthBundle\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Knp\Component\Pager\Paginator;
use Knp\Component\Pager\Pagination\PaginationInterface;
use LifeStyle\SamlAuthBundle\Database\Manager as SamlDbManager;
use LifeStyle\SamlAuthBundle\Events\Model\ControllerAction as ControllerActionData;

/**
 * Class AdminControllerTest
 * @package LifeStyle\SamlAuthBundle\Tests\Controller
 */
class AdminControllerTest extends WebTestCase
{
    public function testUsersLogAction()
    {
        /*$client = static::createClient();

        $samlDb = $this->getMockBuilder(SamlDbManager::class)
            ->disableOriginalConstructor()
            ->setMethods(['logUserAction', 'repository', 'user', 'createQueryBuilder', 'getQuery'])
            ->getMock();
        $samlDb->method('repository')->will($this->returnSelf());
        $samlDb->method('user')->will($this->returnSelf());
        $samlDb->method('createQueryBuilder')->will($this->returnSelf());
        $samlDb->method('getQuery')->will($this->returnValue(null));
        $samlDb->method('logUserAction')->withAnyParameters();

        $pagination = $this->getMockBuilder(PaginationInterface::class)
            ->disableOriginalConstructor()
            ->setMethods([
                'getTotalItemCount',
                'getItemNumberPerPage',
                'setCurrentPageNumber',
                'setItemNumberPerPage',
                'setTotalItemCount',
                'setItems',
                'setPaginatorOptions',
                'setCustomParameters',
                'isSorted'
            ])
            ->getMock();
        $pagination->method('getTotalItemCount')->will($this->returnValue(1));
        $pagination->method('getItemNumberPerPage')->will($this->returnValue(1));
        $pagination->method('isSorted')->will($this->returnValue(false));

        $paginator = $this->getMockBuilder(Paginator::class)
            ->disableOriginalConstructor()
            ->setMethods(['paginate'])
            ->getMock();
        $paginator->method('paginate')->will($this->returnValue($pagination));

        $controllerActionData = new ControllerActionData();
        $samlEvents = $this->getMockBuilder(SamlDbManager::class)
            ->disableOriginalConstructor()
            ->setMethods(['model', 'controllerAction', 'dispatchControllerAction'])
            ->getMock();
        $samlEvents->method('model')->will($this->returnSelf());
        $samlEvents->method('controllerAction')->will($this->returnValue($controllerActionData));
        $samlEvents->method('dispatchControllerAction')->will($this->returnValue(null));

        $client->getContainer()->set('saml.saml_database_manager', $samlDb);
        $client->getContainer()->set('saml.event_manager', $samlEvents);
        $client->getContainer()->set('knp_paginator', $paginator);

        $crawler = $client->request('GET', '/admin/saml/auth/user/log');

        echo $crawler->html();*/
    }
}
