Skip to content

write tests #9

@simonLeary42

Description

@simonLeary42

some quick pseudocode before I forget:

<?php

use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPOpenLDAPer\LDAPConn;
use PHPOpenLDAPer\LDAPEntry;

class LDAPEntryTest extends TestCase {
    public function testGetAndSetAttributes()
    {
        $attributesBefore = $entry->getAttributes();
        $entry->setAttributes([]);
        $entry->setAttributes($attributesBefore);
        $attributesAfter = $entry->getAttributes();
        $this->assertEquals($attributesBefore, $attributesAfter);
    }

    public function testDelete()
    {
        $this->assertTrue($entry->exists());
        $entry->delete();
        $this->assertFalse($entry->exists());
    }

    public function testDuplicates()
    {
        $entry1 = $this->ldapConn->getEntry($dn);
        $entry2 = $this->ldapConn->getEntry($dn);
        $this->assertSame($entry1, $entry2);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions