Example #1
0
 /**
  * Tests getting key of a needle from a list
  * @covers \Copycat\Structure\ArrayObject::search()
  */
 public function testSearch()
 {
     $arrayObject = new ArrayObject(array(1, 'foo', 'bar' => 'baz'));
     $this->assertEquals(1, $arrayObject->search('foo'));
     $this->assertEquals('bar', $arrayObject->search('baz'));
     $this->assertFalse($arrayObject->search('bar'));
 }
Example #2
0
 public function testSearchWorks()
 {
     $this->collection[] = (object) array('prop' => 'value1');
     $this->collection[] = (object) array('prop' => 'value2');
     $this->assertSame(1, $this->collection->search('prop', 'value2'));
 }