Advertisement
Guest User

Giorgio Sironi

a guest
Sep 25th, 2009
493
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. class AssertionsTest extends PHPUnit_Framework_TestCase
  4. {
  5.     public function testAssertionsMethodsWorksWithCorrectArguments()
  6.     {
  7.         $this->assertTrue(1 == 1);
  8.         $this->assertTrue(true);
  9.         $this->assertFalse(false);
  10.         $this->assertFalse(0 == 1);
  11.  
  12.         $this->assertEquals('foo', 'foo');
  13.         $this->assertEquals(1, "1");
  14.         $this->assertNotEquals(1, 2);
  15.         $this->assertSame(1, 1);
  16.         $this->assertNotSame(1, "1");
  17.  
  18.         $this->assertContains('foo', array('foo', 'otherValue'));
  19.         $this->assertContains('foo', new ArrayIterator(array('foo', 'otherValue')));
  20.         $this->assertNotContains('foo', array('otherValue'));
  21.         $this->assertContainsOnly('string', array('foo', 'otherValue'));
  22.  
  23.         $this->assertArrayHasKey(0, array('foo'));
  24.         $this->assertArrayHasKey('foo', array('foo' => 'bar', 'otherValue'));
  25.     }
  26. }
Advertisement
RAW Paste Data Copied
Advertisement