Sindbad~EG File Manager

Current Path : /opt/nginxhttpd_/tests/Command/
Upload File :
Current File : //opt/nginxhttpd_/tests/Command/OpenrestyGenerateTest.php

<?php


namespace App\Tests\Command;

use App\Tests\CustomTestCase;
use O2switch\CpanelLib\Entity\WafCustomization;
use O2switch\CpanelLib\Repository\WafCustomizationRepository;
use Doctrine\ORM\EntityManagerInterface;
use Predis\Client;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;

class OpenrestyGenerateTest extends CustomTestCase
{
    public function testExecute(){
        $kernel = static::createKernel();
        $application = new Application($kernel);

        $command = $application->find('openresty:generate');
        $commandTester = new CommandTester($command);
        $commandTester->execute([]);
        $output = $commandTester->getDisplay();
        $this->assertStringContainsStringIgnoringCase("Data successfully inserted", $output);

        $container = static::getContainer();
        /** @var Client $redis */
        $redis = $container->get(Client::class);

        /** @var WafCustomizationRepository $repository */
        $repository = $container->get(EntityManagerInterface::class)->getRepository(WafCustomization::class);
        // TODO : create a fake DB because the current tests depends on the current state....
        /** @var WafCustomization $c */
        foreach ($repository->findAll() as $c) {
            $r = $redis->hgetall($c->getDomain());
            $this->assertIsArray($r);
            $this->assertArrayHasKey('isSslAvailable', $r);
            $this->assertArrayHasKey('sslCrt', $r);
            $this->assertArrayHasKey('listenToIp', $r);
            $this->assertArrayHasKey('sslCaBundle', $r);
            $this->assertArrayHasKey('proxyPassIp', $r);
            $this->assertArrayHasKey('additionalsParams', $r);
            $this->assertArrayHasKey('proxyPassSslPort', $r);
            $this->assertArrayHasKey('rawServerAlias', $r);
            $this->assertArrayHasKey('sslKey', $r);
            $this->assertArrayHasKey('proxyPassSslProtocol', $r);
            $this->assertArrayHasKey('key', $r);
            $this->assertArrayHasKey('proxyPassSslIp', $r);
            $this->assertArrayHasKey('rawSslContent', $r);
            $this->assertArrayHasKey('proxyPassProtocol', $r);
            $this->assertArrayHasKey('mainDomain', $r);
        }
    }
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists