I've attempted to use the method assertError(). This results in a method not found error from PHP:

from drupal_test_case.php, line 662.

        function assertError($expected = false, $message = "%s") {
            //$queue = &SimpleErrorQueue::instance();   <-- this static method doesn't exist in SimpleErrorQueue.
            // this technique for getting a queue object is found elsewhere in the Simpletest code. 
            $context = &SimpleTest::getContext(); 
            $queue = &$context->get('SimpleErrorQueue');
            // isEmpty doesn't exist.
            if ($queue->isEmpty()) {
CommentFileSizeAuthor
#1 expecterrorSimpleTest.patch4.97 KBRok Žlender

Comments

Rok Žlender’s picture

StatusFileSize
new4.97 KB

Asserterror is deprecated in latest SimpleTest. This is their explanation:

No method assertError(), assertNoErrors(), swallowErrors()
----------------------------------------------------------
These have been deprecated in 1.0.1beta in favour of
expectError() and expectException(). assertNoErrors() is
redundant if you use expectError() as failures are now reported
immediately.

My patch copies expectError form UnitTester. So now you can do something like this

  	$this->expectError('Undefined variable: url');
  	$url2 = $url;

This will give you a pass without exception.

Rok Žlender’s picture

Version: 5.x-1.0 » 6.x-1.x-dev
Assigned: Unassigned » Rok Žlender
Status: Active » Needs review
boombatower’s picture

Status: Needs review » Closed (won't fix)

Since the method is deprecated, this issue appears to have died, and focus has shifted to full coverage of 7.x I think it is fair to say this won't/doesn't need to get fixed.