Chris@13: assertSame('/* Some comment */', $comment->getText()); Chris@0: $this->assertSame('/* Some comment */', (string) $comment); Chris@0: $this->assertSame(1, $comment->getLine()); Chris@0: $this->assertSame(10, $comment->getFilePos()); Chris@13: $this->assertSame(2, $comment->getTokenPos()); Chris@0: } Chris@0: Chris@0: /** Chris@0: * @dataProvider provideTestReformatting Chris@0: */ Chris@0: public function testReformatting($commentText, $reformattedText) { Chris@0: $comment = new Comment($commentText); Chris@0: $this->assertSame($reformattedText, $comment->getReformattedText()); Chris@0: } Chris@0: Chris@0: public function provideTestReformatting() { Chris@13: return [ Chris@13: ['// Some text' . "\n", '// Some text'], Chris@13: ['/* Some text */', '/* Some text */'], Chris@13: [ Chris@0: '/** Chris@0: * Some text. Chris@0: * Some more text. Chris@0: */', Chris@0: '/** Chris@0: * Some text. Chris@0: * Some more text. Chris@0: */' Chris@13: ], Chris@13: [ Chris@0: '/* Chris@0: Some text. Chris@0: Some more text. Chris@0: */', Chris@0: '/* Chris@0: Some text. Chris@0: Some more text. Chris@0: */' Chris@13: ], Chris@13: [ Chris@0: '/* Some text. Chris@0: More text. Chris@0: Even more text. */', Chris@0: '/* Some text. Chris@0: More text. Chris@0: Even more text. */' Chris@13: ], Chris@13: [ Chris@0: '/* Some text. Chris@0: More text. Chris@0: Indented text. */', Chris@0: '/* Some text. Chris@0: More text. Chris@0: Indented text. */', Chris@13: ], Chris@0: // invalid comment -> no reformatting Chris@13: [ Chris@0: 'hallo Chris@0: world', Chris@0: 'hallo Chris@0: world', Chris@13: ], Chris@13: ]; Chris@0: } Chris@13: }