Skip to content

Commit

Permalink
Minor changes to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-smith-maco committed Nov 14, 2017
1 parent 6bb85c4 commit 1b4e7f5
Showing 1 changed file with 9 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1149,56 +1149,24 @@ public function testDoesNotListIndexesImplicitlyCreatedByForeignKeys()

/**
* @dataProvider commentsProvider
*
* @param string $comment
* @param string $expected
* @param string $currentType
* @return void
*/
public function testExtractDoctrineTypeFromComment($comment, $expected, $currentType) : void
public function testExtractDoctrineTypeFromComment(string $comment, string $expected, string $currentType) : void
{
$result = $this->_sm->extractDoctrineTypeFromComment($comment, $currentType);
self::assertSame($expected, $result);
}

/**
* @return array
*/
public function commentsProvider() : array
{
$currentType = 'current type';

return array(
array(
'(DC2Type:type.should.return)',
'type.should.return',
$currentType,
),
array(
'should.return.current.type',
$currentType,
$currentType,
),
array(
'(DC2Type:Some\Namespace\Class)',
'Some\Namespace\Class',
$currentType,
),
array(
'(DC2Type:guid)',
'guid',
$currentType,
),
array(
'(DC2Type:should.stop)).before)',
'should.stop',
$currentType,
),
array(
'(DC2Type:should((.stop)).before)',
'should((.stop',
$currentType,
),
);
return [
'valid custom type with dots' => ['(DC2Type:type.should.return)', 'type.should.return', $currentType],
'invalid custom type comments' => ['should.return.current.type', $currentType, $currentType],
'valid custom type with namespace' => ['(DC2Type:Some\Namespace\Class)', 'Some\Namespace\Class', $currentType],
'valid doctrine type' => ['(DC2Type:guid)', 'guid', $currentType],
'valid custom type with extra closing bracket' => ['(DC2Type:should.stop)).before)', 'should.stop', $currentType],
'valid custom type with extra opening brackets' => ['(DC2Type:should((.stop)).before)', 'should((.stop', $currentType],
];
}
}

0 comments on commit 1b4e7f5

Please sign in to comment.