Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.www.php > #22292
| From | alex <1j9448a02@lnx159sneakemail.com.invalid> |
|---|---|
| Newsgroups | it.comp.www.php |
| Subject | phpunit: debuggare un'Exception |
| Date | 2018-10-13 13:35 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <ppslaj$1jtq$1@gioia.aioe.org> (permalink) |
$ cat XTest.php
<?php
class XTest extends PHPUnit\Framework\TestCase {
function testY(): void {
throw new Ex;
}
}
class Ex extends \Exception {
function __toString() {
return
parent::__toString() . PHP_EOL .
'Altri dati di debug...'
;
}
}
$ vendor/bin/phpunit XTest.php
blablabla...
1) XTest::testY
Ex:
/tmp/tmp.ZyqmeJemwx/XTest.php:5
altri blablabla inutili...
Non è che la cosa mi dice molto.
Io vorrei, oltre ai blablabla, un output di questo tipo:
Ex in /tmp/tmp.ZyqmeJemwx/mio-script.php:3
Stack trace:
#0 {main}
Altri dati di debug...
che in genere si ottiene così:
<?php // mio-script.php
try {
throw new Ex;
}catch(Ex $ex){
// IL MIO GESTORE
echo $ex;
exit(1);
}
Non è che con phpunit si possano configurare dei catch personalizzati?
Back to it.comp.www.php | Previous | Next — Next in thread | Find similar | Unroll thread
phpunit: debuggare un'Exception alex <1j9448a02@lnx159sneakemail.com.invalid> - 2018-10-13 13:35 +0200 Re: phpunit: debuggare un'Exception alex <1j9448a02@lnx159sneakemail.com.invalid> - 2018-10-13 13:42 +0200
csiph-web