Skip to content

Commit

Permalink
#751 test asset - PHP 7.1-style nullable parameter with default value…
Browse files Browse the repository at this point in the history
…, yet not optional (not in last position in the signature)
  • Loading branch information
Ocramius committed Dec 3, 2016
1 parent cb24146 commit 8c4cb0b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/Doctrine/Tests/Common/Proxy/ProxyGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,33 @@ public function testClassWithNullableOptionalNonLastParameterOnProxiedMethods()
);
}

/**
* @group #751
*
* @requires PHP 7.1
*/
public function testClassWithPhp71NullableOptionalNonLastParameterOnProxiedMethods()
{
$className = Php71NullableDefaultedNonOptionalHintClass::class;

if (!class_exists('Doctrine\Tests\Common\ProxyProxy\__CG__\Php71NullableDefaultedNonOptionalHintClass', false)) {
$metadata = $this->createClassMetadata($className, ['id']);

$proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy', true);
$this->generateAndRequire($proxyGenerator, $metadata);
}

$this->assertContains(
'public function midSignatureNullableParameter(?string $param = NULL, $secondParam)',
file_get_contents(__DIR__ . '/generated/__CG__DoctrineTestsCommonProxyPhp71NullableDefaultedNonOptionalHintClass.php')
);

$this->assertContains(
'public function midSignatureNotNullableHintedParameter(?string $param = \'foo\', $secondParam)',
file_get_contents(__DIR__ . '/generated/__CG__DoctrineTestsCommonProxyPhp71NullableDefaultedNonOptionalHintClass.php')
);
}

/**
* @requires PHP 7.1
*/
Expand Down

0 comments on commit 8c4cb0b

Please sign in to comment.