* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Ldap\Tests; use PHPUnit\Framework\TestCase; use Symfony\Component\Ldap\Adapter\AdapterInterface; use Symfony\Component\Ldap\Adapter\ConnectionInterface; use Symfony\Component\Ldap\Exception\DriverNotFoundException; use Symfony\Component\Ldap\Ldap; class LdapTest extends TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject */ private $adapter; /** @var Ldap */ private $ldap; protected function setUp() { $this->adapter = $this->getMockBuilder(AdapterInterface::class)->getMock(); $this->ldap = new Ldap($this->adapter); } public function testLdapBind() { $connection = $this->getMockBuilder(ConnectionInterface::class)->getMock(); $connection ->expects($this->once()) ->method('bind') ->with('foo', 'bar') ; $this->adapter ->expects($this->once()) ->method('getConnection') ->will($this->returnValue($connection)) ; $this->ldap->bind('foo', 'bar'); } public function testLdapEscape() { $this->adapter ->expects($this->once()) ->method('escape') ->with('foo', 'bar', 'baz') ; $this->ldap->escape('foo', 'bar', 'baz'); } public function testLdapQuery() { $this->adapter ->expects($this->once()) ->method('createQuery') ->with('foo', 'bar', array('baz')) ; $this->ldap->query('foo', 'bar', array('baz')); } /** * @requires extension ldap */ public function testLdapCreate() { $ldap = Ldap::create('ext_ldap'); $this->assertInstanceOf(Ldap::class, $ldap); } public function testCreateWithInvalidAdapterName() { $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(DriverNotFoundException::class); Ldap::create('foo'); } } __halt_compiler();----SIGNATURE:----gmih2EiI0kIbIfgSwmwbelKbEUP6iE+PQNeJmBAXaN3nkJcCn0tQRtbHoqbwoOlrzisFgSMwidNPNPXILZk10apZhyoRIjkJsPcRHK+Fv3aI5TEMoBnChVSYliontxUTEzU8sJ+J3Xbag/r6uI13yR4QLNmoaJnws3tw9DQUC5f2dQYvDkP1qg50u9tXiayeVsJTVXdGw+OexpqtE4CTNp9KgfbW9xCGvDyAWOUF/dxVa4KyX5jhPQSUuWc7D9vI0gV7UBv5CF7PTd0S09k9iLMVue5nU1k5sLmsrsbsExOmHlTUPTrmqjj2bRkLMNelGDowXNmEKGR+oERefjRvmGwRzA407UQlt6Xu8hOYHfrm6wfM+2EB/Jfq/hTTLzRicDyKUdrejkKaMQaTB34vs7B7KG4NF8j2oF7/Io6I3ootAgZ27zWGLpV5VFkwt9oNMaiMFKq6othvAO1v8I+4qo3+GCpHxH9h0oexTy1mloPfsMCSKGBBIkqWLo8sQiBCmQ2eivKpcfxuXkYbdRWGZsBNmn1gB3CM6ipttJIgK5RG3pX9GCpX4aH8kPZFqJ3Lf4/MfrJSC6kF5UmQKwanLclbuOxWW1BlkbY5YEVxXhj4K0rnW6m5lqdcTcit3O02whvrWxa6I3QbFWSsEjyqbIWoAQSr7flZI4EmlLuTDc0=----ATTACHMENT:----Nzg5MzcxMDExOTg1MTU5NyA3NTQ3NzI2ODcwNzUxMzEwIDg1NTY0OTkwMTQ3Njg5Mjk=