Browse Source

Fix tests.

mscherer 6 years ago
parent
commit
582f28d2ce
2 changed files with 2 additions and 40 deletions
  1. 0 29
      src/Utility/Text.php
  2. 2 11
      tests/TestCase/Utility/TextTest.php

+ 0 - 29
src/Utility/Text.php

@@ -175,35 +175,6 @@ class Text extends CakeText {
 	}
 
 	/**
-	 * @param string $str
-	 * @param int $maxCols
-	 * @return string
-	 */
-	public static function convertToOrdTable($str, $maxCols = 20) {
-		$res = '<table>';
-		$r = ['chr' => [], 'ord' => []];
-		$chars = preg_split('//', $str, -1);
-		$count = 0;
-		foreach ($chars as $key => $char) {
-			if ($maxCols && $maxCols < $count || $key === count($chars) - 1) {
-				$res .= '<tr><th>' . implode('</th><th>', $r['chr']) . '</th>';
-				$res .= '</tr>';
-				$res .= '<tr>';
-				$res .= '<td>' . implode('</th><th>', $r['ord']) . '</td></tr>';
-				$count = 0;
-				$r = ['chr' => [], 'ord' => []];
-			}
-			$count++;
-			//$res[] = UnicodeLib::ord($char);
-			$r['ord'][] = ord($char);
-			$r['chr'][] = $char;
-		}
-
-		$res .= '</table>';
-		return $res;
-	}
-
-	/**
 	 * Explode a string of given tags into an array.
 	 *
 	 * @param string $tags

+ 2 - 11
tests/TestCase/Utility/TextTest.php

@@ -55,19 +55,10 @@ TXT;
 	 */
 	public function testConvertToOrd() {
 		$is = $this->Text->convertToOrd('h H');
-		//pr($is);
-		$this->assertEquals($is, '0-104-32-72-0');
+		$this->assertSame($is, '0-104-32-72-0');
 
 		$is = $this->Text->convertToOrd('x' . PHP_EOL . 'x' . PHP_EOL . 'x' . PHP_EOL . 'x' . PHP_EOL . 'x' . "\t" . 'x');
-		//pr($is);
-	}
-
-	/**
-	 * @return void
-	 */
-	public function testConvertToOrdTable() {
-		$is = $this->Text->convertToOrdTable('x' . PHP_EOL . 'x' . PHP_EOL . 'x' . PHP_EOL . 'x' . PHP_EOL . 'x' . "\t" . 'x');
-		//pr($is);
+		$this->assertSame('0-120-10-120-10-120-10-120-10-120-9-120-0', $is);
 	}
 
 	/**