Hoa central
Related.php
Go to the documentation of this file.
1 <?php
2 
38 
42 use Hoa\Test;
43 
52 class Related extends Test\Unit\Suite
53 {
54  public function case_content_type()
55  {
56  $this
57  ->when($result = new SUT())
58  ->then
59  ->string($result['content-type'])
60  ->isEqualTo('multipart/related');
61  }
62 
64  {
65  $this
66  ->given(
67  $content1 = new CText('foo'),
68  $content2 = new CText('bar'),
69  $alternative = new SUT([$content1, $content2])
70  )
71  ->when($result = count($alternative->getContent()))
72  ->then
73  ->integer($result)
74  ->isEqualTo(2);
75  }
76 
77  public function case_basic()
78  {
79  $this
80  ->given(
81  $this->function->microtime = function () use (&$microtime) {
82  return $microtime = 42;
83  },
84  $related1 = new CHtml('<strong>foo</strong>'),
85  $related2 = new CText('foo'),
86  $related = new SUT([$related1, $related2])
87  )
88  ->when($result = $related->getFormattedContent())
89  ->then
90  ->string($result)
91  ->isEqualTo(
92  'content-type: multipart/related; boundary="__bndry-4200f97b27dcfb5905f0c9c7b680920d"' . CRLF .
93  CRLF .
94 
95  // Related 1.
96  '--__bndry-4200f97b27dcfb5905f0c9c7b680920d' . CRLF .
97  $related1->getFormattedContent() . CRLF .
98 
99  // Related 2.
100  '--__bndry-4200f97b27dcfb5905f0c9c7b680920d' . CRLF .
101  $related2->getFormattedContent() . CRLF .
102 
103  '--__bndry-4200f97b27dcfb5905f0c9c7b680920d' .
104  '--' . CRLF
105  );
106  }
107 }