Skip to content

Commit

Permalink
Merge 4fbbf24 into aba644a
Browse files Browse the repository at this point in the history
  • Loading branch information
ateliee committed Oct 23, 2019
2 parents aba644a + 4fbbf24 commit 49f0813
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ script:
- composer test tests

after_success:
- travis_retry php vendor/bin/php-coveralls -v
- ([[ $TRAVIS_PHP_VERSION != 7.2 ]] || travis_retry php vendor/bin/php-coveralls -v)
38 changes: 37 additions & 1 deletion tests/PUMLElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

use Ateliee\PlantUMLParser\Exception\InvalidParamaterException;
use Ateliee\PlantUMLParser\PUMLElement;
use Ateliee\PlantUMLParser\PUMLElementBlock;
use Ateliee\PlantUMLParser\PUMLElementList;
use Ateliee\PlantUMLParser\PUMLKeyValue;
use Ateliee\PlantUMLParser\PUMLObject;
use Ateliee\PlantUMLParser\PUMLParser;
use Ateliee\PlantUMLParser\PUMLStr;

Expand Down Expand Up @@ -33,7 +36,26 @@ public function testList()
new PUMLStr('SAMPLE5'),
new PUMLStr('SAMPLE6')
]);
$this->assertEquals(count($uml), 5);

$block = (new PUMLElementBlock('test'))
->setComment("default style.")
->add(new PUMLKeyValue('BackgroundColor', 'METAL'))
->add(new PUMLKeyValue('BackgroundColor2', 'BLACK'))
;

$this->assertEquals(isset($block[0]), true);
$this->assertContainsOnlyInstancesOf(PUMLKeyValue::class, [$block[0]]);
$this->assertEquals(isset($block[1]), true);

unset($block[0]);
$this->assertEquals(isset($block[0]), false);
$this->assertEquals(isset($block[2]), false);

$block[] = new PUMLKeyValue('BackgroundColor', 'METAL');
$this->assertEquals(isset($block[2]), true);

$uml->add($block);
$this->assertEquals(count($uml), 6);

$this->assertContainsOnly('string', [(string)$uml]);

Expand All @@ -59,6 +81,20 @@ public function testElement()
$this->assertEquals("/'\n 複数行\n これもテスト\n'/", trim($str->getOutputComment()));
}

public function testObject()
{
$str = new PUMLObject('entity', 'サンプル', 'Entity', '<T>');
$result = 'entity "サンプル" as Entity <T>';
$this->assertEquals($result, ($str->getValueLabel()));
}

public function testElementBlock()
{
$str = new PUMLElementBlock('entity');
$result = 'entity';
$this->assertEquals($result, ($str->getValueLabel()));
}

/**
* @test
* @expectedException Ateliee\PlantUMLParser\Exception\InvalidParamaterException
Expand Down

0 comments on commit 49f0813

Please sign in to comment.