浏览代码

Merge remote-tracking branch 'origin/master' into cake4

mscherer 6 年之前
父节点
当前提交
6aee3ab540

+ 4 - 0
src/View/Helper/FormatHelper.php

@@ -375,6 +375,10 @@ class FormatHelper extends Helper {
 				$attributes['title'] = __($attributes['title']);
 			}
 		}
+		if (isset($attributes['class'])) {
+			$options['class'] .= ' ' . $attributes['class'];
+			unset($attributes['class']);
+		}
 
 		$attributes += [
 			'data-placement' => 'bottom',

+ 2 - 2
tests/TestCase/Utility/MimeTest.php

@@ -107,10 +107,10 @@ class MimeTest extends TestCase {
 	 * @return void
 	 */
 	public function testgetMimeTypeByAlias() {
-		$res = $this->Mime->detectMimeType('http://www.spiegel.de/static/sys/v10/icons/home_v2.png');
+		$res = $this->Mime->detectMimeType('https://raw.githubusercontent.com/dereuromark/cakephp-ide-helper/master/docs/img/code_completion.png');
 		$this->assertEquals('image/png', $res);
 
-		$res = $this->Mime->detectMimeType('http://www.spiegel.de/static/sys/v10/icons/home_v2_inexistent.png');
+		$res = $this->Mime->detectMimeType('https://raw.githubusercontent.com/dereuromark/cakephp-ide-helper/master/docs/img/code_completion_invalid.png');
 		$this->assertEquals('', $res);
 
 		$res = $this->Mime->detectMimeType(Plugin::path('Tools') . 'tests' . DS . 'test_files' . DS . 'img' . DS . 'hotel.jpg');

+ 2 - 2
tests/TestCase/Utility/UtilityTest.php

@@ -199,13 +199,13 @@ class UtilityTest extends TestCase {
 	 * @return void
 	 */
 	public function testFileExists() {
-		$res = Utility::fileExists('http://www.spiegel.de/static/sys/v10/icons/home_v2.png');
+		$res = Utility::fileExists('https://raw.githubusercontent.com/dereuromark/cakephp-tools/master/docs/README.md');
 		$this->assertTrue($res);
 
 		$res = Utility::fileExists(Plugin::path('Tools') . 'tests' . DS . 'test_files' . DS . 'img' . DS . 'hotel.jpg');
 		$this->assertTrue($res);
 
-		$res = Utility::fileExists('http://www.spiegel.de/static/sys/v10/icons/home_v2_inexistent.png');
+		$res = Utility::fileExists('https://raw.githubusercontent.com/dereuromark/cakephp-tools/master/docs/README_invalid.md');
 		$this->assertFalse($res);
 
 		$res = Utility::fileExists(Plugin::path('Tools') . 'tests' . DS . 'test_files' . DS . 'img' . DS . 'fooooo.jpg');

+ 9 - 0
tests/TestCase/View/Helper/FormatHelperTest.php

@@ -99,6 +99,15 @@ class FormatHelperTest extends TestCase {
 	/**
 	 * @return void
 	 */
+	public function testIconWithCustomClassAttributes() {
+		$result = $this->Format->icon('edit', [], ['class' => 'my-extra']);
+		$expected = '<i class="icon icon-edit fa fa-pencil my-extra" title="' . __d('tools', 'Edit') . '" data-placement="bottom" data-toggle="tooltip"></i>';
+		$this->assertEquals($expected, $result);
+	}
+
+	/**
+	 * @return void
+	 */
 	public function testIconWithCustomFontIcon() {
 		$this->Format->setConfig('fontIcons', ['edit' => 'fax fax-pen']);
 		$result = $this->Format->icon('edit');