Development

Changeset 20698

You must first sign up to be able to contribute.

Changeset 20698

Show
Ignore:
Timestamp:
08/02/09 16:48:18 (5 years ago)
Author:
bschussek
Message:

Implemented contains() and containsNot()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tools/lime/branches/2.0-experimental/lib/LimeTest.php

    r20696 r20698  
    409409  } 
    410410 
     411  public function contains($exp1, $exp2, $message = '') 
     412  { 
     413    $exp1 = LimeTester::create($exp1); 
     414    $exp2 = LimeTester::create($exp2); 
     415 
     416    try 
     417    { 
     418      $exp1->assertContains($exp2); 
     419 
     420      return $this->pass($message); 
     421    } 
     422    catch (LimeNotEqualException $e) 
     423    { 
     424      $error = sprintf("%s\n    doesn't contain\n%s", $e->getActual(), $e->getExpected()); 
     425 
     426      return $this->fail($message, $error); 
     427    } 
     428  } 
     429 
     430  public function containsNot($exp1, $exp2, $message = '') 
     431  { 
     432    $exp1 = LimeTester::create($exp1); 
     433    $exp2 = LimeTester::create($exp2); 
     434 
     435    try 
     436    { 
     437      $exp1->assertNotContains($exp2); 
     438 
     439      return $this->pass($message); 
     440    } 
     441    catch (LimeNotEqualException $e) 
     442    { 
     443      $error = sprintf("%s\n    must not contain\n%s", $e->getActual(), $e->getExpected()); 
     444 
     445      return $this->fail($message, $error); 
     446    } 
     447  } 
     448 
    411449  /** 
    412450   * Checks the availability of a method for an object or a class