szurubooru/tests/Support/TestSupport.php

35 lines
712 B
PHP
Raw Normal View History

<?php
class TestSupport
{
private $assert;
public function __construct(Assert $assert)
{
$this->assert = $assert;
}
public function getPath($assetName)
{
2014-05-15 10:32:53 +02:00
return TextHelper::absolutePath(Core::getConfig()->rootDir . DS . 'tests' . DS . 'Files' . DS . $assetName);
}
public function assertTagNames($post, $tags)
{
$tagNames = $this->getTagNames($tags);
$postTagNames = $this->getTagNames($post->getTags());
$this->assert->areEquivalent($tagNames, $postTagNames);
}
public function getTagNames(array $tags)
{
$tagNames = array_map(
function($tag)
{
return $tag->getName();
}, $tags);
natcasesort($tagNames);
$tagNames = array_values($tagNames);
return $tagNames;
}
}