1Simple Test interface changes 2============================= 3Because the SimpleTest tool set is still evolving it is likely that tests 4written with earlier versions will fail with the newest ones. The most 5dramatic changes are in the alpha releases. Here is a list of possible 6problems... 7 8No HTML when matching page elements 9----------------------------------- 10This behaviour has been switched to using plain text as if it 11were seen by the user of the browser. This means that HTML tags 12are suppressed, entities are converted and whitespace is 13normalised. This should make it easier to match items in forms. 14Also images are replaced with their "alt" text so that they 15can be matched as well. 16 17No method SimpleRunner::_getTestCase() 18-------------------------------------- 19This was made public as getTestCase() in 1.0RC2. 20 21No method restartSession() 22-------------------------- 23This was renamed to restart() in the WebTestCase, SimpleBrowser 24and the underlying SimpleUserAgent in 1.0RC2. Because it was 25undocumented anyway, no attempt was made at backward 26compatibility. 27 28My custom test case ignored by tally() 29-------------------------------------- 30The _assertTrue method has had it's signature changed due to a bug 31in the PHP 5.0.1 release. You must now use getTest() from within 32that method to get the test case. 33 34Broken code extending SimpleRunner 35---------------------------------- 36This was replaced with SimpleScorer so that I could use the runner 37name in another class. This happened in RC1 development and there 38is no easy backward compatibility fix. The solution is simply to 39extend SimpleScorer instead. 40 41Missing method getBaseCookieValue() 42----------------------------------- 43This was renamed getCurrentCookieValue() in RC1. 44 45Missing files from the SimpleTest suite 46--------------------------------------- 47Versions of SimpleTest prior to Beta6 required a SIMPLE_TEST constant 48to point at the SimpleTest folder location before any of the toolset 49was loaded. This is no longer documented as it is now unnecessary 50for later versions. If you are using an earlier version you may 51need this constant. Consult the documentation that was bundled with 52the release that you are using or upgrade to Beta6 or later. 53 54No method SimpleBrowser::getCurrentUrl() 55-------------------------------------- 56This is replaced with the more versatile showRequest() for 57debugging. It only existed in this context for version Beta5. 58Later versions will have SimpleBrowser::getHistory() for tracking 59paths through pages. It is renamed as getUrl() since 1.0RC1. 60 61No method Stub::setStubBaseClass() 62---------------------------------- 63This method has finally been removed in 1.0RC1. Use 64SimpleTestOptions::setStubBaseClass() instead. 65 66No class CommandLineReporter 67---------------------------- 68This was renamed to TextReporter in Beta3 and the deprecated version 69was removed in 1.0RC1. 70 71No method requireReturn() 72------------------------- 73This was deprecated in Beta3 and is now removed. 74 75No method expectCookie() 76------------------------ 77This method was abruptly removed in Beta4 so as to simplify the internals 78until another mechanism can replace it. As a workaround it is necessary 79to assert that the cookie has changed by setting it before the page 80fetch and then assert the desired value. 81 82No method clickSubmitByFormId() 83------------------------------- 84This method had an incorrect name as no button was involved. It was 85renamed to submitByFormId() in Beta4 and the old version deprecated. 86Now removed. 87 88No method paintStart() or paintEnd() 89------------------------------------ 90You should only get this error if you have subclassed the lower level 91reporting and test runner machinery. These methods have been broken 92down into events for test methods, events for test cases and events 93for group tests. The new methods are... 94 95paintStart() --> paintMethodStart(), paintCaseStart(), paintGroupStart() 96paintEnd() --> paintMethodEnd(), paintCaseEnd(), paintGroupEnd() 97 98This change was made in Beta3, ironically to make it easier to subclass 99the inner machinery. Simply duplicating the code you had in the previous 100methods should provide a temporary fix. 101 102No class TestDisplay 103-------------------- 104This has been folded into SimpleReporter in Beta3 and is now deprecated. 105It was removed in RC1. 106 107No method WebTestCase::fetch() 108------------------------------ 109This was renamed get() in Alpha8. It is removed in Beta3. 110 111No method submit() 112------------------ 113This has been renamed clickSubmit() in Beta1. The old method was 114removed in Beta2. 115 116No method clearHistory() 117------------------------ 118This method is deprecated in Beta2 and removed in RC1. 119 120No method getCallCount() 121------------------------ 122This method has been deprecated since Beta1 and has now been 123removed. There are now more ways to set expectations on counts 124and so this method should be unecessery. Removed in RC1. 125 126Cannot find file * 127------------------ 128The following public name changes have occoured... 129 130simple_html_test.php --> reporter.php 131simple_mock.php --> mock_objects.php 132simple_unit.php --> unit_tester.php 133simple_web.php --> web_tester.php 134 135The old names were deprecated in Alpha8 and removed in Beta1. 136 137No method attachObserver() 138-------------------------- 139Prior to the Alpha8 release the old internal observer pattern was 140gutted and replaced with a visitor. This is to trade flexibility of 141test case expansion against the ease of writing user interfaces. 142 143Code such as... 144 145$test = &new MyTestCase(); 146$test->attachObserver(new TestHtmlDisplay()); 147$test->run(); 148 149...should be rewritten as... 150 151$test = &new MyTestCase(); 152$test->run(new HtmlReporter()); 153 154If you previously attached multiple observers then the workaround 155is to run the tests twice, once with each, until they can be combined. 156For one observer the old method is simulated in Alpha 8, but is 157removed in Beta1. 158 159No class TestHtmlDisplay 160------------------------ 161This class has been renamed to HtmlReporter in Alpha8. It is supported, 162but deprecated in Beta1 and removed in Beta2. If you have subclassed 163the display for your own design, then you will have to extend this 164class (HtmlReporter) instead. 165 166If you have accessed the event queue by overriding the notify() method 167then I am afraid you are in big trouble :(. The reporter is now 168carried around the test suite by the runner classes and the methods 169called directly. In the unlikely event that this is a problem and 170you don't want to upgrade the test tool then simplest is to write your 171own runner class and invoke the tests with... 172 173$test->accept(new MyRunner(new MyReporter())); 174 175...rather than the run method. This should be easier to extend 176anyway and gives much more control. Even this method is overhauled 177in Beta3 where the runner class can be set within the test case. Really 178the best thing to do is to upgrade to this version as whatever you were 179trying to achieve before should now be very much easier. 180 181Missing set options method 182-------------------------- 183All test suite options are now in one class called SimpleTestOptions. 184This means that options are set differently... 185 186GroupTest::ignore() --> SimpleTestOptions::ignore() 187Mock::setMockBaseClass() --> SimpleTestOptions::setMockBaseClass() 188 189These changed in Alpha8 and the old versions are now removed in RC1. 190 191No method setExpected*() 192------------------------ 193The mock expectations changed their names in Alpha4 and the old names 194ceased to be supported in Alpha8. The changes are... 195 196setExpectedArguments() --> expectArguments() 197setExpectedArgumentsSequence() --> expectArgumentsAt() 198setExpectedCallCount() --> expectCallCount() 199setMaximumCallCount() --> expectMaximumCallCount() 200 201The parameters remained the same. 202