[Pkg-owncloud-commits] [owncloud] 65/172: adding unit test for message interpolation

David Prévot taffit at moszumanska.debian.org
Sun May 18 20:09:40 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 93dbb39e775bf599f19445b27a10b0862cc3bab8
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date:   Mon May 12 14:16:54 2014 +0200

    adding unit test for message interpolation
---
 tests/lib/logger.php | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/tests/lib/logger.php b/tests/lib/logger.php
new file mode 100644
index 0000000..7d5d404
--- /dev/null
+++ b/tests/lib/logger.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Copyright (c) 2014 Thomas Müller <thomas.mueller at tmit.eu>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace Test;
+
+use OC\Log;
+
+class Logger extends \PHPUnit_Framework_TestCase {
+	/**
+	 * @var \OCP\ILogger
+	 */
+	private $logger;
+	static private $logs = array();
+
+	public function setUp() {
+		self::$logs = array();
+		$this->logger = new Log($this);
+	}
+
+	public function testInterpolation() {
+		$logger = $this->logger;
+		$logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
+
+		$expected = array('1 {Message {nothing} Bob Bar a}');
+		$this->assertEquals($expected, $this->getLogs());
+	}
+
+	private function getLogs() {
+		return self::$logs;
+	}
+
+	public static function write($app, $message, $level) {
+		self::$logs[]= "$level $message";
+	}
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list