Applied code formator

This commit is contained in:
Kevin Frantz 2018-11-06 20:08:28 +01:00
parent a3bbd64f43
commit 1fa93e577a
5 changed files with 21 additions and 26 deletions

View File

@ -4,7 +4,6 @@ namespace App\Entity\Meta;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use App\Entity\Attribut\MembersAttribut;
use App\Entity\Source\SourceInterface; use App\Entity\Source\SourceInterface;
use App\Entity\Attribut\RightAttribut; use App\Entity\Attribut\RightAttribut;
use App\Entity\Attribut\CollectionAttribut; use App\Entity\Attribut\CollectionAttribut;

View File

@ -2,7 +2,6 @@
namespace App\Entity\Meta; namespace App\Entity\Meta;
use App\Entity\Attribut\MembersAttributInterface;
use App\Entity\Attribut\RightAttributInterface; use App\Entity\Attribut\RightAttributInterface;
use App\Entity\Attribut\CollectionAttributInterface; use App\Entity\Attribut\CollectionAttributInterface;
use App\Helper\DimensionHelperInterface; use App\Helper\DimensionHelperInterface;
@ -12,6 +11,6 @@ use App\Helper\DimensionHelperInterface;
* *
* @author kevinfrantz * @author kevinfrantz
*/ */
interface RecieverInterface extends MetaInterface, RightAttributInterface,CollectionAttributInterface,DimensionHelperInterface interface RecieverInterface extends MetaInterface, RightAttributInterface, CollectionAttributInterface, DimensionHelperInterface
{ {
} }

View File

@ -33,9 +33,11 @@ class CollectionAttributTest extends TestCase
$this->assertNull($this->collection->setCollection($collection)); $this->assertNull($this->collection->setCollection($collection));
$this->assertEquals($collection, $this->collection->getCollection()); $this->assertEquals($collection, $this->collection->getCollection());
} }
public function testAdd():void{ public function testAdd(): void
$mock = new class{}; {
$mock = new class() {
};
$this->collection->setCollection(new ArrayCollection()); $this->collection->setCollection(new ArrayCollection());
$this->assertTrue($this->collection->getCollection()->add($mock)); $this->assertTrue($this->collection->getCollection()->add($mock));
$this->assertEquals($mock, $this->collection->getCollection()->get(0)); $this->assertEquals($mock, $this->collection->getCollection()->get(0));

View File

@ -1,4 +1,5 @@
<?php <?php
namespace Tests\Unit\Entity\Attribut; namespace Tests\Unit\Entity\Attribut;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
@ -9,26 +10,27 @@ use App\Entity\Meta\RecieverInterface;
class RecieverAttributTest extends TestCase class RecieverAttributTest extends TestCase
{ {
/** /**
*
* @var RecieverAttributInterface * @var RecieverAttributInterface
*/ */
protected $reciever; protected $reciever;
public function setUp():void{ public function setUp(): void
$this->reciever = new class implements RecieverAttributInterface{ {
$this->reciever = new class() implements RecieverAttributInterface {
use RecieverAttribut; use RecieverAttribut;
}; };
} }
public function testConstructor():void{ public function testConstructor(): void
{
$this->expectException(\TypeError::class); $this->expectException(\TypeError::class);
$this->reciever->getReciever(); $this->reciever->getReciever();
} }
public function testAccessors():void{ public function testAccessors(): void
{
$reciever = $this->createMock(RecieverInterface::class); $reciever = $this->createMock(RecieverInterface::class);
$this->assertNull($this->reciever->setReciever($reciever)); $this->assertNull($this->reciever->setReciever($reciever));
$this->assertEquals($reciever, $this->reciever->getReciever()); $this->assertEquals($reciever, $this->reciever->getReciever());
} }
} }

View File

@ -1,14 +1,11 @@
<?php <?php
namespace Tests\Unit\Entity\Subscriber; namespace Tests\Unit\Entity\Subscriber;
use App\Subscriber\SourceMenuSubscriber; use App\Subscriber\SourceMenuSubscriber;
use App\Subscriber\UserMenuSubscriber;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Translation\Translator; use Symfony\Component\Translation\Translator;
use App\Event\Menu\MenuEvent; use App\Event\Menu\MenuEvent;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Knp\Menu\FactoryInterface;
use Knp\Menu\ItemInterface;
use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Knp\Menu\MenuItem; use Knp\Menu\MenuItem;
@ -16,9 +13,7 @@ use Knp\Menu\MenuFactory;
class SourceMenuSubscriberTest extends TestCase class SourceMenuSubscriberTest extends TestCase
{ {
/** /**
*
* @var SourceMenuSubscriber * @var SourceMenuSubscriber
*/ */
public $subscriber; public $subscriber;
@ -28,8 +23,9 @@ class SourceMenuSubscriberTest extends TestCase
$translator = new Translator('en'); $translator = new Translator('en');
$this->subscriber = new SourceMenuSubscriber($translator); $this->subscriber = new SourceMenuSubscriber($translator);
} }
public function testOnSourceMenuConfig():void{ public function testOnSourceMenuConfig(): void
{
$factory = new MenuFactory(); $factory = new MenuFactory();
$item = new MenuItem('test', $factory); $item = new MenuItem('test', $factory);
$request = new Request(); $request = new Request();
@ -40,6 +36,3 @@ class SourceMenuSubscriberTest extends TestCase
$this->assertNull($this->subscriber->onSourceMenuConfigure($event)); $this->assertNull($this->subscriber->onSourceMenuConfigure($event));
} }
} }