Use ::class to resolve class names in tests
[lhc/web/wiklou.git] / tests / phpunit / includes / content / TextContentTest.php
index b4ae765..b548091 100644 (file)
@@ -212,7 +212,6 @@ class TextContentTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider dataIsCountable
-        * @group Database
         * @covers TextContent::isCountable
         */
        public function testIsCountable( $text, $hasLinks, $mode, $expected ) {
@@ -455,8 +454,34 @@ class TextContentTest extends MediaWikiLangTestCase {
                if ( $expectedNative === false ) {
                        $this->assertFalse( $converted, "conversion to $model was expected to fail!" );
                } else {
-                       $this->assertInstanceOf( 'Content', $converted );
+                       $this->assertInstanceOf( Content::class, $converted );
                        $this->assertEquals( $expectedNative, $converted->getNativeData() );
                }
        }
+
+       /**
+        * @covers TextContent::normalizeLineEndings
+        * @dataProvider provideNormalizeLineEndings
+        */
+       public function testNormalizeLineEndings( $input, $expected ) {
+               $this->assertEquals( $expected, TextContent::normalizeLineEndings( $input ) );
+       }
+
+       public static function provideNormalizeLineEndings() {
+               return [
+                       [
+                               "Foo\r\nbar",
+                               "Foo\nbar"
+                       ],
+                       [
+                               "Foo\rbar",
+                               "Foo\nbar"
+                       ],
+                       [
+                               "Foobar\n  ",
+                               "Foobar"
+                       ]
+               ];
+       }
+
 }