34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
namespace PSC\Library\Calc\Tests\Article;
|
|
|
|
use PSC\Library\Calc\Engine;
|
|
|
|
class SimpleXmlTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
public function testIfArticleCountInXmlCorrect()
|
|
{
|
|
$parser = new Engine();
|
|
$this->assertTrue($parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/simple.xml')));
|
|
|
|
$this->assertEquals(1, $parser->getArticles()->Count());
|
|
}
|
|
|
|
public function testIfArticleCountInXmlCorrectWith2Article()
|
|
{
|
|
$parser = new Engine();
|
|
$this->assertTrue($parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/simple2articles.xml')));
|
|
|
|
$this->assertEquals(2, $parser->getArticles()->Count());
|
|
}
|
|
|
|
public function testGetArticleByName()
|
|
{
|
|
$parser = new Engine();
|
|
$parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/simple2articles.xml'));
|
|
|
|
$article = $parser->getArticleByName('Blocks A5 25blatt geleimt');
|
|
$this->assertInstanceOf('PSC\Library\Calc\Article', $article);
|
|
$this->assertEquals('Blocks A5 25blatt geleimt', $article->getName());
|
|
}
|
|
|
|
} |