Skip to content

Commit 9e4d5ff

Browse files
minor symfony#31552 [Ldap] add a test to getResources and binding (Simperfit)
This PR was merged into the 3.4 branch. Discussion ---------- [Ldap] add a test to getResources and binding | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | none <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | <!-- required for new features --> <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/roadmap): - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the master branch. --> We could add more unit tests, but this is a beginning. Commits ------- d08f195 minor: add some test in the ldap component
2 parents e24e7dc + d08f195 commit 9e4d5ff

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/*
3+
* This file is part of the Symfony package.
4+
*
5+
* (c) Fabien Potencier <fabien@symfony.com>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace Symfony\Component\Ldap\Tests\Adapter\ExtLdap;
12+
13+
use PHPUnit\Framework\TestCase;
14+
use Symfony\Component\Ldap\Adapter\ExtLdap\Connection;
15+
use Symfony\Component\Ldap\Adapter\ExtLdap\EntryManager;
16+
use Symfony\Component\Ldap\Entry;
17+
18+
class EntryManagerTest extends TestCase
19+
{
20+
/**
21+
* @expectedException \Symfony\Component\Ldap\Exception\NotBoundException
22+
* @expectedExceptionMessage Query execution is not possible without binding the connection first.
23+
*/
24+
public function testGetResources()
25+
{
26+
$connection = $this->getMockBuilder(Connection::class)->getMock();
27+
$connection
28+
->expects($this->once())
29+
->method('isBound')->willReturn(false);
30+
31+
$entry = new Entry('$$$$$$');
32+
$entryManager = new EntryManager($connection);
33+
$entryManager->update($entry);
34+
}
35+
}

0 commit comments

Comments
 (0)