Hoa central
Public Member Functions | List of all members
Hoa\Mail\Test\Unit\Content\Attachment Class Reference
Inheritance diagram for Hoa\Mail\Test\Unit\Content\Attachment:

Public Member Functions

 case_basic ()
 
 case_only_stream ()
 
 case_get_stream ()
 
 case_force_name ()
 
 case_force_name_with_quotes_inside ()
 
 case_force_mime_type ()
 
 case_unknown_mime_type ()
 
 case_content_is_base64_encoded ()
 
- Public Member Functions inherited from Hoa\Test\Unit\Suite
 __construct ()
 
 getTestedClassName ()
 
 getTestedClassNamespace ()
 
 beforeTestMethod ($methodName)
 

Detailed Description

Class .

Test suite of the attachment content.

Definition at line 51 of file Attachment.php.

Member Function Documentation

Hoa\Mail\Test\Unit\Content\Attachment::case_basic ( )

Definition at line 53 of file Attachment.php.

54  {
55  $this
56  ->given(
57  $stream = new File\ReadWrite(resolve('hoa://Test/Vfs/Foo.text')),
58  $stream->writeAll('foobar'),
59  $name = 'Hello.txt'
60  )
61  ->when($result = new SUT($stream, $name))
62  ->then
63  ->string($result->getFormattedContent())
64  ->isEqualTo(
65  'content-transfer-encoding: base64' . CRLF .
66  'content-disposition: attachment; filename="Hello.txt"; size=6' . CRLF .
67  'content-type: text/plain' . CRLF .
68  CRLF .
69  'Zm9vYmFy'
70  );
71  }

Here is the call graph for this function:

Hoa\Mail\Test\Unit\Content\Attachment::case_content_is_base64_encoded ( )

Definition at line 162 of file Attachment.php.

163  {
164  $this
165  ->given(
166  $text = 'foobar',
167  $stream = new File\ReadWrite(resolve('hoa://Test/Vfs/Foo.text')),
168  $stream->writeAll($text)
169  )
170  ->when($result = new SUT($stream))
171  ->then
172  ->string($result['content-transfer-encoding'])
173  ->isEqualTo('base64')
174  ->string($result->getFormattedContent(false))
175  ->isEqualTo(base64_encode($text));
176  }

Here is the call graph for this function:

Hoa\Mail\Test\Unit\Content\Attachment::case_force_mime_type ( )

Definition at line 131 of file Attachment.php.

132  {
133  $this
134  ->given(
135  $filename = 'Foo.txt',
136  $stream = new File\ReadWrite(resolve('hoa://Test/Vfs/' . $filename)),
137  $stream->writeAll('<strong>foobar</strong>'),
138  $name = 'Bar.txt',
139  $mimeType = 'text/x-test-plain'
140  )
141  ->when($result = new SUT($stream, $name, $mimeType))
142  ->then
143  ->string($result['content-type'])
144  ->isEqualTo($mimeType)
145  ->string($result['content-disposition'])
146  ->isEqualTo('attachment; filename="' . $name . '"; size=23');
147  }

Here is the call graph for this function:

Hoa\Mail\Test\Unit\Content\Attachment::case_force_name ( )

Definition at line 103 of file Attachment.php.

104  {
105  $this
106  ->given(
107  $filename = 'Foo.txt',
108  $stream = new File\ReadWrite(resolve('hoa://Test/Vfs/' . $filename)),
109  $stream->writeAll('<strong>foobar</strong>'),
110  $name = 'Bar.txt'
111  )
112  ->when($result = new SUT($stream, $name))
113  ->then
114  ->string($result['content-disposition'])
115  ->isEqualTo('attachment; filename="' . $name . '"; size=23');
116  }

Here is the call graph for this function:

Hoa\Mail\Test\Unit\Content\Attachment::case_force_name_with_quotes_inside ( )

Definition at line 118 of file Attachment.php.

119  {
120  $this
121  ->given(
122  $filename = 'Foo.txt',
123  $stream = new File\ReadWrite(resolve('hoa://Test/Vfs/' . $filename))
124  )
125  ->when($result = new SUT($stream, 'B"a"r.txt'))
126  ->then
127  ->string($result['content-disposition'])
128  ->isEqualTo('attachment; filename="B-a-r.txt"; size=0');
129  }
Hoa\Mail\Test\Unit\Content\Attachment::case_get_stream ( )

Definition at line 89 of file Attachment.php.

90  {
91  $this
92  ->given(
93  $filename = 'Foo.txt',
94  $stream = new File\ReadWrite(resolve('hoa://Test/Vfs/' . $filename)),
95  $stream->writeAll('<strong>foobar</strong>')
96  )
97  ->when($result = new SUT($stream))
98  ->then
99  ->object($result->getStream())
100  ->isIdenticalTo($stream);
101  }

Here is the call graph for this function:

Hoa\Mail\Test\Unit\Content\Attachment::case_only_stream ( )

Definition at line 73 of file Attachment.php.

74  {
75  $this
76  ->given(
77  $filename = 'Foo.txt',
78  $stream = new File\ReadWrite(resolve('hoa://Test/Vfs/' . $filename)),
79  $stream->writeAll('<strong>foobar</strong>')
80  )
81  ->when($result = new SUT($stream))
82  ->then
83  ->string($result['content-type'])
84  ->isEqualTo('text/plain')
85  ->string($result['content-disposition'])
86  ->isEqualTo('attachment; filename="' . $filename . '"; size=23');
87  }

Here is the call graph for this function:

Hoa\Mail\Test\Unit\Content\Attachment::case_unknown_mime_type ( )

Definition at line 149 of file Attachment.php.

150  {
151  $this
152  ->given(
153  $stream = new File\ReadWrite(resolve('hoa://Test/Vfs/Foo.hoa-test')),
154  $stream->writeAll('foobar')
155  )
156  ->when($result = new SUT($stream))
157  ->then
158  ->string($result['content-type'])
159  ->isEqualTo('application/octet-stream');
160  }

Here is the call graph for this function:


The documentation for this class was generated from the following file: