PHP Classes

File: test/SubtraktionTest.php

Recommend this page to a friend!
  Classes of stefan   PHP Calculator   test/SubtraktionTest.php   Download  
File: test/SubtraktionTest.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: resolve error ( and sin( in same term
Date: 2 years ago
Size: 1,478 bytes
 

Contents

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

    use
Taschenrechner\Classes\Calculator;
    use
Taschenrechner\Classes\Operationen\Subtraktion;
    use
Taschenrechner\Classes\Concatinator;
    require_once
"init.php";
final class
SubtraktionTest extends TestCase
{
    private
$operation;
    private
$concatinator;
    private
$calculator;
    private
$stub;
    protected function
setUp(): void
   
{
       
$this->calculator = $this->createMock(Calculator::class);
       
$this->concatinator = $this->createMock(Concatinator::class);
    }
 
    public function
testTerm20Minus5Minus5Equals20Minus5(): void
   
{
       
$this->operation = new Subtraktion($this->calculator, $this->concatinator);
       
$this->concatinator->method('concatinateArray')->willReturn(array(25,"-",5, "-", 5));
       
       
$this->assertSame("20-5", $this->operation->findAndCalculateTerm("25-5-5", (new Init())->operations()));

    }
   
        public function
testTerm10Minus5Plus5Equals5Plus5(): void
   
{
       
$this->operation = new Subtraktion($this->calculator, $this->concatinator);
       
$this->concatinator->method('concatinateArray')->willReturn(array(10,"-",5, "+", 5));

       
       
$this->assertSame("5+5", $this->operation->findAndCalculateTerm("10-5+5", (new Init())->operations()));

    }


    protected function
tearDown(): void
   
{
       
$this->calculator = NULL;
       
$this->concatinator = NULL;

    }
  
}