Commit f0460d1a authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Débogage et mise en place des tests unitaires.

le service Filter n'est pas encore opérationnel
parent b432b82c
Loading
Loading
Loading
Loading
+2 −1
Changes for composer.json: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -10,7 +10,8 @@
    "require": {
    },
    "require-dev": {
        "phpunit/PHPUnit":                              ">=3.7"
        "phpunit/PHPUnit":                              ">=3.7",
        "zendframework/zend-test":                      ">=2.2"
    },
    "autoload": {
        "psr-0": { 
+0 −8
Changes for config/unicaen-zimbra.local.php.dist: 0 added lines, 8 removed lines.
Original line number Diff line number Diff line
<?php

$settings = array(
);

return array(
   'unicaen-zimbra' => $settings
);
 No newline at end of file
+27 −0
Changes for src/UnicaenZimbra/Entity/Account.php: 27 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -11,4 +11,31 @@ namespace UnicaenZimbra\Entity;

class Account extends Entity
{
    /**
     * Retourne la liste des alias
     * 
     * @return string[]
     */
    public function getAlias()
    {
        if (is_array($this->zimbraMailAlias))
            return $this->zimbraMailAlias;
        elseif(is_string($this->zimbraMailAlias))
            return array($this->zimbraMailAlias);
        else
            return array();
    }

    /**
     * Retourne la liste des changements intervenus
     * Une fois récupérée, la liste des changements est remise à zéro
     *
     * @return array
     */
    public function getConvertedChanges(){
        if (isset($this->changed['zimbraMailAlias'])){
            unset($this->changed['zimbraMailAlias']);
        }
        return parent::getConvertedChanges();
    }
}
 No newline at end of file
+2 −3
Changes for src/UnicaenZimbra/Entity/Entity.php: 2 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -107,8 +107,7 @@ abstract class Entity

    public function __toString()
    {
        if (isset($this->data['name']))
            return $this->data['name'];
        return $this->getName();
    }

    /**
@@ -172,7 +171,7 @@ abstract class Entity
    public function exchangeArray( array $data )
    {
        foreach( $data as $key => $value ){
            $this->data[$key] = $value;
            $this->$key = $value;
        }
    }

+42 −2
Changes for src/UnicaenZimbra/Entity/Folder.php: 42 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -68,14 +68,14 @@ class Folder extends Entity
        foreach( $object->children()->link as $linkXml ){
            $link = new Link;
            $link->populate( $linkXml );
            $this->links[$link->getId] = $link;
            $this->links[$link->getName()] = $link;
        }

        foreach ($object->children()->folder as $data) {
            $child = new self;
            $child->populate($data);
            $child->parent = $this;
            $this->children[$child->getId()] = $child;
            $this->children[$child->getName()] = $child;
        }
    }

@@ -181,4 +181,44 @@ class Folder extends Entity
    {
        $this->__set($name, $value);
    }

    /**
     * Mise à jour des diverses propriétés du dossier depuis le service Folder
     *
     * @param type $newName
     */
    public function __hasBeenRenamed( $newName )
    {
        $moved = 0 === strpos($newName, '/');
        if ($moved){
            $this->name = basename($newName);
            $this->absFolderPath = $newName;
            $this->data['name'] = $this->name;
            $this->parent = null;
        }else{
            $this->name = $newName;
            $this->data['name'] = $this->name;
        }
    }

    /**
     * Met à jour l'objet lorsque un partage a été ajouté
     *
     * @param Grant $grant
     */
    public function __aclGrantAdded( Grant $grant )
    {
        $this->acl[$grant->granteeId] = $grant;
    }

    /**
     * Met à jour l'objet lorsque un partage a été retiré
     *
     * @param string $accountId
     */
    public function __aclGrantRemoved( $accountId )
    {
        unset($this->acl[$accountId]);
    }

}
 No newline at end of file
Loading