mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-13 18:34:06 +02:00
PHP7 More
This commit is contained in:
24
More/EAV/Tests/EAVTest.php
Normal file
24
More/EAV/Tests/EAVTest.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\More\EAV\Tests;
|
||||
|
||||
use DesignPatterns\More\EAV\Attribute;
|
||||
use DesignPatterns\More\EAV\Entity;
|
||||
use DesignPatterns\More\EAV\Value;
|
||||
|
||||
class EAVTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testCanAddAttributeToEntity()
|
||||
{
|
||||
$colorAttribute = new Attribute('color');
|
||||
$colorSilver = new Value($colorAttribute, 'silver');
|
||||
$colorBlack = new Value($colorAttribute, 'black');
|
||||
|
||||
$memoryAttribute = new Attribute('memory');
|
||||
$memory8Gb = new Value($memoryAttribute, '8GB');
|
||||
|
||||
$entity = new Entity('MacBook Pro', [$colorSilver, $colorBlack, $memory8Gb]);
|
||||
|
||||
$this->assertEquals('MacBook Pro, color: silver, color: black, memory: 8GB', (string) $entity);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user