Skip to content

Commit b782c51

Browse files
committed
Add test
1 parent 0c8f882 commit b782c51

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/Unit/Models/ModelTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,28 @@ public function test_generated_dns_properly_substitute_base_on_creation()
783783
$this->assertEquals('cn=foo,dc=local,dc=com', $model->getDn());
784784
}
785785

786+
public function test_attribute_values_are_numerically_indexed_on_create()
787+
{
788+
Container::addConnection(new Connection([
789+
'base_dn' => 'dc=local,dc=com',
790+
]));
791+
792+
DirectoryFake::setup()->getLdapConnection()->expect(
793+
LdapFake::operation('add')->once()->with(fn ($dn) => true, fn ($attributes) => (
794+
collect($attributes)->every(fn ($values) => array_is_list($values))
795+
))->andReturnTrue(),
796+
);
797+
798+
$model = new Entry;
799+
800+
$model->objectclass = ['bar'];
801+
$model->cn = ['invalid' => 'John Doe'];
802+
803+
$model->save();
804+
805+
$this->assertEquals($model->cn, ['John Doe']);
806+
}
807+
786808
public function test_setting_dn_attributes_set_distinguished_name_on_model()
787809
{
788810
$this->assertEquals('foo', (new Entry(['distinguishedname' => 'foo']))->getDn());

0 commit comments

Comments
 (0)