⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 help_my_tests_dont_work_anymore.svn-base

📁 PHP 知识管理系统(基于树结构的知识管理系统), 英文原版的PHP源码。
💻 SVN-BASE
字号:
Simple Test interface changes=============================Because the SimpleTest tool set is still evolving it is likely that testswritten with earlier versions will fail with the newest ones. The mostdramatic changes are in the alpha releases. Here is a list of possibleproblems and their fixes...No method getRelativeUrls() or getAbsoluteUrls()------------------------------------------------These methods were always a bit weird anyway, andthe new parsing of the base tag makes them more so.They have been replaced with getUrls() instead. Ifyou want the old functionality then simply chopoff the current domain from getUrl().Method setWildcard() removed in mocks-------------------------------------Even setWildcard() has been removed in 1.0.1beta now.If you want to test explicitely for a '*' string, thensimply pass in new IdenticalExpectation('*') instead.No method _getTest() on mocks-----------------------------This has finally been removed. It was a pretty esotericflex point anyway. It was there to allow the mocks towork with other test tools, but no one does this.No method assertError(), assertNoErrors(), swallowErrors()----------------------------------------------------------These have been deprecated in 1.0.1beta in favour ofexpectError() and expectException(). assertNoErrors() isredundant if you use expectError() as failures are now reportedimmediately.No method TestCase::signal()----------------------------This has been deprecated in favour of triggering an error orthrowing an exception. Deprecated as of 1.0.1beta.No method TestCase::sendMessage()---------------------------------This has been deprecated as of 1.0.1beta.Failure to connect now emits failures-------------------------------------It used to be that you would have to use thegetTransferError() call on the web tester to see ifthere was a socket level error in a fetch. This checkis now always carried out by the WebTestCase unlessthe fetch is prefaced with WebTestCase::ignoreErrors().The ignore directive only lasts for test case fetchingaction such as get() and click().No method SimpleTestOptions::ignore()-------------------------------------This is deprecated in version 1.0.1beta and has been movedto SimpleTest::ignore() as that is more readable. Inaddition, parent classes are also ignored automatically.If you are using PHP5 you can skip this directive simplyby marking your test case as abstract.No method assertCopy()----------------------This is deprecated in 1.0.1 in favour of assertClone().The assertClone() method is slightly different in thatthe objects must be identical, but without being areference. It is thus not a strict inversion ofassertReference().Constructor wildcard override has no effect in mocks----------------------------------------------------As of 1.0.1beta this is now set with setWildcard() insteadof in the constructor.No methods setStubBaseClass()/getStubBaseClass()------------------------------------------------As mocks are now used instead of stubs, these methodsstopped working and are now removed as of the 1.0.1betarelease. The mock objects may be freely used instead.No method addPartialMockCode()------------------------------The ability to insert arbitrary partial mock codehas been removed. This was a low value featurecausing needless complications. It was removedin the 1.0.1beta release.No method setMockBaseClass()----------------------------The ability to change the mock base class has beenscheduled for removal and is deprecated since the1.0.1beta version. This was a rarely used featureexcept as a workaround for PHP5 limitations. Asthese limitations are being resolved it's hopedthat the bundled mocks can be used directly.No class Stub-------------Server stubs are deprecated from 1.0.1 as the mocks nowhave exactly the same interface. Just use mock objectsinstead.No class SimpleTestOptions--------------------------This was replced by the shorter SimpleTest in 1.0.1beta1and is since deprecated.No file simple_test.php-----------------------This was renamed test_case.php in 1.0.1beta to more accuratelyreflect it's purpose. This file should never be directlyincluded in test suites though, as it's part of theunderlying mechanics and has a tendency to be refactored.No class WantedPatternExpectation---------------------------------This was deprecated in 1.0.1alpha in favour of the simplername PatternExpectation.No class NoUnwantedPatternExpectation-------------------------------------This was deprecated in 1.0.1alpha in favour of the simplername NoPatternExpectation.No method assertNoUnwantedPattern()-----------------------------------This has been renamed to assertNoPattern() in 1.0.1alpha andthe old form is deprecated.No method assertWantedPattern()-------------------------------This has been renamed to assertPattern() in 1.0.1alpha andthe old form is deprecated.No method assertExpectation()-----------------------------This was renamed as assert() in 1.0.1alpha and the old formhas been deprecated.No class WildcardExpectation----------------------------This was a mostly internal class for the mock objects. It wasrenamed AnythingExpectation to bring it closer to JMock andNMock in version 1.0.1alpha.Missing UnitTestCase::assertErrorPattern()------------------------------------------This method is deprecated for version 1.0.1 onwards.This method has been subsumed by assertError() that can nowtake an expectation. Simply pass a PatternExpectationinto assertError() to simulate the old behaviour.No HTML when matching page elements-----------------------------------This behaviour has been switched to using plain text as if itwere seen by the user of the browser. This means that HTML tagsare suppressed, entities are converted and whitespace isnormalised. This should make it easier to match items in forms.Also images are replaced with their "alt" text so that theycan be matched as well.No method SimpleRunner::_getTestCase()--------------------------------------This was made public as getTestCase() in 1.0RC2.No method restartSession()--------------------------This was renamed to restart() in the WebTestCase, SimpleBrowserand the underlying SimpleUserAgent in 1.0RC2. Because it wasundocumented anyway, no attempt was made at backwardcompatibility.My custom test case ignored by tally()--------------------------------------The _assertTrue method has had it's signature changed due to a bugin the PHP 5.0.1 release. You must now use getTest() from withinthat method to get the test case. Mock compatibility with otherunit testers is now deprecated as of 1.0.1alpha as PEAR::PHPUnit2should soon have mock support of it's own.Broken code extending SimpleRunner----------------------------------This was replaced with SimpleScorer so that I could use the runnername in another class. This happened in RC1 development and thereis no easy backward compatibility fix. The solution is simply toextend SimpleScorer instead.Missing method getBaseCookieValue()-----------------------------------This was renamed getCurrentCookieValue() in RC1.Missing files from the SimpleTest suite---------------------------------------Versions of SimpleTest prior to Beta6 required a SIMPLE_TEST constantto point at the SimpleTest folder location before any of the toolsetwas loaded. This is no longer documented as it is now unnecessaryfor later versions. If you are using an earlier version you mayneed this constant. Consult the documentation that was bundled withthe release that you are using or upgrade to Beta6 or later.No method SimpleBrowser::getCurrentUrl()--------------------------------------This is replaced with the more versatile showRequest() fordebugging. It only existed in this context for version Beta5.Later versions will have SimpleBrowser::getHistory() for trackingpaths through pages. It is renamed as getUrl() since 1.0RC1.No method Stub::setStubBaseClass()----------------------------------This method has finally been removed in 1.0RC1. UseSimpleTestOptions::setStubBaseClass() instead.No class CommandLineReporter----------------------------This was renamed to TextReporter in Beta3 and the deprecated versionwas removed in 1.0RC1.No method requireReturn()-------------------------This was deprecated in Beta3 and is now removed.No method expectCookie()------------------------This method was abruptly removed in Beta4 so as to simplify the internalsuntil another mechanism can replace it. As a workaround it is necessaryto assert that the cookie has changed by setting it before the pagefetch and then assert the desired value.No method clickSubmitByFormId()-------------------------------This method had an incorrect name as no button was involved. It wasrenamed to submitByFormId() in Beta4 and the old version deprecated.Now removed.No method paintStart() or paintEnd()------------------------------------You should only get this error if you have subclassed the lower levelreporting and test runner machinery. These methods have been brokendown into events for test methods, events for test cases and eventsfor group tests. The new methods are...paintStart() --> paintMethodStart(), paintCaseStart(), paintGroupStart()paintEnd() --> paintMethodEnd(), paintCaseEnd(), paintGroupEnd()This change was made in Beta3, ironically to make it easier to subclassthe inner machinery. Simply duplicating the code you had in the previousmethods should provide a temporary fix.No class TestDisplay--------------------This has been folded into SimpleReporter in Beta3 and is now deprecated.It was removed in RC1.No method WebTestCase::fetch()------------------------------This was renamed get() in Alpha8. It is removed in Beta3.No method submit()------------------This has been renamed clickSubmit() in Beta1. The old method wasremoved in Beta2.No method clearHistory()------------------------This method is deprecated in Beta2 and removed in RC1.No method getCallCount()------------------------This method has been deprecated since Beta1 and has now beenremoved. There are now more ways to set expectations on countsand so this method should be unecessery. Removed in RC1.Cannot find file *------------------The following public name changes have occoured...simple_html_test.php --> reporter.phpsimple_mock.php --> mock_objects.phpsimple_unit.php --> unit_tester.phpsimple_web.php --> web_tester.phpThe old names were deprecated in Alpha8 and removed in Beta1.No method attachObserver()--------------------------Prior to the Alpha8 release the old internal observer pattern wasgutted and replaced with a visitor. This is to trade flexibility oftest case expansion against the ease of writing user interfaces.Code such as...$test = &new MyTestCase();$test->attachObserver(new TestHtmlDisplay());$test->run();...should be rewritten as...$test = &new MyTestCase();$test->run(new HtmlReporter());If you previously attached multiple observers then the workaroundis to run the tests twice, once with each, until they can be combined.For one observer the old method is simulated in Alpha 8, but isremoved in Beta1.No class TestHtmlDisplay------------------------This class has been renamed to HtmlReporter in Alpha8. It is supported,but deprecated in Beta1 and removed in Beta2. If you have subclassedthe display for your own design, then you will have to extend thisclass (HtmlReporter) instead.If you have accessed the event queue by overriding the notify() methodthen I am afraid you are in big trouble :(. The reporter is nowcarried around the test suite by the runner classes and the methodscalled directly. In the unlikely event that this is a problem andyou don't want to upgrade the test tool then simplest is to write yourown runner class and invoke the tests with...$test->accept(new MyRunner(new MyReporter()));...rather than the run method. This should be easier to extendanyway and gives much more control. Even this method is overhauledin Beta3 where the runner class can be set within the test case. Reallythe best thing to do is to upgrade to this version as whatever you weretrying to achieve before should now be very much easier.Missing set options method--------------------------All test suite options are now in one class called SimpleTestOptions.This means that options are set differently...GroupTest::ignore() --> SimpleTestOptions::ignore()Mock::setMockBaseClass() --> SimpleTestOptions::setMockBaseClass()These changed in Alpha8 and the old versions are now removed in RC1.No method setExpected*()------------------------The mock expectations changed their names in Alpha4 and the old namesceased to be supported in Alpha8. The changes are...setExpectedArguments() --> expectArguments()setExpectedArgumentsSequence() --> expectArgumentsAt()setExpectedCallCount() --> expectCallCount()setMaximumCallCount() --> expectMaximumCallCount()The parameters remained the same.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -