public static function read_one_ldif($file)
 {
     // open some LDIF file for reading
     $ldif = new Net_LDAP2_LDIF($file, 'r', array('onerror' => 'die'));
     $entry = $ldif->read_entry();
     $ldif->done();
     return $entry;
 }
Ejemplo n.º 2
0
 /**
  * Tests current_entry(). This should always return the same object
  */
 public function testCurrent_entry()
 {
     $ldif = new Net_LDAP2_LDIF(dirname(__FILE__) . '/ldif_data/unsorted_w50.ldif', 'r', $this->defaultConfig);
     $this->assertFalse((bool) $ldif->error());
     // read first entry
     $entry = $ldif->read_entry();
     $this->assertFalse((bool) $ldif->error(), 'First entry failed: ' . $ldif->error(true));
     // test if current_Entry remains the first one
     for ($i = 0; $i <= 10; $i++) {
         $e = $ldif->current_entry();
         $this->assertFalse((bool) $ldif->error(), $ldif->error(true));
         $this->assertEquals($entry, $e);
     }
 }