This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from SURFnet/34-prevent-false-positives-when-s…
…yncing 34 Prevent groups from being marked for update on every sync by only comparing properties that exist in LDAP and thus can be synced.
- Loading branch information
Showing
9 changed files
with
133 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
namespace Tests\AppBundle\Model; | ||
|
||
|
||
use AppBundle\Model\Group; | ||
use PHPUnit_Framework_TestCase; | ||
|
||
class GroupTest extends PHPUnit_Framework_TestCase | ||
{ | ||
private $defaultMapping = [ | ||
'name' => 'name', | ||
'description' => 'description' | ||
]; | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldNotBeConsideredEqualToGroupWithDifferentCn() | ||
{ | ||
$fooGroup = new Group(1, 'cn=foo,ou=AdHoc,ou=Grouphub,dc=surfuni,dc=org', 'Name', 'Description'); | ||
$barGroup = new Group(1, 'cn=bar,ou=AdHoc,ou=Grouphub,dc=surfuni,dc=org', 'Name', 'Description'); | ||
$this->assertFalse($fooGroup->equals($barGroup, $this->defaultMapping)); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldNotBeConsideredEqualToGroupWithDifferentName() | ||
{ | ||
$fooGroup = new Group(1, 'cn=bar,ou=AdHoc,ou=Grouphub,dc=surfuni,dc=org', 'Name', 'Description'); | ||
$barGroup = new Group(1, 'cn=bar,ou=AdHoc,ou=Grouphub,dc=surfuni,dc=org', 'OtherName', 'Description'); | ||
$this->assertFalse($fooGroup->equals($barGroup, $this->defaultMapping)); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldNotBeConsideredEqualToGroupWithDifferentDescription() | ||
{ | ||
$fooGroup = new Group(1, 'cn=bar,ou=AdHoc,ou=Grouphub,dc=surfuni,dc=org', 'Name', 'Description'); | ||
$barGroup = new Group(1, 'cn=bar,ou=AdHoc,ou=Grouphub,dc=surfuni,dc=org', 'Name', 'OtherDescription'); | ||
$this->assertFalse($fooGroup->equals($barGroup, $this->defaultMapping)); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldBeConsideredEqualToGroupWithDifferentNameWhenNameIsNotMapped() | ||
{ | ||
$fooGroup = new Group(1, 'cn=foo,ou=AdHoc,ou=Grouphub,dc=surfuni,dc=org', 'Name', 'Description'); | ||
$barGroup = new Group(1, 'cn=foo,ou=AdHoc,ou=Grouphub,dc=surfuni,dc=org', 'OtherName', 'Description'); | ||
$this->assertTrue($fooGroup->equals($barGroup, array_merge($this->defaultMapping, ['name' => null]))); | ||
} | ||
/** | ||
* @test | ||
*/ | ||
public function shouldBeConsideredEqualToGroupWithDifferentDescriptionWhenDescriptionIsNotMapped() | ||
{ | ||
$fooGroup = new Group(1, 'cn=foo,ou=AdHoc,ou=Grouphub,dc=surfuni,dc=org', 'Name', 'Description'); | ||
$barGroup = new Group(1, 'cn=foo,ou=AdHoc,ou=Grouphub,dc=surfuni,dc=org', 'Name', 'OtherDescription'); | ||
$this->assertTrue($fooGroup->equals($barGroup, array_merge($this->defaultMapping, ['description' => null]))); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldBeConsideredEqualToGroup() | ||
{ | ||
$fooGroup = new Group(1, 'cn=foo,ou=AdHoc,ou=Grouphub,dc=surfuni,dc=org', 'Name', 'Description'); | ||
$barGroup = new Group(1, 'cn=foo,ou=AdHoc,ou=Grouphub,dc=surfuni,dc=org', 'Name', 'Description'); | ||
$this->assertTrue($fooGroup->equals($barGroup, $this->defaultMapping)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters