Skip to content

Commit b4e7913

Browse files
fancywebnicolas-grekas
authored andcommitted
Add more tests
1 parent c657962 commit b4e7913

File tree

6 files changed

+71
-0
lines changed

6 files changed

+71
-0
lines changed

Tests/DebugClassLoaderTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,17 @@ public function testOverrideFinalProperty()
408408
$e = error_reporting(E_USER_DEPRECATED);
409409

410410
class_exists(Fixtures\OverrideFinalProperty::class, true);
411+
class_exists(Fixtures\FinalProperty\OverrideFinalPropertySameNamespace::class, true);
412+
class_exists('Test\\'.OverrideOutsideFinalProperty::class, true);
411413

412414
error_reporting($e);
413415
restore_error_handler();
414416

415417
$this->assertSame([
416418
'The "Symfony\Component\ErrorHandler\Tests\Fixtures\FinalProperty\FinalProperty::$pub" property is considered final. You should not override it in "Symfony\Component\ErrorHandler\Tests\Fixtures\OverrideFinalProperty".',
417419
'The "Symfony\Component\ErrorHandler\Tests\Fixtures\FinalProperty\FinalProperty::$prot" property is considered final. You should not override it in "Symfony\Component\ErrorHandler\Tests\Fixtures\OverrideFinalProperty".',
420+
'The "Symfony\Component\ErrorHandler\Tests\Fixtures\FinalProperty\FinalProperty::$implicitlyFinal" property is considered final. You should not override it in "Symfony\Component\ErrorHandler\Tests\Fixtures\OverrideFinalProperty".',
421+
'The "Test\Symfony\Component\ErrorHandler\Tests\FinalProperty\OutsideFinalProperty::$final" property is considered final. You should not override it in "Test\Symfony\Component\ErrorHandler\Tests\OverrideOutsideFinalProperty".'
418422
], $deprecations);
419423
}
420424

@@ -540,6 +544,10 @@ public function ownAbstractBaseMethod() { }
540544
return $fixtureDir.\DIRECTORY_SEPARATOR.'ReturnType.php';
541545
} elseif ('Test\\'.Fixtures\OutsideInterface::class === $class) {
542546
return $fixtureDir.\DIRECTORY_SEPARATOR.'OutsideInterface.php';
547+
} elseif ('Test\\'.OverrideOutsideFinalProperty::class === $class) {
548+
return $fixtureDir.'OverrideOutsideFinalProperty.php';
549+
} elseif ('Test\\Symfony\\Component\\ErrorHandler\\Tests\\FinalProperty\\OutsideFinalProperty' === $class) {
550+
return $fixtureDir.'FinalProperty'.\DIRECTORY_SEPARATOR.'OutsideFinalProperty.php';
543551
}
544552
}
545553
}

Tests/Fixtures/FinalProperty/FinalProperty.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,15 @@ class FinalProperty
1818
* @final
1919
*/
2020
private $priv;
21+
22+
/**
23+
* @final
24+
*/
25+
public $notOverriden;
26+
27+
protected $implicitlyFinal;
28+
29+
protected string $typedSoNotFinal;
30+
31+
protected $deprecated;
2132
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Test\Symfony\Component\ErrorHandler\Tests\FinalProperty;
4+
5+
class OutsideFinalProperty
6+
{
7+
/**
8+
* @final
9+
*/
10+
public $final;
11+
12+
protected $notImplicitlyFinalBecauseNotInSymfony;
13+
14+
/**
15+
* @final
16+
*/
17+
public $notOverriden;
18+
19+
/**
20+
* @final
21+
*/
22+
protected $deprecated;
23+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Symfony\Component\ErrorHandler\Tests\Fixtures\FinalProperty;
4+
5+
class OverrideFinalPropertySameNamespace extends FinalProperty
6+
{
7+
public $pub;
8+
}

Tests/Fixtures/OverrideFinalProperty.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,10 @@ class OverrideFinalProperty extends FinalProperty
99
public $pub;
1010
protected $prot;
1111
private $priv;
12+
protected $implicitlyFinal;
13+
protected string $typedSoNotFinal;
14+
/**
15+
* @deprecated
16+
*/
17+
protected $deprecated;
1218
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace Test\Symfony\Component\ErrorHandler\Tests;
4+
5+
use Test\Symfony\Component\ErrorHandler\Tests\FinalProperty\OutsideFinalProperty;
6+
7+
class OverrideOutsideFinalProperty extends OutsideFinalProperty
8+
{
9+
public $final;
10+
protected $notImplicitlyFinalBecauseNotInSymfony;
11+
/**
12+
* @deprecated
13+
*/
14+
protected $deprecated;
15+
}

0 commit comments

Comments
 (0)