1
This commit is contained in:
46
vendor/phpoffice/math/tests/Math/Element/AbstractGroupElementTest.php
vendored
Normal file
46
vendor/phpoffice/math/tests/Math/Element/AbstractGroupElementTest.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\PhpOffice\Math\Element;
|
||||
|
||||
use PhpOffice\Math\Element;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class AbstractGroupElementTest extends TestCase
|
||||
{
|
||||
public function testConstruct(): void
|
||||
{
|
||||
$row = new Element\Row();
|
||||
|
||||
$this->assertIsArray($row->getElements());
|
||||
$this->assertCount(0, $row->getElements());
|
||||
}
|
||||
|
||||
public function testAdd(): void
|
||||
{
|
||||
$identifierA = new Element\Identifier('a');
|
||||
$row = new Element\Row();
|
||||
|
||||
$this->assertCount(0, $row->getElements());
|
||||
|
||||
$this->assertInstanceOf(Element\AbstractGroupElement::class, $row->add($identifierA));
|
||||
|
||||
$this->assertCount(1, $row->getElements());
|
||||
$this->assertEquals([$identifierA], $row->getElements());
|
||||
}
|
||||
|
||||
public function testRemove(): void
|
||||
{
|
||||
$identifierA = new Element\Identifier('a');
|
||||
|
||||
$row = new Element\Row();
|
||||
$row->add($identifierA);
|
||||
|
||||
$this->assertCount(1, $row->getElements());
|
||||
|
||||
$this->assertInstanceOf(Element\AbstractGroupElement::class, $row->remove($identifierA));
|
||||
|
||||
$this->assertCount(0, $row->getElements());
|
||||
}
|
||||
}
|
||||
49
vendor/phpoffice/math/tests/Math/Element/FractionTest.php
vendored
Normal file
49
vendor/phpoffice/math/tests/Math/Element/FractionTest.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\PhpOffice\Math\Element;
|
||||
|
||||
use PhpOffice\Math\Element;
|
||||
use PhpOffice\Math\Element\Fraction;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class FractionTest extends TestCase
|
||||
{
|
||||
public function testConstruct(): void
|
||||
{
|
||||
$identifierA = new Element\Identifier('a');
|
||||
$identifierB = new Element\Identifier('b');
|
||||
|
||||
$fraction = new Fraction($identifierA, $identifierB);
|
||||
|
||||
$this->assertEquals($identifierA, $fraction->getNumerator());
|
||||
$this->assertEquals($identifierB, $fraction->getDenominator());
|
||||
}
|
||||
|
||||
public function testBase(): void
|
||||
{
|
||||
$identifierA = new Element\Identifier('a');
|
||||
$identifierB = new Element\Identifier('b');
|
||||
$identifierC = new Element\Identifier('c');
|
||||
|
||||
$fraction = new Fraction($identifierA, $identifierB);
|
||||
|
||||
$this->assertEquals($identifierA, $fraction->getNumerator());
|
||||
$this->assertInstanceOf(Fraction::class, $fraction->setNumerator($identifierC));
|
||||
$this->assertEquals($identifierC, $fraction->getNumerator());
|
||||
}
|
||||
|
||||
public function testFraction(): void
|
||||
{
|
||||
$identifierA = new Element\Identifier('a');
|
||||
$identifierB = new Element\Identifier('b');
|
||||
$identifierC = new Element\Identifier('c');
|
||||
|
||||
$fraction = new Fraction($identifierA, $identifierB);
|
||||
|
||||
$this->assertEquals($identifierB, $fraction->getDenominator());
|
||||
$this->assertInstanceOf(Fraction::class, $fraction->setDenominator($identifierC));
|
||||
$this->assertEquals($identifierC, $fraction->getDenominator());
|
||||
}
|
||||
}
|
||||
18
vendor/phpoffice/math/tests/Math/Element/IdentifierTest.php
vendored
Normal file
18
vendor/phpoffice/math/tests/Math/Element/IdentifierTest.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\PhpOffice\Math\Element;
|
||||
|
||||
use PhpOffice\Math\Element\Identifier;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class IdentifierTest extends TestCase
|
||||
{
|
||||
public function testConstruct(): void
|
||||
{
|
||||
$operator = new Identifier('x');
|
||||
|
||||
$this->assertEquals('x', $operator->getValue());
|
||||
}
|
||||
}
|
||||
18
vendor/phpoffice/math/tests/Math/Element/NumericTest.php
vendored
Normal file
18
vendor/phpoffice/math/tests/Math/Element/NumericTest.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\PhpOffice\Math\Element;
|
||||
|
||||
use PhpOffice\Math\Element\Numeric;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class NumericTest extends TestCase
|
||||
{
|
||||
public function testConstruct(): void
|
||||
{
|
||||
$numeric = new Numeric(2);
|
||||
|
||||
$this->assertEquals(2, $numeric->getValue());
|
||||
}
|
||||
}
|
||||
18
vendor/phpoffice/math/tests/Math/Element/OperatorTest.php
vendored
Normal file
18
vendor/phpoffice/math/tests/Math/Element/OperatorTest.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\PhpOffice\Math\Element;
|
||||
|
||||
use PhpOffice\Math\Element\Operator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class OperatorTest extends TestCase
|
||||
{
|
||||
public function testConstruct(): void
|
||||
{
|
||||
$operator = new Operator('+');
|
||||
|
||||
$this->assertEquals('+', $operator->getValue());
|
||||
}
|
||||
}
|
||||
34
vendor/phpoffice/math/tests/Math/Element/SemanticsTest.php
vendored
Normal file
34
vendor/phpoffice/math/tests/Math/Element/SemanticsTest.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\PhpOffice\Math\Element;
|
||||
|
||||
use PhpOffice\Math\Element\Semantics;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SemanticsTest extends TestCase
|
||||
{
|
||||
public function testConstruct(): void
|
||||
{
|
||||
$semantics = new Semantics();
|
||||
|
||||
$this->assertIsArray($semantics->getAnnotations());
|
||||
$this->assertCount(0, $semantics->getAnnotations());
|
||||
}
|
||||
|
||||
public function testAnnotation(): void
|
||||
{
|
||||
$semantics = new Semantics();
|
||||
|
||||
$this->assertIsArray($semantics->getAnnotations());
|
||||
$this->assertCount(0, $semantics->getAnnotations());
|
||||
|
||||
$this->assertInstanceOf(Semantics::class, $semantics->addAnnotation('encoding', 'content'));
|
||||
$this->assertEquals(['encoding' => 'content'], $semantics->getAnnotations());
|
||||
$this->assertCount(1, $semantics->getAnnotations());
|
||||
|
||||
$this->assertEquals('content', $semantics->getAnnotation('encoding'));
|
||||
$this->assertNull($semantics->getAnnotation('notexisting'));
|
||||
}
|
||||
}
|
||||
46
vendor/phpoffice/math/tests/Math/Element/SuperscriptTest.php
vendored
Normal file
46
vendor/phpoffice/math/tests/Math/Element/SuperscriptTest.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\PhpOffice\Math\Element;
|
||||
|
||||
use PhpOffice\Math\Element;
|
||||
use PhpOffice\Math\Element\Superscript;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SuperscriptTest extends TestCase
|
||||
{
|
||||
public function testConstruct(): void
|
||||
{
|
||||
$superscript = new Superscript(new Element\Identifier('a'), new Element\Identifier('a'));
|
||||
|
||||
$this->assertInstanceOf(Element\Identifier::class, $superscript->getBase());
|
||||
$this->assertInstanceOf(Element\Identifier::class, $superscript->getSuperscript());
|
||||
}
|
||||
|
||||
public function testBase(): void
|
||||
{
|
||||
$identifierA = new Element\Identifier('a');
|
||||
$identifierB = new Element\Identifier('b');
|
||||
$identifierC = new Element\Identifier('c');
|
||||
|
||||
$superscript = new Superscript($identifierA, $identifierB);
|
||||
|
||||
$this->assertEquals($identifierA, $superscript->getBase());
|
||||
$this->assertInstanceOf(Superscript::class, $superscript->setBase($identifierC));
|
||||
$this->assertEquals($identifierC, $superscript->getBase());
|
||||
}
|
||||
|
||||
public function testSuperscript(): void
|
||||
{
|
||||
$identifierA = new Element\Identifier('a');
|
||||
$identifierB = new Element\Identifier('b');
|
||||
$identifierC = new Element\Identifier('c');
|
||||
|
||||
$superscript = new Superscript($identifierA, $identifierB);
|
||||
|
||||
$this->assertEquals($identifierB, $superscript->getSuperscript());
|
||||
$this->assertInstanceOf(Superscript::class, $superscript->setSuperscript($identifierC));
|
||||
$this->assertEquals($identifierC, $superscript->getSuperscript());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user