-
-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: improved, fixed optional parameters before required parameters
- Loading branch information
Showing
4 changed files
with
67 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/** | ||
* Test: Nette\PhpGenerator\Dumper::dump() errors | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use Nette\PhpGenerator\Dumper; | ||
use Tester\Assert; | ||
|
||
|
||
require __DIR__ . '/../bootstrap.php'; | ||
|
||
|
||
Assert::exception(function () { | ||
$dumper = new Dumper; | ||
$dumper->dump(function () {}); | ||
}, Nette\InvalidArgumentException::class, 'Cannot dump closure.'); | ||
|
||
|
||
Assert::exception(function () { | ||
$dumper = new Dumper; | ||
$dumper->dump(new class { | ||
}); | ||
}, Nette\InvalidArgumentException::class, 'Cannot dump anonymous class.'); | ||
|
||
|
||
Assert::exception(function () { | ||
$rec = []; | ||
$rec[] = &$rec; | ||
$dumper = new Dumper; | ||
$dumper->dump($rec); | ||
}, Nette\InvalidArgumentException::class, 'Nesting level too deep or recursive dependency.'); | ||
|
||
|
||
Assert::exception(function () { | ||
$rec = new stdClass; | ||
$rec->x = &$rec; | ||
$dumper = new Dumper; | ||
$dumper->dump($rec); | ||
}, Nette\InvalidArgumentException::class, 'Nesting level too deep or recursive dependency.'); |
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