-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GH-20] Add tests for triggerIfCalledFromOutside
- Loading branch information
Showing
5 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace DeprecationTests; | ||
|
||
use Doctrine\Foo\Bar; | ||
|
||
class Foo | ||
{ | ||
public function triggerDependencyWithDeprecation() | ||
{ | ||
$bar = new Bar(); | ||
$bar->oldFunc(); | ||
} | ||
|
||
public function triggerDependencyWithDeprecationFromInside() | ||
{ | ||
$bar = new Bar(); | ||
$bar->newFunc(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Doctrine\Foo; | ||
|
||
use Doctrine\Deprecations\Deprecation; | ||
|
||
class Bar | ||
{ | ||
public function oldFunc() | ||
{ | ||
Deprecation::triggerIfCalledFromOutside( | ||
'doctrine/foo', | ||
'https://github.com/doctrine/foo', | ||
'Bar::oldFunc() is deprecated, use Bar::newFunc() instead.' | ||
); | ||
} | ||
|
||
public function newFunc() | ||
{ | ||
$this->oldFunc(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace Doctrine\Foo; | ||
|
||
class Baz | ||
{ | ||
public function usingOldFunc() | ||
{ | ||
$bar = new Bar(); | ||
$bar->oldFunc(); | ||
} | ||
} |