PHP Classes

File: tests/Config/ConfigTest.php

Recommend this page to a friend!
  Classes of Kacper Rowinski   OneClickCaptcha   tests/Config/ConfigTest.php   Download  
File: tests/Config/ConfigTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: OneClickCaptcha
CAPTCHA validation based on user clicks on circles
Author: By
Last change: Update of tests/Config/ConfigTest.php
Date: 6 months ago
Size: 1,635 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);

use
OneClickCaptcha\Config\Config;
use
PHPUnit\Framework\TestCase;

/**
 * Class ConfigTest
 */
class ConfigTest extends TestCase
{
   
/**
     * @var Config
     */
   
private $config;

    public function
setUp()
    {
       
$this->config = new Config();
    }

   
/**
     * @test
     */
   
public function shouldDefaultsBeSet(): void
   
{
       
$this->assertSame(400, $this->config->getBackgroundWidth());
       
$this->assertSame(200, $this->config->getBackgroundHeight());
       
$this->assertSame('#000', $this->config->getBackgroundColor());

       
$this->assertSame(3, $this->config->getCircleAmount());
       
$this->assertSame(60, $this->config->getCircleSize());
       
$this->assertSame('#FFF', $this->config->getCircleColor());
    }

   
/**
     * @test
     */
   
public function shouldSettersSet(): void
   
{
       
$this->config->setBackgroundWidth(100);
       
$this->assertSame(100, $this->config->getBackgroundWidth());

       
$this->config->setBackgroundHeight(50);
       
$this->assertSame(50, $this->config->getBackgroundHeight());

       
$this->config->setBackgroundColor('#ABC');
       
$this->assertSame('#ABC', $this->config->getBackgroundColor());

       
$this->config->setCircleAmount(10);
       
$this->assertSame(10, $this->config->getCircleAmount());

       
$this->config->setCircleSize(180);
       
$this->assertSame(180, $this->config->getCircleSize());

       
$this->config->setCircleColor('#F00');
       
$this->assertSame('#F00', $this->config->getCircleColor());
    }
}