PHP Classes

File: test/ConcatinatorTest.php

Recommend this page to a friend!
  Classes of stefan   PHP Calculator   test/ConcatinatorTest.php   Download  
File: test/ConcatinatorTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Calculator
Calculate the result of multiple math operations
Author: By
Last change:
Date: 2 years ago
Size: 2,264 bytes
 

Contents

Class file image Download
<?php declare(strict_types=1);
use
PHPUnit\Framework\TestCase;

    use
Taschenrechner\Classes\Concatinator;
    require_once(
dirname(__FILE__)."/init.php");

final class
ConcatinatorTest extends TestCase
{
    private
$concatinator;
    private
$operations;
    protected function
setUp(): void
   
{
       
$init = new Init();
       
$this->operations = $init->operations();
    }
 
    public function
testTerm25Plus2Plus3(): void
   
{
       
$this->concatinator = new Concatinator();

       
$this->assertSame(array("25", "+", "2", "+", "3"), $this->concatinator->concatinateNumericValues(["2","5","+","2","+","3"]));

    }
    public function
testTermMinus25Plus2Plus3(): void
   
{
       
$this->concatinator = new Concatinator();

       
$this->assertSame(array("-25", "+", "2", "+", "3"), $this->concatinator->concatinateNumericValues(["-","2","5","+","2","+","3"]));

    }
    public function
testTermMinus25MinusMinus2(): void
   
{
       
$this->concatinator = new Concatinator();

       
$this->assertSame(array("-25", "-", "-2"), $this->concatinator->concatinateNumericValues(["-","2","5","-", "-","2"]));

    }
    public function
testTermMinusMinus25MinusMinus2(): void
   
{
       
$this->concatinator = new Concatinator();

       
$this->assertSame(array("25", "-", "-2"), $this->concatinator->concatinateNumericValues(["-","-","2","5","-", "-","2"]));

    }
    public function
testTermSin25Minus2(): void
   
{
       
$this->concatinator = new Concatinator();
       
$this->assertSame(array("sin(", "25", ")", "-2"), $this->concatinator->concatinateArray(["s","i","n","(","2", "5",")", "-", "2"], $this->operations));

    }
    public function
testTermCos25Minus2(): void
   
{
       
$this->concatinator = new Concatinator();
       
$this->assertSame(array("cos(", "25", ")", "-2"), $this->concatinator->concatinateArray(["c","o","s","(","2", "5",")", "-", "2"], $this->operations));

    }
    public function
testTermTan25Minus2(): void
   
{
       
$this->concatinator = new Concatinator();
       
$this->assertSame(array("tan(", "25", ")", "-2"), $this->concatinator->concatinateArray(["t","a","n","(","2", "5",")", "-", "2"], $this->operations));

    }
}