mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Refactored\moved Attribut folder
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\CollectionAttributInterface;
|
||||
use App\Attribut\CollectionAttribut;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
class CollectionAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var CollectionAttributInterface
|
||||
*/
|
||||
protected $collection;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->collection = new class() implements CollectionAttributInterface {
|
||||
use CollectionAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->collection->getCollection();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$collection = new ArrayCollection();
|
||||
$this->assertNull($this->collection->setCollection($collection));
|
||||
$this->assertEquals($collection, $this->collection->getCollection());
|
||||
}
|
||||
|
||||
public function testAdd(): void
|
||||
{
|
||||
$mock = new class() {
|
||||
};
|
||||
$this->collection->setCollection(new ArrayCollection());
|
||||
$this->assertTrue($this->collection->getCollection()->add($mock));
|
||||
$this->assertEquals($mock, $this->collection->getCollection()->get(0));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user