@@ -74,25 +74,129 @@ public function it_has_requests()
74
74
75
75
public function it_has_sms ()
76
76
{
77
- $ this ->getSmsNumber ()->shouldBe ('87654321 ' );
77
+ $ this ->contactInfo -> getSmsNumber ()-> phone_number ->shouldBe ('87654321 ' );
78
78
}
79
79
80
80
public function it_can_change_sms ()
81
81
{
82
- $ this ->setSmsNumber ('12345678 ' );
83
- $ this ->getSmsNumber ()->shouldBe ('12345678 ' );
82
+ $ this ->contactInfo -> setSmsNumber ('12345678 ' );
83
+ $ this ->contactInfo -> getSmsNumber ()-> phone_number ->shouldBe ('12345678 ' );
84
84
}
85
85
86
86
public function it_can_add_sms ()
87
87
{
88
- $ this ->setSmsNumber ('9999999 ' );
89
- $ this ->getSmsNumber ()->shouldBe ('9999999 ' );
88
+ $ this ->contactInfo -> setSmsNumber ('9999999 ' );
89
+ $ this ->contactInfo -> getSmsNumber ()-> phone_number ->shouldBe ('9999999 ' );
90
90
}
91
91
92
92
public function it_can_remove_sms ()
93
93
{
94
- $ this ->unsetSmsNumber ();
95
- $ this ->getSmsNumber ()->shouldBe (null );
94
+ $ this ->contactInfo -> unsetSmsNumber ();
95
+ $ this ->contactInfo -> getSmsNumber ()->shouldBe (null );
96
96
}
97
97
98
+ public function it_can_add_email ()
99
+ {
100
+ $ this ->
contactInfo ->
addEmail (
'[email protected] ' ,
'work ' ,
true );
101
+ $ this ->
contactInfo ->
getEmail ()->
email_address ->
shouldBe (
'[email protected] ' );
102
+ }
103
+
104
+ public function it_can_unset_email ()
105
+ {
106
+ $ this ->contactInfo ->unsetEmail ();
107
+ $ this ->contactInfo ->getEmail ()->shouldBe (null );
108
+ }
109
+
110
+ public function it_can_remove_email ()
111
+ {
112
+ $ this ->
contactInfo ->
removeEmail (
'[email protected] ' );
113
+ $ this ->contactInfo ->allEmails ()->shouldBe ([]);
114
+ }
115
+
116
+ public function it_can_add_address ()
117
+ {
118
+ $ this ->contactInfo ->addAddress ([
119
+ 'line1 ' => '123 Something Blvd. ' ,
120
+ 'city ' => 'Somewhere ' ,
121
+ 'state_province ' => 'IL ' ,
122
+ 'postal_code ' => '12345 ' ,
123
+ 'country ' => 'USA ' ,
124
+ 'address_type ' => 'home '
125
+ ])->shouldBeAnInstanceOf ('Scriptotek\Alma\Users\Address ' );
126
+ $ this ->contactInfo ->address [1 ]->shouldBeLike ((object ) [
127
+ 'line1 ' => '123 Something Blvd. ' ,
128
+ 'city ' => 'Somewhere ' ,
129
+ 'state_province ' => 'IL ' ,
130
+ 'postal_code ' => '12345 ' ,
131
+ 'country ' => (object ) ['value ' => 'USA ' ],
132
+ 'address_type ' => [(object ) ['value ' => 'home ' ]]
133
+ ]);
134
+ }
135
+
136
+ public function it_can_remove_address ()
137
+ {
138
+ $ address = $ this ->contactInfo ->addresses [0 ];
139
+ $ this ->contactInfo ->removeAddress ($ address );
140
+ $ this ->contactInfo ->addresses ->shouldBe ([]);
141
+ }
142
+
143
+ public function it_can_set_preferred_address ()
144
+ {
145
+ $ address = $ this ->contactInfo ->addresses [0 ];
146
+ $ address ->preferred = true ;
147
+ $ address ->preferred ->shouldBe (true );
148
+ $ address ->preferred = false ;
149
+ $ address ->preferred ->shouldBe (false );
150
+ }
151
+
152
+ public function it_can_unset_preferred_address ()
153
+ {
154
+ $ this ->contactInfo ->unsetPreferredAddress ();
155
+ $ this ->contactInfo ->getPreferredAddress ()->shouldBe (null );
156
+ }
157
+
158
+ public function it_can_set_address_type ()
159
+ {
160
+ $ address = $ this ->contactInfo ->addresses [0 ];
161
+ $ address ->setAddressType ('work ' , 'Work ' );
162
+ $ address ->data ->address_type [0 ]->shouldBeLike ((object )[
163
+ 'value ' => 'work ' ,
164
+ 'desc ' => 'Work '
165
+ ]);
166
+ $ address ->address_type = 'home ' ;
167
+ $ address ->data ->address_type [0 ]->shouldBeLike ((object )[
168
+ 'value ' => 'home '
169
+ ]);
170
+ }
171
+
172
+ public function it_can_add_phone_number ()
173
+ {
174
+ $ this ->contactInfo ->addPhone ('8675309 ' , 'home ' , true );
175
+ $ this ->contactInfo ->getPreferredPhone ()->phone_number ->shouldBe ('8675309 ' );
176
+ }
177
+
178
+ public function it_can_remove_phone_number ()
179
+ {
180
+ $ this ->contactInfo ->removePhone ('12345678 ' );
181
+ $ this ->contactInfo ->getPreferredPhone ()->shouldBe (null );
182
+ }
183
+
184
+ public function it_can_set_preferred_phone ()
185
+ {
186
+ $ this ->contactInfo ->setPreferredPhone ('87654321 ' );
187
+ $ this ->contactInfo ->getPreferredPhone ()->phone_number ->shouldBe ('87654321 ' );
188
+ }
189
+
190
+ public function it_can_unset_preferred_phone ()
191
+ {
192
+ $ this ->contactInfo ->unsetPreferredPhone ();
193
+ $ this ->contactInfo ->getPreferredPhone ()->shouldBe (null );
194
+ }
195
+
196
+ public function it_can_get_all_phone_numbers ()
197
+ {
198
+ $ phones = $ this ->contactInfo ->allPhones ();
199
+ $ phones [0 ]->phone_number ->shouldBe ('12345678 ' );
200
+ $ phones [1 ]->phone_number ->shouldBe ('87654321 ' );
201
+ }
98
202
}
0 commit comments