aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/lib/FunctionsTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/lib/FunctionsTest.php')
-rw-r--r--tests/unit/lib/FunctionsTest.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/unit/lib/FunctionsTest.php b/tests/unit/lib/FunctionsTest.php
index 9a92f1a..670d00c 100644
--- a/tests/unit/lib/FunctionsTest.php
+++ b/tests/unit/lib/FunctionsTest.php
@@ -80,11 +80,29 @@ class FunctionsTest extends \Codeception\Test\Unit
public function testTrailsControllerExtractActionAndArgs()
{
$controller = new Trails_Controller(null);
- list($action, $args, $format) = $controller->extract_action_and_args('foo/bar//42.html');
+ [$action, $args, $format] = $controller->extract_action_and_args('foo/bar//42.html');
$this->assertEquals('foo', $action);
$this->assertEquals(['bar', '', '42'], $args);
$this->assertEquals('html', $format);
}
+
+ /**
+ * @covers ::studip_interpolate
+ */
+ public function testStudipInterpolate()
+ {
+ $this->assertEquals(
+ '12bar34',
+ studip_interpolate('12%{foo}34', ['foo' => 'bar'])
+ );
+ $this->assertEquals(
+ 'foo',
+ studip_interpolate('%{ bar }', ['bar' => 'foo'])
+ );
+
+ $this->expectException(Exception::class);
+ studip_interpolate('%{foo}', []);
+ }
}