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