1 | <?php |
||
20 | class AgentProfileDocumentSpec extends ObjectBehavior |
||
21 | { |
||
22 | function let() |
||
23 | { |
||
24 | $this->beConstructedWith(new AgentProfile('id', new Agent(InverseFunctionalIdentifier::withMbox('mailto:[email protected]'))), new DocumentData(array( |
||
25 | 'x' => 'foo', |
||
26 | 'y' => 'bar', |
||
27 | ))); |
||
28 | } |
||
29 | |||
30 | function it_is_a_document() |
||
31 | { |
||
32 | $this->shouldHaveType('Xabbuh\XApi\Model\Document'); |
||
33 | } |
||
34 | |||
35 | function its_data_can_be_read() |
||
36 | { |
||
37 | $this->offsetExists('x')->shouldReturn(true); |
||
38 | $this->offsetGet('x')->shouldReturn('foo'); |
||
39 | $this->offsetExists('y')->shouldReturn(true); |
||
40 | $this->offsetGet('y')->shouldReturn('bar'); |
||
41 | $this->offsetExists('z')->shouldReturn(false); |
||
42 | } |
||
43 | |||
44 | function it_throws_exception_when_not_existing_data_is_being_read() |
||
45 | { |
||
46 | $this->shouldThrow('\InvalidArgumentException')->duringOffsetGet('z'); |
||
47 | } |
||
48 | |||
49 | function its_data_cannot_be_manipulated() |
||
50 | { |
||
51 | $this->shouldThrow('\Xabbuh\XApi\Common\Exception\UnsupportedOperationException')->duringOffsetSet('z', 'baz'); |
||
52 | $this->shouldThrow('\Xabbuh\XApi\Common\Exception\UnsupportedOperationException')->duringOffsetUnset('x'); |
||
53 | } |
||
54 | } |
||
55 |