PathTraitTest.php in Tome 8
File
modules/tome_base/tests/src/Unit/PathTraitTest.php
View source
<?php
namespace Drupal\Tests\tome_base\Unit;
use Drupal\Tests\UnitTestCase;
use Drupal\tome_base\PathTrait;
class PathTraitTest extends UnitTestCase {
public function testJoinPaths($paths, $expected) {
$mock = $this
->getMockForTrait(PathTrait::class);
$reflection = new \ReflectionMethod(get_class($mock), 'joinPaths');
$reflection
->setAccessible(TRUE);
$this
->assertEquals($expected, $reflection
->invokeArgs($mock, $paths));
}
public function dataProvider() {
return [
[
[
'foo',
'bar',
],
'foo/bar',
],
[
[
'foo/',
'//bar//',
],
'foo/bar',
],
[
[
'http://www.foo.com',
'bar',
],
'http://www.foo.com/bar',
],
[
[
'http:///www.foo.com//',
'//bar/',
],
'http://www.foo.com/bar',
],
];
}
}