Chris@0: 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@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@0: return array( Chris@0: array('// Some text' . "\n", '// Some text'), Chris@0: array('/* Some text */', '/* Some text */'), Chris@0: array( 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@0: ), Chris@0: array( 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@0: ), Chris@0: array( 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@0: ), Chris@0: array( 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@0: ), Chris@0: // invalid comment -> no reformatting Chris@0: array( Chris@0: 'hallo Chris@0: world', Chris@0: 'hallo Chris@0: world', Chris@0: ), Chris@0: ); Chris@0: } Chris@0: }