Skip to content
This repository has been archived by the owner on Dec 9, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
made method getAttributeString protected
  • Loading branch information
lcallarec committed Jun 5, 2013
1 parent bbb4af3 commit b020f6c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
2 changes: 1 addition & 1 deletion lib/Flownode/Node/Node.php
Expand Up @@ -245,7 +245,7 @@ public function setText($text = '')
* @param string $valueSeparator Separator between array attribute values
* @return string
*/
public function getAttributesString($attributes, $pattern = ' %attribute%="%value%"', $valueSeparator = ';')
protected function getAttributesString($attributes, $pattern = ' %attribute%="%value%"', $valueSeparator = ';')
{
$string = '';
foreach($attributes as $attribute => $value)
Expand Down
31 changes: 10 additions & 21 deletions tests/Flownode/Node/NodeTest.php
Expand Up @@ -40,42 +40,31 @@ public function testRootAsNoParent()
}

/**
* @covers Flownode\Node\Node::getAttributesString
*/
public function testGetAttributesString()
{
$aString = $this->root->getAttributesString(array('test' => 5, 'test2' => array(5, 8)));

$expected = ' test="5" test2="5;8;"';

$this->assertEquals($aString, $expected);

}

/**
* @covers Flownode\Node\Node::getAttributesString
* @covers Flownode\Node\Node::setAttributes
* @covers Flownode\Node\Node::setAttribute
*/
public function testGetAttributesStringWithCustomPattern()
public function testAttributeSetters()
{
$aString = $this->root->getAttributesString(array('test' => 5, 'test2' => 6), '%attribute%=%value%', '@');
$this->setUp('span', array('class' => 'class1', 'style' => 'width: 20px;'));

$expected = 'test=5test2=6';
$tag = $this->root->close()->render();

$this->assertEquals($aString, $expected);
$assert = '<span class="class1" style="width: 20px;"></span>';

$this->assertEquals($tag, $assert);
}

/**
* @covers Flownode\Node\Node::setAttributes
* @covers Flownode\Node\Node::setAttribute
*/
public function testAttributeSetters()
public function testAttributeSettersWithArrayValues()
{
$this->setUp('span', array('class' => 'class1', 'style' => 'width: 20px;'));
$this->setUp('span', array('class' => 'class1', 'style' => array('width: 20px', 'height: 50px')));

$tag = $this->root->close()->render();

$assert = '<span class="class1" style="width: 20px;"></span>';
$assert = '<span class="class1" style="width: 20px;height: 50px;"></span>';

$this->assertEquals($tag, $assert);
}
Expand Down

0 comments on commit b020f6c

Please sign in to comment.