PHP Classes

File: test/WurzelTest.php

Recommend this page to a friend!
  Classes of stefan  >  PHP Calculator  >  test/WurzelTest.php  >  Download  
File: test/WurzelTest.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: 10 months ago
Size: 1,326 bytes
 

Contents

Class file image Download
<?php declare(strict_types=1);
use
PHPUnit\Framework\TestCase;
    use
Taschenrechner\Classes\Calculator;
    use
Taschenrechner\Classes\Operationen\Wurzel;
    use
Taschenrechner\Classes\Concatinator;

    require_once
"init.php";
final class
WurzelTest 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
addTermProvider() {
        return array(
           
"Term 2?4 equals 2" => array(array(2,"?", 4),"2?4" ,"2"),
        );
    }

   
/**
     * @dataProvider addTermProvider
     */
   
public function testTerm($concatinatedValues, $term, $expected)
    {
       
$this->operation = new Wurzel($this->calculator, $this->concatinator);
       
$this->concatinator->method('concatinateArray')->willReturn($concatinatedValues);
       
$operations = (new Init())->operations();
       
$this->assertSame($expected, $this->operation->findAndCalculateTerm($term, $operations));

    }

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

    }
  
}