Skip to content

Commit

Permalink
Add 'base' property to Namespace Data object
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed May 27, 2014
1 parent 7b9cb8e commit 44aec3e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* @package Imap_Client
* @since 2.21.0
*
* @property-read string $base The namespace base ($name without trailing
* delimiter) (UTF-8).
* @property string $delimiter The namespace delimiter.
* @property boolean $hidden Is this a hidden namespace?
* @property string $name The namespace name (UTF-8).
Expand Down Expand Up @@ -52,6 +54,9 @@ public function __get($name)
}

switch ($name) {
case 'base':
return rtrim($this->name, $this->delimiter);

case 'delimiter':
case 'name':
case 'translation':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,25 @@ public function testStringVal()
);
}

/**
*/
public function testBaseReturn()
{
$this->ob->delimiter = '.';
$this->ob->name = 'foo.';

$this->assertEquals(
'foo',
$this->ob->base
);
}

/**
*/
public function testSerialize()
{
$this->ob->delimiter = '.';
$this->ob->name = 'foo';
$this->ob->name = 'foo.';

$ob2 = unserialize(serialize($this->ob));

Expand All @@ -112,6 +125,7 @@ public function testSerialize()
public function defaultProvider()
{
return array(
array('base', ''),
array('delimiter', ''),
array('hidden', false),
array('name', ''),
Expand Down

0 comments on commit 44aec3e

Please sign in to comment.