Started specification skeletons. Everything to be done is now marked as pending.
[pivip.git] / specifications / library / Pivip / Auth / Identity / IdentityPropertySpec.php
bloba883ff87a828a452a7869117e6ab38e135574856
1 <?php
3 require_once 'library/Pivip/Auth/Identity/Property.php';
5 class DescribeIdentityProperty extends PHPSpec_Context
7 public function itShouldProvideAStringValueEvenIfSubpropertiesAreSet()
9 $subProperties = array('fake' => 'Xfce@rocks.org');
10 $property = new Pivip_Auth_Identity_Property('email', $subProperties);
11 $this->spec($property->value)->shouldNot()->beEmpty();
12 $this->spec($property->value)->should()->beString();
15 public function itShouldProvideItsName()
17 $property = new Pivip_Auth_Identity_Property('nickname', 'Vinnl');
18 $this->spec($property->name)->shouldNot()->beEmpty();
19 $this->spec($property->name)->should()->beEqualTo('nickname');
22 public function itShouldLowerCaseThePropertyName()
24 $property = new Pivip_Auth_Identity_Property('NiCKnAMe', 'Vinnl');
25 $this->spec($property->name)->should()->beEqualTo('nickname');
28 public function itShouldLowercaseTheTypeSubProperty()
30 $subProperties = array('type' => 'hOmE', 'value' => '+31234567890');
31 $property = new Pivip_Auth_Identity_Property('tel', $subProperties);
32 $this->spec($property->type)->should()->beString();
33 $this->spec($property->type)->should()->beEqualTo('home');
36 public function itShouldDefaultEmailTypeToInternetWhenValueIsSetExplicitly()
38 $subProperties = array('value' => 'ilove@dut.ch');
39 $property = new Pivip_Auth_Identity_Property('email', $subProperties);
40 $this->spec($property->type)->should()->beEqualTo('internet');
43 public function itShouldDefaultEmailTypeToInternetWhenValueIsSetImplicitly()
45 $property = new Pivip_Auth_Identity_Property('email', 'ilove@dut.ch');
46 $this->spec($property->type)->should()->beEqualTo('internet');
49 public function itShouldReturnAnEmptyStringForNonExistentSubproperties()
51 $property = new Pivip_Auth_Identity_Property('whatever', array());
52 $this->spec($property->watskeburt)->should()->beEmpty();
53 $this->spec($property->watskeburt)->should()->beString();
56 public function itShouldAcceptSubproperties()
58 $subProperties = array('fake' => 'Xfce@rocks.org');
59 $property = new Pivip_Auth_Identity_Property('email', $subProperties);
60 $this->spec($property->fake)->shouldNot()->beEmpty();
61 $this->spec($property->fake)->should()->beString();
64 public function itShouldPublishAllSubproperties()
66 $subProperties = array('type' => 'fake', 'value' => 'Xfce@rocks.org');
67 $property = new Pivip_Auth_Identity_Property('email', $subProperties);
68 $publishedSubProperties = array();
69 foreach($property as $subProperty => $value)
71 $publishedSubProperties[$subProperty] = $value;
73 $this->spec($publishedSubProperties)->should->beEqualTo($subProperties);