[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/tests_runner/lib/simpletest/ -> HELP_MY_TESTS_DONT_WORK_ANYMORE (source)

   1  Simple Test interface changes
   2  =============================
   3  Because the SimpleTest tool set is still evolving it is likely that tests
   4  written with earlier versions will fail with the newest ones. The most
   5  dramatic changes are in the alpha releases. Here is a list of possible
   6  problems and their fixes...
   7  
   8  Method setWildcard() removed in mocks
   9  -------------------------------------
  10  Even setWildcard() has been removed in 1.0.1beta now.
  11  If you want to test explicitely for a '*' string, then
  12  simply pass in new IdenticalExpectation('*') instead.
  13  
  14  No method _getTest() on mocks
  15  -----------------------------
  16  This has finally been removed. It was a pretty esoteric
  17  flex point anyway. It was there to allow the mocks to
  18  work with other test tools, but no one does this.
  19  
  20  No method assertError(), assertNoErrors(), swallowErrors()
  21  ----------------------------------------------------------
  22  These have been deprecated in 1.0.1beta in favour of
  23  expectError() and expectException(). assertNoErrors() is
  24  redundant if you use expectError() as failures are now reported
  25  immediately.
  26  
  27  No method TestCase::signal()
  28  ----------------------------
  29  This has been deprecated in favour of triggering an error or
  30  throwing an exception. Deprecated as of 1.0.1beta.
  31  
  32  No method TestCase::sendMessage()
  33  ---------------------------------
  34  This has been deprecated as of 1.0.1beta.
  35  
  36  Failure to connect now emits failures
  37  -------------------------------------
  38  It used to be that you would have to use the
  39  getTransferError() call on the web tester to see if
  40  there was a socket level error in a fetch. This check
  41  is now always carried out by the WebTestCase unless
  42  the fetch is prefaced with WebTestCase::ignoreErrors().
  43  The ignore directive only lasts for test case fetching
  44  action such as get() and click().
  45  
  46  No method SimpleTestOptions::ignore()
  47  -------------------------------------
  48  This is deprecated in version 1.0.1beta and has been moved
  49  to SimpleTest::ignore() as that is more readable. In
  50  addition, parent classes are also ignored automatically.
  51  If you are using PHP5 you can skip this directive simply
  52  by marking your test case as abstract.
  53  
  54  No method assertCopy()
  55  ----------------------
  56  This is deprecated in 1.0.1 in favour of assertClone().
  57  The assertClone() method is slightly different in that
  58  the objects must be identical, but without being a
  59  reference. It is thus not a strict inversion of
  60  assertReference().
  61  
  62  Constructor wildcard override has no effect in mocks
  63  ----------------------------------------------------
  64  As of 1.0.1beta this is now set with setWildcard() instead
  65  of in the constructor.
  66  
  67  No methods setStubBaseClass()/getStubBaseClass()
  68  ------------------------------------------------
  69  As mocks are now used instead of stubs, these methods
  70  stopped working and are now removed as of the 1.0.1beta
  71  release. The mock objects may be freely used instead.
  72  
  73  No method addPartialMockCode()
  74  ------------------------------
  75  The ability to insert arbitrary partial mock code
  76  has been removed. This was a low value feature
  77  causing needless complications. It was removed
  78  in the 1.0.1beta release.
  79  
  80  No method setMockBaseClass()
  81  ----------------------------
  82  The ability to change the mock base class has been
  83  scheduled for removal and is deprecated since the
  84  1.0.1beta version. This was a rarely used feature
  85  except as a workaround for PHP5 limitations. As
  86  these limitations are being resolved it's hoped
  87  that the bundled mocks can be used directly.
  88  
  89  No class Stub
  90  -------------
  91  Server stubs are deprecated from 1.0.1 as the mocks now
  92  have exactly the same interface. Just use mock objects
  93  instead.
  94  
  95  No class SimpleTestOptions
  96  --------------------------
  97  This was replced by the shorter SimpleTest in 1.0.1beta1
  98  and is since deprecated.
  99  
 100  No file simple_test.php
 101  -----------------------
 102  This was renamed test_case.php in 1.0.1beta to more accurately
 103  reflect it's purpose. This file should never be directly
 104  included in test suites though, as it's part of the
 105  underlying mechanics and has a tendency to be refactored.
 106  
 107  No class WantedPatternExpectation
 108  ---------------------------------
 109  This was deprecated in 1.0.1alpha in favour of the simpler
 110  name PatternExpectation.
 111  
 112  No class NoUnwantedPatternExpectation
 113  -------------------------------------
 114  This was deprecated in 1.0.1alpha in favour of the simpler
 115  name NoPatternExpectation.
 116  
 117  No method assertNoUnwantedPattern()
 118  -----------------------------------
 119  This has been renamed to assertNoPattern() in 1.0.1alpha and
 120  the old form is deprecated.
 121  
 122  No method assertWantedPattern()
 123  -------------------------------
 124  This has been renamed to assertPattern() in 1.0.1alpha and
 125  the old form is deprecated.
 126  
 127  No method assertExpectation()
 128  -----------------------------
 129  This was renamed as assert() in 1.0.1alpha and the old form
 130  has been deprecated.
 131  
 132  No class WildcardExpectation
 133  ----------------------------
 134  This was a mostly internal class for the mock objects. It was
 135  renamed AnythingExpectation to bring it closer to JMock and
 136  NMock in version 1.0.1alpha.
 137  
 138  Missing UnitTestCase::assertErrorPattern()
 139  ------------------------------------------
 140  This method is deprecated for version 1.0.1 onwards.
 141  This method has been subsumed by assertError() that can now
 142  take an expectation. Simply pass a PatternExpectation
 143  into assertError() to simulate the old behaviour.
 144  
 145  No HTML when matching page elements
 146  -----------------------------------
 147  This behaviour has been switched to using plain text as if it
 148  were seen by the user of the browser. This means that HTML tags
 149  are suppressed, entities are converted and whitespace is
 150  normalised. This should make it easier to match items in forms.
 151  Also images are replaced with their "alt" text so that they
 152  can be matched as well.
 153  
 154  No method SimpleRunner::_getTestCase()
 155  --------------------------------------
 156  This was made public as getTestCase() in 1.0RC2.
 157  
 158  No method restartSession()
 159  --------------------------
 160  This was renamed to restart() in the WebTestCase, SimpleBrowser
 161  and the underlying SimpleUserAgent in 1.0RC2. Because it was
 162  undocumented anyway, no attempt was made at backward
 163  compatibility.
 164  
 165  My custom test case ignored by tally()
 166  --------------------------------------
 167  The _assertTrue method has had it's signature changed due to a bug
 168  in the PHP 5.0.1 release. You must now use getTest() from within
 169  that method to get the test case. Mock compatibility with other
 170  unit testers is now deprecated as of 1.0.1alpha as PEAR::PHPUnit2
 171  should soon have mock support of it's own.
 172  
 173  Broken code extending SimpleRunner
 174  ----------------------------------
 175  This was replaced with SimpleScorer so that I could use the runner
 176  name in another class. This happened in RC1 development and there
 177  is no easy backward compatibility fix. The solution is simply to
 178  extend SimpleScorer instead.
 179  
 180  Missing method getBaseCookieValue()
 181  -----------------------------------
 182  This was renamed getCurrentCookieValue() in RC1.
 183  
 184  Missing files from the SimpleTest suite
 185  ---------------------------------------
 186  Versions of SimpleTest prior to Beta6 required a SIMPLE_TEST constant
 187  to point at the SimpleTest folder location before any of the toolset
 188  was loaded. This is no longer documented as it is now unnecessary
 189  for later versions. If you are using an earlier version you may
 190  need this constant. Consult the documentation that was bundled with
 191  the release that you are using or upgrade to Beta6 or later.
 192  
 193  No method SimpleBrowser::getCurrentUrl()
 194  --------------------------------------
 195  This is replaced with the more versatile showRequest() for
 196  debugging. It only existed in this context for version Beta5.
 197  Later versions will have SimpleBrowser::getHistory() for tracking
 198  paths through pages. It is renamed as getUrl() since 1.0RC1.
 199  
 200  No method Stub::setStubBaseClass()
 201  ----------------------------------
 202  This method has finally been removed in 1.0RC1. Use
 203  SimpleTestOptions::setStubBaseClass() instead.
 204  
 205  No class CommandLineReporter
 206  ----------------------------
 207  This was renamed to TextReporter in Beta3 and the deprecated version
 208  was removed in 1.0RC1.
 209  
 210  No method requireReturn()
 211  -------------------------
 212  This was deprecated in Beta3 and is now removed.
 213  
 214  No method expectCookie()
 215  ------------------------
 216  This method was abruptly removed in Beta4 so as to simplify the internals
 217  until another mechanism can replace it. As a workaround it is necessary
 218  to assert that the cookie has changed by setting it before the page
 219  fetch and then assert the desired value.
 220  
 221  No method clickSubmitByFormId()
 222  -------------------------------
 223  This method had an incorrect name as no button was involved. It was
 224  renamed to submitByFormId() in Beta4 and the old version deprecated.
 225  Now removed.
 226  
 227  No method paintStart() or paintEnd()
 228  ------------------------------------
 229  You should only get this error if you have subclassed the lower level
 230  reporting and test runner machinery. These methods have been broken
 231  down into events for test methods, events for test cases and events
 232  for group tests. The new methods are...
 233  
 234  paintStart() --> paintMethodStart(), paintCaseStart(), paintGroupStart()
 235  paintEnd() --> paintMethodEnd(), paintCaseEnd(), paintGroupEnd()
 236  
 237  This change was made in Beta3, ironically to make it easier to subclass
 238  the inner machinery. Simply duplicating the code you had in the previous
 239  methods should provide a temporary fix.
 240  
 241  No class TestDisplay
 242  --------------------
 243  This has been folded into SimpleReporter in Beta3 and is now deprecated.
 244  It was removed in RC1.
 245  
 246  No method WebTestCase::fetch()
 247  ------------------------------
 248  This was renamed get() in Alpha8. It is removed in Beta3.
 249  
 250  No method submit()
 251  ------------------
 252  This has been renamed clickSubmit() in Beta1. The old method was
 253  removed in Beta2.
 254  
 255  No method clearHistory()
 256  ------------------------
 257  This method is deprecated in Beta2 and removed in RC1.
 258  
 259  No method getCallCount()
 260  ------------------------
 261  This method has been deprecated since Beta1 and has now been
 262  removed. There are now more ways to set expectations on counts
 263  and so this method should be unecessery. Removed in RC1.
 264  
 265  Cannot find file *
 266  ------------------
 267  The following public name changes have occoured...
 268  
 269  simple_html_test.php --> reporter.php
 270  simple_mock.php --> mock_objects.php
 271  simple_unit.php --> unit_tester.php
 272  simple_web.php --> web_tester.php
 273  
 274  The old names were deprecated in Alpha8 and removed in Beta1.
 275  
 276  No method attachObserver()
 277  --------------------------
 278  Prior to the Alpha8 release the old internal observer pattern was
 279  gutted and replaced with a visitor. This is to trade flexibility of
 280  test case expansion against the ease of writing user interfaces.
 281  
 282  Code such as...
 283  
 284  $test = &new MyTestCase();
 285  $test->attachObserver(new TestHtmlDisplay());
 286  $test->run();
 287  
 288  ...should be rewritten as...
 289  
 290  $test = &new MyTestCase();
 291  $test->run(new HtmlReporter());
 292  
 293  If you previously attached multiple observers then the workaround
 294  is to run the tests twice, once with each, until they can be combined.
 295  For one observer the old method is simulated in Alpha 8, but is
 296  removed in Beta1.
 297  
 298  No class TestHtmlDisplay
 299  ------------------------
 300  This class has been renamed to HtmlReporter in Alpha8. It is supported,
 301  but deprecated in Beta1 and removed in Beta2. If you have subclassed
 302  the display for your own design, then you will have to extend this
 303  class (HtmlReporter) instead.
 304  
 305  If you have accessed the event queue by overriding the notify() method
 306  then I am afraid you are in big trouble :(. The reporter is now
 307  carried around the test suite by the runner classes and the methods
 308  called directly. In the unlikely event that this is a problem and
 309  you don't want to upgrade the test tool then simplest is to write your
 310  own runner class and invoke the tests with...
 311  
 312  $test->accept(new MyRunner(new MyReporter()));
 313  
 314  ...rather than the run method. This should be easier to extend
 315  anyway and gives much more control. Even this method is overhauled
 316  in Beta3 where the runner class can be set within the test case. Really
 317  the best thing to do is to upgrade to this version as whatever you were
 318  trying to achieve before should now be very much easier.
 319  
 320  Missing set options method
 321  --------------------------
 322  All test suite options are now in one class called SimpleTestOptions.
 323  This means that options are set differently...
 324  
 325  GroupTest::ignore() --> SimpleTestOptions::ignore()
 326  Mock::setMockBaseClass() --> SimpleTestOptions::setMockBaseClass()
 327  
 328  These changed in Alpha8 and the old versions are now removed in RC1.
 329  
 330  No method setExpected*()
 331  ------------------------
 332  The mock expectations changed their names in Alpha4 and the old names
 333  ceased to be supported in Alpha8. The changes are...
 334  
 335  setExpectedArguments() --> expectArguments()
 336  setExpectedArgumentsSequence() --> expectArgumentsAt()
 337  setExpectedCallCount() --> expectCallCount()
 338  setMaximumCallCount() --> expectMaximumCallCount()
 339  
 340  The parameters remained the same.


Generated: Sat Nov 22 03:48:54 2008 Cross-referenced by PHPXref 0.7