Removed logic from persistence layer

This commit is contained in:
Kevin Frantz
2018-11-06 20:30:36 +01:00
parent 1fa93e577a
commit 43761e472f
16 changed files with 7 additions and 241 deletions

View File

@@ -6,10 +6,6 @@ use PHPUnit\Framework\TestCase;
use App\Entity\Meta\Reciever;
use App\Entity\Meta\RecieverInterface;
use Doctrine\Common\Collections\Collection;
use App\Entity\Source\Data\UserSource;
use App\Entity\Source\Collection\TreeCollectionSource;
use App\Entity\Source\Collection\TreeCollectionSourceInterface;
use App\Entity\Source\Data\UserSourceInterface;
class RecieverTest extends TestCase
{
@@ -29,40 +25,4 @@ class RecieverTest extends TestCase
$this->expectException(\TypeError::class);
$this->reciever->getRight();
}
public function testDimensions(): void
{
/**
* @var \PHPUnit\Framework\MockObject\MockObject|UserSourceInterface
*/
$user1 = new UserSource();
/**
* @var \PHPUnit\Framework\MockObject\MockObject|UserSourceInterface
*/
$user2 = new UserSource();
/**
* @var \PHPUnit\Framework\MockObject\MockObject|UserSourceInterface
*/
$user3 = new UserSource();
/**
* @var \PHPUnit\Framework\MockObject\MockObject|TreeCollectionSourceInterface
*/
$group1 = new TreeCollectionSource();
/**
* @var \PHPUnit\Framework\MockObject\MockObject|TreeCollectionSourceInterface
*/
$group2 = new TreeCollectionSource();
/**
* @var \PHPUnit\Framework\MockObject\MockObject|TreeCollectionSourceInterface
*/
$group3 = new TreeCollectionSource();
$group1->getCollection()->add($user1);
$group1->getCollection()->add($group2);
$group2->getCollection()->add($user2);
$group2->getCollection()->add($user3);
$group2->getCollection()->add($group3);
$this->reciever->getCollection()->add($group1);
$this->assertEquals($group1, $this->reciever->getCollection()->get(0));
$this->assertEquals(6, $this->reciever->getDimensions()->count());
}
}

View File

@@ -1,77 +0,0 @@
<?php
namespace Entity\Method;
use PHPUnit\Framework\TestCase;
use App\Entity\Method\CollectionDimensionHelperMethod;
use App\Helper\DimensionHelperInterface;
use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Attribut\CollectionAttribut;
use App\Entity\Attribut\CollectionAttributInterface;
class CollectionDimensionHelperMethodTest extends TestCase
{
/**
* @var DimensionHelperInterface|CollectionAttributInterface
*/
protected $method;
private function getClassMock(): object
{
return new class() implements DimensionHelperInterface, CollectionAttributInterface {
use CollectionDimensionHelperMethod,CollectionAttribut;
public function __construct()
{
$this->collection = new ArrayCollection();
}
};
}
public function setUp(): void
{
$this->method = $this->getClassMock();
$clone1 = $this->getClassMock();
$clone2 = $this->getClassMock();
$clone3 = $this->getClassMock();
$clone1->getCollection()->add($clone2);
$clone2->getCollection()->add($clone3);
$this->method->getCollection()->add($clone1);
}
public function testTestSetUp(): void
{
$this->assertEquals(1, $this->method->getCollection()->count());
$this->assertEquals(1, $this->method->getCollection()->get(0)->getCollection()->count());
}
public function testThatZeroAndOneDimensionAreUnique(): void
{
$this->assertFalse($this->method->getDimensions(0)->count() == $this->method->getDimensions(1)->count());
}
public function testZeroDimension(): void
{
$this->assertEquals(0, $this->method->getDimensions(0)->count());
}
public function testFirstDimension(): void
{
$this->assertEquals(1, $this->method->getDimensions(1)->count());
}
public function testSecondDimensionl(): void
{
$this->assertEquals(2, $this->method->getDimensions(2)->count());
}
public function testThirdtDimension(): void
{
$this->assertEquals(3, $this->method->getDimensions(3)->count());
}
public function testInfiniteDimension(): void
{
$this->assertEquals(3, $this->method->getDimensions()->count());
}
}

View File

@@ -8,7 +8,6 @@ use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Source\AbstractSource;
use App\Entity\Source\Collection\TreeCollectionSourceInterface;
use App\Entity\Source\Collection\TreeCollectionSource;
use App\Helper\DimensionHelperInterface;
/**
* @author kevinfrantz
@@ -29,7 +28,6 @@ class TreeCollectionSourceTest extends TestCase
{
$this->assertInstanceOf(Collection::class, $this->tree->getCollection());
$this->assertInstanceOf(TreeCollectionSourceInterface::class, $this->tree);
$this->assertInstanceOf(DimensionHelperInterface::class, $this->tree);
}
public function testAccessors()