Symfony / phpUnit : problème avec les notices
Bonjour,
je viens d'installer phpUnit pour une application symfony et tout fonctionne bien sur des Asserts Simple.
Cependant, je n'arrive pas a capturer les notices et warning et je ne sais pas pourquoi. J'ai bien vérifié mon php.ini etc... je suis un peu perdu si quelqu'un veut bien m'aider :oops:
Voici mes derniers tests:
phpunit.xml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <?xml version="1.0" encoding="UTF-8"?>
<phpunit
backupGlobals="true"
bootstrap="autoload.php"
backupStaticAttributes="false"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
mapTestClassNameToCoveredClassName="false"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
syntaxCheck="false"
testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"
strict="false"
verbose="false"
>
<testsuites>
<testsuite name="xxxxxxxx">
<!-- <directory>../plugins/*/test/phpunit</directory> -->
<directory>phpunit/tests</directory>
</testsuite>
</testsuites>
</phpunit> |
Mon test:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <?php
class ExpectedErrorTest extends PHPUnit_Framework_TestCase
{
/**
* @expectedException PHPUnit_Framework_Error_Notice
*/
public function testNotice()
{
ini_set('error_reporting', E_ALL | E_STRICT);
ini_set('display_errors','on');
$test=array();
$test2=$test[2];
}
}
?> |
et le résultat du test : phpunit -c test
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| PHPUnit 3.7.8 by Sebastian Bergmann.
Configuration read from C:\projet\test\phpunit.xml
F
Notice: Undefined offset: 2 in C:\projet\test\phpunit\tests\Query\SampleTest.php on line 13
Call Stack:
0.0002 325496 1. {main}() C:\wamp\bin\php\php5.3.8\phpunit:0
0.0088 684312 2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.8\phpunit:46
0.0088 684728 3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.8\PEAR\PHPUnit\TextUI\Command.php:129
0.3776 13425160 4. PHPUnit_TextUI_TestRunner->doRun() C:\wamp\bin\php\php5.3.8\PEAR\PHPUnit\TextUI\Command.php:176
0.3840 13811544 5. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\PEAR\PHPUnit\TextUI\TestRunner.php:346
0.3841 13811888 6. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\PEAR\PHPUnit\Framework\TestSuite.php:705
0.3842 13812120 7. PHPUnit_Framework_TestSuite->runTest() C:\wamp\bin\php\php5.3.8\PEAR\PHPUnit\Framework\TestSuite.php:745
0.3842 13812120 8. PHPUnit_Framework_TestCase->run() C:\wamp\bin\php\php5.3.8\PEAR\PHPUnit\Framework\TestSuite.php:775
0.3843 13812120 9. PHPUnit_Framework_TestResult->run() C:\wamp\bin\php\php5.3.8\PEAR\PHPUnit\Framework\TestCase.php:769
0.3880 13871864 10. PHPUnit_Framework_TestCase->runBare() C:\wamp\bin\php\php5.3.8\PEAR\PHPUnit\Framework\TestResult.php:648
0.3910 14051064 11. PHPUnit_Framework_TestCase->runTest() C:\wamp\bin\php\php5.3.8\PEAR\PHPUnit\Framework\TestCase.php:824
0.3910 14051880 12. ReflectionMethod->invokeArgs() C:\wamp\bin\php\php5.3.8\PEAR\PHPUnit\Framework\TestCase.php:969
0.3910 14051896 13. ExpectedErrorTest->testFailingInclude() C:\wamp\bin\php\php5.3.8\PEAR\PHPUnit\Framework\TestCase.php:969
.
Time: 1 second, Memory: 21.75Mb
There was 1 failure:
1) ExpectedErrorTest::testFailingInclude
Failed asserting that exception of type "PHPUnit_Framework_Error_Notice" is thrown. |
Merci
Ps: j'espère avoir mis toutes les informations nécessaires