assertEquals('foo', (new TestAuditHook())->formatMessage('{{test}}', ['test' => 'foo'])); } public function testFormatMessageResolvesNestedLevelParameters() { $this->assertEquals('foo', (new TestAuditHook())->formatMessage('{{te.st}}', ['te' => ['st' => 'foo']])); } public function testFormatMessageResolvesParametersWithSingleBraces() { $this->assertEquals('foo', (new TestAuditHook())->formatMessage('{{t{e}st}}', ['t{e}st' => 'foo'])); $this->assertEquals('foo', (new TestAuditHook())->formatMessage('{{te{.}st}}', ['te{' => ['}st' => 'foo']])); } /** * @expectedException \InvalidArgumentException */ public function testFormatMessageComplainsAboutUnresolvedParameters() { (new TestAuditHook())->formatMessage('{{missing}}', []); } /** * @expectedException \InvalidArgumentException */ public function testFormatMessageComplainsAboutNonScalarParameters() { (new TestAuditHook())->formatMessage('{{test}}', ['test' => ['foo' => 'bar']]); } /** * @expectedException \InvalidArgumentException */ public function testFormatMessageComplainsAboutNonArrayParameters() { (new TestAuditHook())->formatMessage('{{test.foo}}', ['test' => 'foo']); } }