phpunit.xml में bootstrap क्या है?
autoload / test / vendor / composer.json phpunit.xml
मूल:
& lt;? Xml संस्करण = "1.0" एन्कोडिंग = "UTF-8"? & Gt; & Lt; phpunit colors = "true" bootstrap = "विक्रेता / autoload.php" & gt; & LT; testsuites & gt; & Lt; testuite name = "अनुप्रयोग परीक्षण सूट" & gt; & LT; निर्देशिका & gt; ./ टेस्ट / & lt; / निर्देशिका & gt; & Lt; / testsuite & gt; & Lt; / testsuites & gt; & Lt; / PHPUnit & gt; composer.json,
{"आवश्यकता": {}, "require-dev": {"phpunit / phpunit": "*"} , "Autoload": {"psr-0": {"stats": ""}}} मूल परीक्षण resutl,
नीचे मेरा अपना autoload वर्ग autoload / ClassLoader.php है,
& lt;? Php नामस्थान MyVendor \ Autoload; क्लास क्लास लोडर {सार्वजनिक फ़ंक्शन फ़ेच ($ डायरेक्टरीज) {spl_autoload_register ([$ this, 'getClass']); } निजी फ़ंक्शन getClass ($ className) {....}} मेरा phpunit.xml , जिसे मैंने bootsrap बदल दिया है autoload / ClassLoader.php
और जब मैं सीएमडी में phpunit चलाता हूं और यह मेरा परीक्षा परिणाम है,
यह मूल से अलग दिखता है लेकिन यह नहीं कहा था कि यह असफल रहा है। तो क्या मेरा परीक्षण सही है?
कोई भी विचार?
अपना खुद का Bootstrap.php फ़ाइल, और अपने autoloader को पंजीकृत करने के लिए spl_autoload_register का उपयोग करें:
// बाहरी spl_autoload_register ('ClassLoader :: getClass'); // आंतरिक फ़ंक्शन autoload ($ className) {....} spl_autoload_register ('autoload'); फिर अपने phpunit.xml फ़ाइल में इसे कॉल करें:
& lt;? Xml संस्करण = "1.0" एन्कोडिंग = " UTF-8 "& gt; & Lt; phpunit colors = "true" bootstrap = "bootstrap.php" & gt; ...
No comments:
Post a Comment