Optimized unit tests for new data structure

This commit is contained in:
Kevin Frantz committed 2018-11-04 12:06:44 +01:00
1 parent c060dff873
commit f2868d9259
3 files changed
+10 -6

No files matched your search

@@ -26,6 +26,5 @@ final class NameSource extends AbstractDataSource implements NameSourceInterface
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
$this->name = '';
} }
} }
@@ -1,10 +1,10 @@
<?php <?php
namespace tests\unit\Entity\Source; namespace tests\unit\Entity\Source\Data;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use App\Entity\Source\NameSourceInterface; use App\Entity\Source\Data\NameSourceInterface;
use App\Entity\Source\NameSource; use App\Entity\Source\Data\NameSource;
/** /**
* @author kevinfrantz * @author kevinfrantz
@@ -21,9 +21,14 @@ class NameSourceTest extends TestCase
$this->nameSource = new NameSource(); $this->nameSource = new NameSource();
} }
public function testConstructor():void{
$this->assertInstanceOf(NameSourceInterface::class, $this->nameSource);
$this->expectException(\TypeError::class);
$this->nameSource->getName();
}
public function testName(): void public function testName(): void
{ {
$this->assertEquals('', $this->nameSource->getName());
$name = 'Hello World!'; $name = 'Hello World!';
$this->nameSource->setName($name); $this->nameSource->setName($name);
$this->assertEquals($name, $this->nameSource->getName()); $this->assertEquals($name, $this->nameSource->getName());
+1 -1
View File
@@ -4,7 +4,7 @@ namespace tests\unit\Entity;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use App\Entity\User; use App\Entity\User;
use App\Entity\Source\UserSource; use App\Entity\Source\Data\UserSource;
use App\Entity\UserInterface; use App\Entity\UserInterface;
/** /**