@@ -230,11 +230,17 @@ |
||
| 230 | 230 | return $this->getMock('Swift_KeyCache_KeyCacheInputStream'); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | + /** |
|
| 234 | + * @return Swift_OutputByteStream |
|
| 235 | + */ |
|
| 233 | 236 | private function _createOutputStream() |
| 234 | 237 | { |
| 235 | 238 | return $this->getMock('Swift_OutputByteStream'); |
| 236 | 239 | } |
| 237 | 240 | |
| 241 | + /** |
|
| 242 | + * @return Swift_InputByteStream |
|
| 243 | + */ |
|
| 238 | 244 | private function _createInputStream() |
| 239 | 245 | { |
| 240 | 246 | return $this->getMock('Swift_InputByteStream'); |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $os = $this->_createOutputStream(); |
| 90 | 90 | $os->expects($this->at(0)) |
| 91 | - ->method('read') |
|
| 92 | - ->will($this->returnValue('abc')); |
|
| 91 | + ->method('read') |
|
| 92 | + ->will($this->returnValue('abc')); |
|
| 93 | 93 | $os->expects($this->at(1)) |
| 94 | - ->method('read') |
|
| 95 | - ->will($this->returnValue('def')); |
|
| 94 | + ->method('read') |
|
| 95 | + ->will($this->returnValue('def')); |
|
| 96 | 96 | $os->expects($this->at(2)) |
| 97 | - ->method('read') |
|
| 98 | - ->will($this->returnValue(false)); |
|
| 97 | + ->method('read') |
|
| 98 | + ->will($this->returnValue(false)); |
|
| 99 | 99 | |
| 100 | 100 | $is = $this->_createKeyCacheInputStream(); |
| 101 | 101 | $cache = $this->_createCache($is); |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | $os = $this->_createOutputStream(); |
| 149 | 149 | $os->expects($this->at(0)) |
| 150 | - ->method('read') |
|
| 151 | - ->will($this->returnValue('abc')); |
|
| 150 | + ->method('read') |
|
| 151 | + ->will($this->returnValue('abc')); |
|
| 152 | 152 | $os->expects($this->at(1)) |
| 153 | - ->method('read') |
|
| 154 | - ->will($this->returnValue('def')); |
|
| 153 | + ->method('read') |
|
| 154 | + ->will($this->returnValue('def')); |
|
| 155 | 155 | $os->expects($this->at(2)) |
| 156 | - ->method('read') |
|
| 157 | - ->will($this->returnValue(false)); |
|
| 156 | + ->method('read') |
|
| 157 | + ->will($this->returnValue(false)); |
|
| 158 | 158 | |
| 159 | 159 | $is = $this->_createKeyCacheInputStream(true); |
| 160 | 160 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | //See acceptance test for more detail |
| 175 | 175 | $is = $this->_createInputStream(); |
| 176 | 176 | $is->expects($this->atLeastOnce()) |
| 177 | - ->method('write'); |
|
| 177 | + ->method('write'); |
|
| 178 | 178 | |
| 179 | 179 | $kcis = $this->_createKeyCacheInputStream(true); |
| 180 | 180 | |
@@ -1006,6 +1006,9 @@ discard block |
||
| 1006 | 1006 | return $set; |
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | + /** |
|
| 1010 | + * @param string $name |
|
| 1011 | + */ |
|
| 1009 | 1012 | protected function _createHeader($name, $model = null, $params = array(), $stub = true) |
| 1010 | 1013 | { |
| 1011 | 1014 | $header = $this->getMockery('Swift_Mime_ParameterizedHeader')->shouldIgnoreMissing(); |
@@ -1024,6 +1027,9 @@ discard block |
||
| 1024 | 1027 | return $header; |
| 1025 | 1028 | } |
| 1026 | 1029 | |
| 1030 | + /** |
|
| 1031 | + * @param string $data |
|
| 1032 | + */ |
|
| 1027 | 1033 | protected function _createOutputStream($data = null, $stub = true) |
| 1028 | 1034 | { |
| 1029 | 1035 | $os = $this->getMockery('Swift_OutputByteStream'); |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | $headers = $this->_createHeaderSet(array('Content-Type' => $ctype)); |
| 30 | 30 | |
| 31 | 31 | $ctype->shouldReceive('setFieldBodyModel') |
| 32 | - ->once() |
|
| 33 | - ->with('image/jpeg'); |
|
| 32 | + ->once() |
|
| 33 | + ->with('image/jpeg'); |
|
| 34 | 34 | $ctype->shouldReceive('setFieldBodyModel') |
| 35 | - ->zeroOrMoreTimes() |
|
| 36 | - ->with(\Mockery::not('image/jpeg')); |
|
| 35 | + ->zeroOrMoreTimes() |
|
| 36 | + ->with(\Mockery::not('image/jpeg')); |
|
| 37 | 37 | |
| 38 | 38 | $entity = $this->_createEntity($headers, $this->_createEncoder(), |
| 39 | 39 | $this->_createCache() |
@@ -101,10 +101,10 @@ discard block |
||
| 101 | 101 | 'Content-Transfer-Encoding' => $encoding, |
| 102 | 102 | )); |
| 103 | 103 | $encoding->shouldReceive('setFieldBodyModel') |
| 104 | - ->once() |
|
| 105 | - ->with('base64'); |
|
| 104 | + ->once() |
|
| 105 | + ->with('base64'); |
|
| 106 | 106 | $encoding->shouldReceive('setFieldBodyModel') |
| 107 | - ->zeroOrMoreTimes(); |
|
| 107 | + ->zeroOrMoreTimes(); |
|
| 108 | 108 | |
| 109 | 109 | $entity = $this->_createEntity($headers, $this->_createEncoder(), |
| 110 | 110 | $this->_createCache() |
@@ -398,10 +398,10 @@ discard block |
||
| 398 | 398 | $child = $this->_createChild(); |
| 399 | 399 | $cType = $this->_createHeader('Content-Type', 'text/plain', array(), false); |
| 400 | 400 | $cType->shouldReceive('setParameter') |
| 401 | - ->once() |
|
| 402 | - ->with('boundary', \Mockery::any()); |
|
| 401 | + ->once() |
|
| 402 | + ->with('boundary', \Mockery::any()); |
|
| 403 | 403 | $cType->shouldReceive('setParameter') |
| 404 | - ->zeroOrMoreTimes(); |
|
| 404 | + ->zeroOrMoreTimes(); |
|
| 405 | 405 | |
| 406 | 406 | $entity = $this->_createEntity($this->_createHeaderSet(array( |
| 407 | 407 | 'Content-Type' => $cType, |
@@ -420,10 +420,10 @@ discard block |
||
| 420 | 420 | 'Content-Type', 'text/plain', array(), false |
| 421 | 421 | ); |
| 422 | 422 | $cType->shouldReceive('setFieldBodyModel') |
| 423 | - ->once() |
|
| 424 | - ->with('multipart/mixed'); |
|
| 423 | + ->once() |
|
| 424 | + ->with('multipart/mixed'); |
|
| 425 | 425 | $cType->shouldReceive('setFieldBodyModel') |
| 426 | - ->zeroOrMoreTimes(); |
|
| 426 | + ->zeroOrMoreTimes(); |
|
| 427 | 427 | |
| 428 | 428 | $entity = $this->_createEntity($this->_createHeaderSet(array( |
| 429 | 429 | 'Content-Type' => $cType, )), |
@@ -442,10 +442,10 @@ discard block |
||
| 442 | 442 | 'Content-Type', 'text/plain', array(), false |
| 443 | 443 | ); |
| 444 | 444 | $cType->shouldReceive('setFieldBodyModel') |
| 445 | - ->once() |
|
| 446 | - ->with('multipart/alternative'); |
|
| 445 | + ->once() |
|
| 446 | + ->with('multipart/alternative'); |
|
| 447 | 447 | $cType->shouldReceive('setFieldBodyModel') |
| 448 | - ->zeroOrMoreTimes(); |
|
| 448 | + ->zeroOrMoreTimes(); |
|
| 449 | 449 | |
| 450 | 450 | $entity = $this->_createEntity($this->_createHeaderSet(array( |
| 451 | 451 | 'Content-Type' => $cType, )), |
@@ -464,10 +464,10 @@ discard block |
||
| 464 | 464 | 'Content-Type', 'text/plain', array(), false |
| 465 | 465 | ); |
| 466 | 466 | $cType->shouldReceive('setFieldBodyModel') |
| 467 | - ->once() |
|
| 468 | - ->with('multipart/related'); |
|
| 467 | + ->once() |
|
| 468 | + ->with('multipart/related'); |
|
| 469 | 469 | $cType->shouldReceive('setFieldBodyModel') |
| 470 | - ->zeroOrMoreTimes(); |
|
| 470 | + ->zeroOrMoreTimes(); |
|
| 471 | 471 | |
| 472 | 472 | $entity = $this->_createEntity($this->_createHeaderSet(array( |
| 473 | 473 | 'Content-Type' => $cType, )), |
@@ -513,15 +513,15 @@ discard block |
||
| 513 | 513 | 'Content-Type', 'text/plain', array(), false |
| 514 | 514 | ); |
| 515 | 515 | $cType->shouldReceive('setFieldBodyModel') |
| 516 | - ->once() |
|
| 517 | - ->with($combination['type']); |
|
| 516 | + ->once() |
|
| 517 | + ->with($combination['type']); |
|
| 518 | 518 | |
| 519 | 519 | $headerSet = $this->_createHeaderSet(array('Content-Type' => $cType)); |
| 520 | 520 | $headerSet->shouldReceive('newInstance') |
| 521 | - ->zeroOrMoreTimes() |
|
| 522 | - ->andReturnUsing(function () use ($headerSet) { |
|
| 523 | - return $headerSet; |
|
| 524 | - }); |
|
| 521 | + ->zeroOrMoreTimes() |
|
| 522 | + ->andReturnUsing(function () use ($headerSet) { |
|
| 523 | + return $headerSet; |
|
| 524 | + }); |
|
| 525 | 525 | $entity = $this->_createEntity($headerSet, |
| 526 | 526 | $this->_createEncoder(), $this->_createCache() |
| 527 | 527 | ); |
@@ -550,8 +550,8 @@ discard block |
||
| 550 | 550 | ); |
| 551 | 551 | |
| 552 | 552 | $headers->shouldReceive('toString') |
| 553 | - ->zeroOrMoreTimes() |
|
| 554 | - ->andReturn("Content-Type: multipart/alternative; boundary=\"xxx\"\r\n"); |
|
| 553 | + ->zeroOrMoreTimes() |
|
| 554 | + ->andReturn("Content-Type: multipart/alternative; boundary=\"xxx\"\r\n"); |
|
| 555 | 555 | |
| 556 | 556 | $entity = $this->_createEntity($headers, $this->_createEncoder(), |
| 557 | 557 | $this->_createCache() |
@@ -593,14 +593,14 @@ discard block |
||
| 593 | 593 | ); |
| 594 | 594 | |
| 595 | 595 | $headers->shouldReceive('toString') |
| 596 | - ->zeroOrMoreTimes() |
|
| 597 | - ->andReturn("Content-Type: multipart/mixed; boundary=\"xxx\"\r\n"); |
|
| 596 | + ->zeroOrMoreTimes() |
|
| 597 | + ->andReturn("Content-Type: multipart/mixed; boundary=\"xxx\"\r\n"); |
|
| 598 | 598 | $headers->shouldReceive('newInstance') |
| 599 | - ->zeroOrMoreTimes() |
|
| 600 | - ->andReturn($newHeaders); |
|
| 599 | + ->zeroOrMoreTimes() |
|
| 600 | + ->andReturn($newHeaders); |
|
| 601 | 601 | $newHeaders->shouldReceive('toString') |
| 602 | - ->zeroOrMoreTimes() |
|
| 603 | - ->andReturn("Content-Type: multipart/alternative; boundary=\"yyy\"\r\n"); |
|
| 602 | + ->zeroOrMoreTimes() |
|
| 603 | + ->andReturn("Content-Type: multipart/alternative; boundary=\"yyy\"\r\n"); |
|
| 604 | 604 | |
| 605 | 605 | $entity = $this->_createEntity($headers, $this->_createEncoder(), |
| 606 | 606 | $this->_createCache() |
@@ -634,8 +634,8 @@ discard block |
||
| 634 | 634 | $encoder = $this->_createEncoder('base64'); |
| 635 | 635 | |
| 636 | 636 | $child->shouldReceive('encoderChanged') |
| 637 | - ->once() |
|
| 638 | - ->with($encoder); |
|
| 637 | + ->once() |
|
| 638 | + ->with($encoder); |
|
| 639 | 639 | |
| 640 | 640 | $entity = $this->_createEntity($this->_createHeaderSet(), |
| 641 | 641 | $this->_createEncoder(), $this->_createCache() |
@@ -650,8 +650,8 @@ discard block |
||
| 650 | 650 | $encoder = $this->_createEncoder('base64'); |
| 651 | 651 | |
| 652 | 652 | $child->shouldReceive('encoderChanged') |
| 653 | - ->once() |
|
| 654 | - ->with($encoder); |
|
| 653 | + ->once() |
|
| 654 | + ->with($encoder); |
|
| 655 | 655 | |
| 656 | 656 | $entity = $this->_createEntity($this->_createHeaderSet(), |
| 657 | 657 | $this->_createEncoder(), $this->_createCache() |
@@ -664,8 +664,8 @@ discard block |
||
| 664 | 664 | { |
| 665 | 665 | $child = $this->_createChild(0, '', false); |
| 666 | 666 | $child->shouldReceive('charsetChanged') |
| 667 | - ->once() |
|
| 668 | - ->with('windows-874'); |
|
| 667 | + ->once() |
|
| 668 | + ->with('windows-874'); |
|
| 669 | 669 | |
| 670 | 670 | $entity = $this->_createEntity($this->_createHeaderSet(), |
| 671 | 671 | $this->_createEncoder(), $this->_createCache() |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | ); |
| 682 | 682 | $is = $this->_createInputStream(false); |
| 683 | 683 | $is->expects($this->atLeastOnce()) |
| 684 | - ->method('write'); |
|
| 684 | + ->method('write'); |
|
| 685 | 685 | |
| 686 | 686 | $entity->toByteStream($is); |
| 687 | 687 | } |
@@ -693,9 +693,9 @@ discard block |
||
| 693 | 693 | ); |
| 694 | 694 | $is = $this->_createInputStream(false); |
| 695 | 695 | $is->expects($this->atLeastOnce()) |
| 696 | - ->method('write'); |
|
| 696 | + ->method('write'); |
|
| 697 | 697 | $is->expects($this->atLeastOnce()) |
| 698 | - ->method('commit'); |
|
| 698 | + ->method('commit'); |
|
| 699 | 699 | |
| 700 | 700 | $entity->toByteStream($is); |
| 701 | 701 | } |
@@ -746,14 +746,14 @@ discard block |
||
| 746 | 746 | $child = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE); |
| 747 | 747 | |
| 748 | 748 | $cType->shouldReceive('setFieldBodyModel') |
| 749 | - ->twice() |
|
| 750 | - ->with('image/jpeg'); |
|
| 749 | + ->twice() |
|
| 750 | + ->with('image/jpeg'); |
|
| 751 | 751 | $cType->shouldReceive('setFieldBodyModel') |
| 752 | - ->once() |
|
| 753 | - ->with('multipart/alternative'); |
|
| 752 | + ->once() |
|
| 753 | + ->with('multipart/alternative'); |
|
| 754 | 754 | $cType->shouldReceive('setFieldBodyModel') |
| 755 | - ->zeroOrMoreTimes() |
|
| 756 | - ->with(\Mockery::not('multipart/alternative', 'image/jpeg')); |
|
| 755 | + ->zeroOrMoreTimes() |
|
| 756 | + ->with(\Mockery::not('multipart/alternative', 'image/jpeg')); |
|
| 757 | 757 | |
| 758 | 758 | $entity = $this->_createEntity($this->_createHeaderSet(array( |
| 759 | 759 | 'Content-Type' => $cType, |
@@ -775,13 +775,13 @@ discard block |
||
| 775 | 775 | |
| 776 | 776 | $cache = $this->_createCache(false); |
| 777 | 777 | $cache->shouldReceive('hasKey') |
| 778 | - ->once() |
|
| 779 | - ->with(\Mockery::any(), 'body') |
|
| 780 | - ->andReturn(true); |
|
| 778 | + ->once() |
|
| 779 | + ->with(\Mockery::any(), 'body') |
|
| 780 | + ->andReturn(true); |
|
| 781 | 781 | $cache->shouldReceive('getString') |
| 782 | - ->once() |
|
| 783 | - ->with(\Mockery::any(), 'body') |
|
| 784 | - ->andReturn("\r\ncache\r\ncache!"); |
|
| 782 | + ->once() |
|
| 783 | + ->with(\Mockery::any(), 'body') |
|
| 784 | + ->andReturn("\r\ncache\r\ncache!"); |
|
| 785 | 785 | |
| 786 | 786 | $entity = $this->_createEntity($headers, $this->_createEncoder(), |
| 787 | 787 | $cache |
@@ -805,12 +805,12 @@ discard block |
||
| 805 | 805 | |
| 806 | 806 | $cache = $this->_createCache(false); |
| 807 | 807 | $cache->shouldReceive('hasKey') |
| 808 | - ->once() |
|
| 809 | - ->with(\Mockery::any(), 'body') |
|
| 810 | - ->andReturn(false); |
|
| 808 | + ->once() |
|
| 809 | + ->with(\Mockery::any(), 'body') |
|
| 810 | + ->andReturn(false); |
|
| 811 | 811 | $cache->shouldReceive('setString') |
| 812 | - ->once() |
|
| 813 | - ->with(\Mockery::any(), 'body', "\r\nblah\r\nblah!", Swift_KeyCache::MODE_WRITE); |
|
| 812 | + ->once() |
|
| 813 | + ->with(\Mockery::any(), 'body', "\r\nblah\r\nblah!", Swift_KeyCache::MODE_WRITE); |
|
| 814 | 814 | |
| 815 | 815 | $entity = $this->_createEntity($headers, $this->_createEncoder(), |
| 816 | 816 | $cache |
@@ -837,8 +837,8 @@ discard block |
||
| 837 | 837 | |
| 838 | 838 | // We set the expectation at this point because we only care what happens when calling setBody() |
| 839 | 839 | $cache->shouldReceive('clearKey') |
| 840 | - ->once() |
|
| 841 | - ->with(\Mockery::any(), 'body'); |
|
| 840 | + ->once() |
|
| 841 | + ->with(\Mockery::any(), 'body'); |
|
| 842 | 842 | |
| 843 | 843 | $entity->setBody("new\r\nnew!"); |
| 844 | 844 | } |
@@ -860,7 +860,7 @@ discard block |
||
| 860 | 860 | |
| 861 | 861 | // We set the expectation at this point because we only care what happens when calling setBody() |
| 862 | 862 | $cache->shouldReceive('clearKey') |
| 863 | - ->never(); |
|
| 863 | + ->never(); |
|
| 864 | 864 | |
| 865 | 865 | $entity->setBody("blah\r\nblah!"); |
| 866 | 866 | } |
@@ -883,8 +883,8 @@ discard block |
||
| 883 | 883 | |
| 884 | 884 | // We set the expectation at this point because we only care what happens when calling setEncoder() |
| 885 | 885 | $cache->shouldReceive('clearKey') |
| 886 | - ->once() |
|
| 887 | - ->with(\Mockery::any(), 'body'); |
|
| 886 | + ->once() |
|
| 887 | + ->with(\Mockery::any(), 'body'); |
|
| 888 | 888 | |
| 889 | 889 | $entity->setEncoder($otherEncoder); |
| 890 | 890 | } |
@@ -894,12 +894,12 @@ discard block |
||
| 894 | 894 | $is = $this->_createInputStream(); |
| 895 | 895 | $cache = $this->_createCache(false); |
| 896 | 896 | $cache->shouldReceive('hasKey') |
| 897 | - ->once() |
|
| 898 | - ->with(\Mockery::any(), 'body') |
|
| 899 | - ->andReturn(true); |
|
| 897 | + ->once() |
|
| 898 | + ->with(\Mockery::any(), 'body') |
|
| 899 | + ->andReturn(true); |
|
| 900 | 900 | $cache->shouldReceive('exportToByteStream') |
| 901 | - ->once() |
|
| 902 | - ->with(\Mockery::any(), 'body', $is); |
|
| 901 | + ->once() |
|
| 902 | + ->with(\Mockery::any(), 'body', $is); |
|
| 903 | 903 | |
| 904 | 904 | $entity = $this->_createEntity($this->_createHeaderSet(), |
| 905 | 905 | $this->_createEncoder(), $cache |
@@ -914,12 +914,12 @@ discard block |
||
| 914 | 914 | $is = $this->_createInputStream(); |
| 915 | 915 | $cache = $this->_createCache(false); |
| 916 | 916 | $cache->shouldReceive('hasKey') |
| 917 | - ->once() |
|
| 918 | - ->with(\Mockery::any(), 'body') |
|
| 919 | - ->andReturn(false); |
|
| 917 | + ->once() |
|
| 918 | + ->with(\Mockery::any(), 'body') |
|
| 919 | + ->andReturn(false); |
|
| 920 | 920 | $cache->shouldReceive('getInputByteStream') |
| 921 | - ->once() |
|
| 922 | - ->with(\Mockery::any(), 'body'); |
|
| 921 | + ->once() |
|
| 922 | + ->with(\Mockery::any(), 'body'); |
|
| 923 | 923 | |
| 924 | 924 | $entity = $this->_createEntity($this->_createHeaderSet(), |
| 925 | 925 | $this->_createEncoder(), $cache |
@@ -957,12 +957,12 @@ discard block |
||
| 957 | 957 | $child = $this->getMockery('Swift_Mime_MimeEntity')->shouldIgnoreMissing(); |
| 958 | 958 | if (isset($level)) { |
| 959 | 959 | $child->shouldReceive('getNestingLevel') |
| 960 | - ->zeroOrMoreTimes() |
|
| 961 | - ->andReturn($level); |
|
| 960 | + ->zeroOrMoreTimes() |
|
| 961 | + ->andReturn($level); |
|
| 962 | 962 | } |
| 963 | 963 | $child->shouldReceive('toString') |
| 964 | - ->zeroOrMoreTimes() |
|
| 965 | - ->andReturn($string); |
|
| 964 | + ->zeroOrMoreTimes() |
|
| 965 | + ->andReturn($string); |
|
| 966 | 966 | |
| 967 | 967 | return $child; |
| 968 | 968 | } |
@@ -1010,16 +1010,16 @@ discard block |
||
| 1010 | 1010 | { |
| 1011 | 1011 | $header = $this->getMockery('Swift_Mime_ParameterizedHeader')->shouldIgnoreMissing(); |
| 1012 | 1012 | $header->shouldReceive('getFieldName') |
| 1013 | - ->zeroOrMoreTimes() |
|
| 1014 | - ->andReturn($name); |
|
| 1013 | + ->zeroOrMoreTimes() |
|
| 1014 | + ->andReturn($name); |
|
| 1015 | 1015 | $header->shouldReceive('getFieldBodyModel') |
| 1016 | - ->zeroOrMoreTimes() |
|
| 1017 | - ->andReturn($model); |
|
| 1016 | + ->zeroOrMoreTimes() |
|
| 1017 | + ->andReturn($model); |
|
| 1018 | 1018 | $header->shouldReceive('getParameter') |
| 1019 | - ->zeroOrMoreTimes() |
|
| 1020 | - ->andReturnUsing(function ($key) use ($params) { |
|
| 1021 | - return $params[$key]; |
|
| 1022 | - }); |
|
| 1019 | + ->zeroOrMoreTimes() |
|
| 1020 | + ->andReturnUsing(function ($key) use ($params) { |
|
| 1021 | + return $params[$key]; |
|
| 1022 | + }); |
|
| 1023 | 1023 | |
| 1024 | 1024 | return $header; |
| 1025 | 1025 | } |
@@ -1029,19 +1029,19 @@ discard block |
||
| 1029 | 1029 | $os = $this->getMockery('Swift_OutputByteStream'); |
| 1030 | 1030 | if (isset($data)) { |
| 1031 | 1031 | $os->shouldReceive('read') |
| 1032 | - ->zeroOrMoreTimes() |
|
| 1033 | - ->andReturnUsing(function () use ($data) { |
|
| 1034 | - static $first = true; |
|
| 1035 | - if (!$first) { |
|
| 1036 | - return false; |
|
| 1037 | - } |
|
| 1032 | + ->zeroOrMoreTimes() |
|
| 1033 | + ->andReturnUsing(function () use ($data) { |
|
| 1034 | + static $first = true; |
|
| 1035 | + if (!$first) { |
|
| 1036 | + return false; |
|
| 1037 | + } |
|
| 1038 | 1038 | |
| 1039 | - $first = false; |
|
| 1039 | + $first = false; |
|
| 1040 | 1040 | |
| 1041 | - return $data; |
|
| 1042 | - }); |
|
| 1041 | + return $data; |
|
| 1042 | + }); |
|
| 1043 | 1043 | $os->shouldReceive('setReadPointer') |
| 1044 | - ->zeroOrMoreTimes(); |
|
| 1044 | + ->zeroOrMoreTimes(); |
|
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | 1047 | return $os; |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | ->zeroOrMoreTimes(); |
| 427 | 427 | |
| 428 | 428 | $entity = $this->_createEntity($this->_createHeaderSet(array( |
| 429 | - 'Content-Type' => $cType, )), |
|
| 429 | + 'Content-Type' => $cType,)), |
|
| 430 | 430 | $this->_createEncoder(), $this->_createCache() |
| 431 | 431 | ); |
| 432 | 432 | $entity->setChildren(array($child)); |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | ->zeroOrMoreTimes(); |
| 449 | 449 | |
| 450 | 450 | $entity = $this->_createEntity($this->_createHeaderSet(array( |
| 451 | - 'Content-Type' => $cType, )), |
|
| 451 | + 'Content-Type' => $cType,)), |
|
| 452 | 452 | $this->_createEncoder(), $this->_createCache() |
| 453 | 453 | ); |
| 454 | 454 | $entity->setChildren(array($child)); |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | ->zeroOrMoreTimes(); |
| 471 | 471 | |
| 472 | 472 | $entity = $this->_createEntity($this->_createHeaderSet(array( |
| 473 | - 'Content-Type' => $cType, )), |
|
| 473 | + 'Content-Type' => $cType,)), |
|
| 474 | 474 | $this->_createEncoder(), $this->_createCache() |
| 475 | 475 | ); |
| 476 | 476 | $entity->setChildren(array($child)); |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | $headerSet = $this->_createHeaderSet(array('Content-Type' => $cType)); |
| 520 | 520 | $headerSet->shouldReceive('newInstance') |
| 521 | 521 | ->zeroOrMoreTimes() |
| 522 | - ->andReturnUsing(function () use ($headerSet) { |
|
| 522 | + ->andReturnUsing(function() use ($headerSet) { |
|
| 523 | 523 | return $headerSet; |
| 524 | 524 | }); |
| 525 | 525 | $entity = $this->_createEntity($headerSet, |
@@ -975,7 +975,7 @@ discard block |
||
| 975 | 975 | ->will($this->returnValue($name)); |
| 976 | 976 | $encoder->expects($this->any()) |
| 977 | 977 | ->method('encodeString') |
| 978 | - ->will($this->returnCallback(function () { |
|
| 978 | + ->will($this->returnCallback(function() { |
|
| 979 | 979 | $args = func_get_args(); |
| 980 | 980 | |
| 981 | 981 | return array_shift($args); |
@@ -994,12 +994,12 @@ discard block |
||
| 994 | 994 | $set = $this->getMockery('Swift_Mime_HeaderSet')->shouldIgnoreMissing(); |
| 995 | 995 | $set->shouldReceive('get') |
| 996 | 996 | ->zeroOrMoreTimes() |
| 997 | - ->andReturnUsing(function ($key) use ($headers) { |
|
| 997 | + ->andReturnUsing(function($key) use ($headers) { |
|
| 998 | 998 | return $headers[$key]; |
| 999 | 999 | }); |
| 1000 | 1000 | $set->shouldReceive('has') |
| 1001 | 1001 | ->zeroOrMoreTimes() |
| 1002 | - ->andReturnUsing(function ($key) use ($headers) { |
|
| 1002 | + ->andReturnUsing(function($key) use ($headers) { |
|
| 1003 | 1003 | return array_key_exists($key, $headers); |
| 1004 | 1004 | }); |
| 1005 | 1005 | |
@@ -1017,7 +1017,7 @@ discard block |
||
| 1017 | 1017 | ->andReturn($model); |
| 1018 | 1018 | $header->shouldReceive('getParameter') |
| 1019 | 1019 | ->zeroOrMoreTimes() |
| 1020 | - ->andReturnUsing(function ($key) use ($params) { |
|
| 1020 | + ->andReturnUsing(function($key) use ($params) { |
|
| 1021 | 1021 | return $params[$key]; |
| 1022 | 1022 | }); |
| 1023 | 1023 | |
@@ -1030,7 +1030,7 @@ discard block |
||
| 1030 | 1030 | if (isset($data)) { |
| 1031 | 1031 | $os->shouldReceive('read') |
| 1032 | 1032 | ->zeroOrMoreTimes() |
| 1033 | - ->andReturnUsing(function () use ($data) { |
|
| 1033 | + ->andReturnUsing(function() use ($data) { |
|
| 1034 | 1034 | static $first = true; |
| 1035 | 1035 | if (!$first) { |
| 1036 | 1036 | return false; |
@@ -294,6 +294,12 @@ |
||
| 294 | 294 | return new Swift_Mime_Attachment($headers, $encoder, $cache, new Swift_Mime_Grammar(), $mimeTypes); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | + /** |
|
| 298 | + * @param string $path |
|
| 299 | + * @param string $data |
|
| 300 | + * |
|
| 301 | + * @return Swift_FileStream |
|
| 302 | + */ |
|
| 297 | 303 | protected function _createFileStream($path, $data, $stub = true) |
| 298 | 304 | { |
| 299 | 305 | $file = $this->getMockery('Swift_FileStream'); |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | array(), false |
| 79 | 79 | ); |
| 80 | 80 | $cType->shouldReceive('setFieldBodyModel') |
| 81 | - ->once() |
|
| 82 | - ->with('application/octet-stream'); |
|
| 81 | + ->once() |
|
| 82 | + ->with('application/octet-stream'); |
|
| 83 | 83 | $cType->shouldReceive('setFieldBodyModel') |
| 84 | - ->zeroOrMoreTimes(); |
|
| 84 | + ->zeroOrMoreTimes(); |
|
| 85 | 85 | |
| 86 | 86 | $attachment = $this->_createAttachment($this->_createHeaderSet(array( |
| 87 | 87 | 'Content-Type' => $cType, )), |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | array(), false |
| 133 | 133 | ); |
| 134 | 134 | $cType->shouldReceive('setParameter') |
| 135 | - ->once() |
|
| 136 | - ->with('name', 'bar.txt'); |
|
| 135 | + ->once() |
|
| 136 | + ->with('name', 'bar.txt'); |
|
| 137 | 137 | $cType->shouldReceive('setParameter') |
| 138 | - ->zeroOrMoreTimes(); |
|
| 138 | + ->zeroOrMoreTimes(); |
|
| 139 | 139 | |
| 140 | 140 | $attachment = $this->_createAttachment($this->_createHeaderSet(array( |
| 141 | 141 | 'Content-Type' => $cType, )), |
@@ -206,10 +206,10 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | $ctype = $this->_createHeader('Content-Type', 'text/plain', array(), false); |
| 208 | 208 | $ctype->shouldReceive('setFieldBodyModel') |
| 209 | - ->once() |
|
| 210 | - ->with('text/html'); |
|
| 209 | + ->once() |
|
| 210 | + ->with('text/html'); |
|
| 211 | 211 | $ctype->shouldReceive('setFieldBodyModel') |
| 212 | - ->zeroOrMoreTimes(); |
|
| 212 | + ->zeroOrMoreTimes(); |
|
| 213 | 213 | |
| 214 | 214 | $headers = $this->_createHeaderSet(array( |
| 215 | 215 | 'Content-Disposition' => $disposition, |
@@ -234,10 +234,10 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | $ctype = $this->_createHeader('Content-Type', 'text/plain', array(), false); |
| 236 | 236 | $ctype->shouldReceive('setFieldBodyModel') |
| 237 | - ->once() |
|
| 238 | - ->with('application/zip'); |
|
| 237 | + ->once() |
|
| 238 | + ->with('application/zip'); |
|
| 239 | 239 | $ctype->shouldReceive('setFieldBodyModel') |
| 240 | - ->zeroOrMoreTimes(); |
|
| 240 | + ->zeroOrMoreTimes(); |
|
| 241 | 241 | |
| 242 | 242 | $headers = $this->_createHeaderSet(array( |
| 243 | 243 | 'Content-Disposition' => $disposition, |
@@ -298,22 +298,22 @@ discard block |
||
| 298 | 298 | { |
| 299 | 299 | $file = $this->getMockery('Swift_FileStream'); |
| 300 | 300 | $file->shouldReceive('getPath') |
| 301 | - ->zeroOrMoreTimes() |
|
| 302 | - ->andReturn($path); |
|
| 301 | + ->zeroOrMoreTimes() |
|
| 302 | + ->andReturn($path); |
|
| 303 | 303 | $file->shouldReceive('read') |
| 304 | - ->zeroOrMoreTimes() |
|
| 305 | - ->andReturnUsing(function () use ($data) { |
|
| 306 | - static $first = true; |
|
| 307 | - if (!$first) { |
|
| 308 | - return false; |
|
| 309 | - } |
|
| 304 | + ->zeroOrMoreTimes() |
|
| 305 | + ->andReturnUsing(function () use ($data) { |
|
| 306 | + static $first = true; |
|
| 307 | + if (!$first) { |
|
| 308 | + return false; |
|
| 309 | + } |
|
| 310 | 310 | |
| 311 | - $first = false; |
|
| 311 | + $first = false; |
|
| 312 | 312 | |
| 313 | - return $data; |
|
| 314 | - }); |
|
| 313 | + return $data; |
|
| 314 | + }); |
|
| 315 | 315 | $file->shouldReceive('setReadPointer') |
| 316 | - ->zeroOrMoreTimes(); |
|
| 316 | + ->zeroOrMoreTimes(); |
|
| 317 | 317 | |
| 318 | 318 | return $file; |
| 319 | 319 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | $disposition = $this->_createHeader('Content-Disposition', 'attachment'); |
| 21 | 21 | $attachment = $this->_createAttachment($this->_createHeaderSet(array( |
| 22 | - 'Content-Disposition' => $disposition, )), |
|
| 22 | + 'Content-Disposition' => $disposition,)), |
|
| 23 | 23 | $this->_createEncoder(), $this->_createCache() |
| 24 | 24 | ); |
| 25 | 25 | $this->assertEquals('attachment', $attachment->getDisposition()); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | ->zeroOrMoreTimes(); |
| 38 | 38 | |
| 39 | 39 | $attachment = $this->_createAttachment($this->_createHeaderSet(array( |
| 40 | - 'Content-Disposition' => $disposition, )), |
|
| 40 | + 'Content-Disposition' => $disposition,)), |
|
| 41 | 41 | $this->_createEncoder(), $this->_createCache() |
| 42 | 42 | ); |
| 43 | 43 | $attachment->setDisposition('inline'); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | ->zeroOrMoreTimes(); |
| 85 | 85 | |
| 86 | 86 | $attachment = $this->_createAttachment($this->_createHeaderSet(array( |
| 87 | - 'Content-Type' => $cType, )), |
|
| 87 | + 'Content-Type' => $cType,)), |
|
| 88 | 88 | $this->_createEncoder(), $this->_createCache() |
| 89 | 89 | ); |
| 90 | 90 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | array('filename' => 'foo.txt') |
| 99 | 99 | ); |
| 100 | 100 | $attachment = $this->_createAttachment($this->_createHeaderSet(array( |
| 101 | - 'Content-Disposition' => $disposition, )), |
|
| 101 | + 'Content-Disposition' => $disposition,)), |
|
| 102 | 102 | $this->_createEncoder(), $this->_createCache() |
| 103 | 103 | ); |
| 104 | 104 | $this->assertEquals('foo.txt', $attachment->getFilename()); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | ->zeroOrMoreTimes(); |
| 117 | 117 | |
| 118 | 118 | $attachment = $this->_createAttachment($this->_createHeaderSet(array( |
| 119 | - 'Content-Disposition' => $disposition, )), |
|
| 119 | + 'Content-Disposition' => $disposition,)), |
|
| 120 | 120 | $this->_createEncoder(), $this->_createCache() |
| 121 | 121 | ); |
| 122 | 122 | $attachment->setFilename('bar.txt'); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | ->zeroOrMoreTimes(); |
| 139 | 139 | |
| 140 | 140 | $attachment = $this->_createAttachment($this->_createHeaderSet(array( |
| 141 | - 'Content-Type' => $cType, )), |
|
| 141 | + 'Content-Type' => $cType,)), |
|
| 142 | 142 | $this->_createEncoder(), $this->_createCache() |
| 143 | 143 | ); |
| 144 | 144 | $attachment->setFilename('bar.txt'); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | array('size' => 1234) |
| 154 | 154 | ); |
| 155 | 155 | $attachment = $this->_createAttachment($this->_createHeaderSet(array( |
| 156 | - 'Content-Disposition' => $disposition, )), |
|
| 156 | + 'Content-Disposition' => $disposition,)), |
|
| 157 | 157 | $this->_createEncoder(), $this->_createCache() |
| 158 | 158 | ); |
| 159 | 159 | $this->assertEquals(1234, $attachment->getSize()); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | ->zeroOrMoreTimes(); |
| 172 | 172 | |
| 173 | 173 | $attachment = $this->_createAttachment($this->_createHeaderSet(array( |
| 174 | - 'Content-Disposition' => $disposition, )), |
|
| 174 | + 'Content-Disposition' => $disposition,)), |
|
| 175 | 175 | $this->_createEncoder(), $this->_createCache() |
| 176 | 176 | ); |
| 177 | 177 | $attachment->setSize(12345); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | ->with('filename', 'file.ext'); |
| 189 | 189 | |
| 190 | 190 | $attachment = $this->_createAttachment($this->_createHeaderSet(array( |
| 191 | - 'Content-Disposition' => $disposition, )), |
|
| 191 | + 'Content-Disposition' => $disposition,)), |
|
| 192 | 192 | $this->_createEncoder(), $this->_createCache() |
| 193 | 193 | ); |
| 194 | 194 | $attachment->setFile($file); |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | ->andReturn($path); |
| 303 | 303 | $file->shouldReceive('read') |
| 304 | 304 | ->zeroOrMoreTimes() |
| 305 | - ->andReturnUsing(function () use ($data) { |
|
| 305 | + ->andReturnUsing(function() use ($data) { |
|
| 306 | 306 | static $first = true; |
| 307 | 307 | if (!$first) { |
| 308 | 308 | return false; |
@@ -156,6 +156,9 @@ |
||
| 156 | 156 | |
| 157 | 157 | // -- Private helpers |
| 158 | 158 | |
| 159 | + /** |
|
| 160 | + * @param string $name |
|
| 161 | + */ |
|
| 159 | 162 | private function _getEncoder($name, $canonical = false) |
| 160 | 163 | { |
| 161 | 164 | return new Swift_Mime_ContentEncoder_PlainContentEncoder($name, $canonical); |
@@ -31,14 +31,14 @@ discard block |
||
| 31 | 31 | $collection = new Swift_StreamCollector(); |
| 32 | 32 | |
| 33 | 33 | $is->shouldReceive('write') |
| 34 | - ->zeroOrMoreTimes() |
|
| 35 | - ->andReturnUsing($collection); |
|
| 34 | + ->zeroOrMoreTimes() |
|
| 35 | + ->andReturnUsing($collection); |
|
| 36 | 36 | $os->shouldReceive('read') |
| 37 | - ->once() |
|
| 38 | - ->andReturn($byte); |
|
| 37 | + ->once() |
|
| 38 | + ->andReturn($byte); |
|
| 39 | 39 | $os->shouldReceive('read') |
| 40 | - ->zeroOrMoreTimes() |
|
| 41 | - ->andReturn(false); |
|
| 40 | + ->zeroOrMoreTimes() |
|
| 41 | + ->andReturn(false); |
|
| 42 | 42 | |
| 43 | 43 | $encoder->encodeByteStream($os, $is); |
| 44 | 44 | $this->assertIdenticalBinary($byte, $collection->content); |
@@ -72,18 +72,18 @@ discard block |
||
| 72 | 72 | $collection = new Swift_StreamCollector(); |
| 73 | 73 | |
| 74 | 74 | $is->shouldReceive('write') |
| 75 | - ->zeroOrMoreTimes() |
|
| 76 | - ->andReturnUsing($collection); |
|
| 75 | + ->zeroOrMoreTimes() |
|
| 76 | + ->andReturnUsing($collection); |
|
| 77 | 77 | |
| 78 | 78 | for ($i = 0; $i < 50; $i++) { |
| 79 | 79 | $os->shouldReceive('read') |
| 80 | - ->once() |
|
| 81 | - ->andReturn('a '); |
|
| 80 | + ->once() |
|
| 81 | + ->andReturn('a '); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $os->shouldReceive('read') |
| 85 | - ->zeroOrMoreTimes() |
|
| 86 | - ->andReturn(false); |
|
| 85 | + ->zeroOrMoreTimes() |
|
| 86 | + ->andReturn(false); |
|
| 87 | 87 | |
| 88 | 88 | $encoder->encodeByteStream($os, $is, 0, 50); |
| 89 | 89 | $this->assertEquals( |
@@ -135,20 +135,20 @@ discard block |
||
| 135 | 135 | $collection = new Swift_StreamCollector(); |
| 136 | 136 | |
| 137 | 137 | $is->shouldReceive('write') |
| 138 | - ->zeroOrMoreTimes() |
|
| 139 | - ->andReturnUsing($collection); |
|
| 138 | + ->zeroOrMoreTimes() |
|
| 139 | + ->andReturnUsing($collection); |
|
| 140 | 140 | $os->shouldReceive('read') |
| 141 | - ->once() |
|
| 142 | - ->andReturn('a'); |
|
| 141 | + ->once() |
|
| 142 | + ->andReturn('a'); |
|
| 143 | 143 | $os->shouldReceive('read') |
| 144 | - ->once() |
|
| 145 | - ->andReturn($test); |
|
| 144 | + ->once() |
|
| 145 | + ->andReturn($test); |
|
| 146 | 146 | $os->shouldReceive('read') |
| 147 | - ->once() |
|
| 148 | - ->andReturn('b'); |
|
| 147 | + ->once() |
|
| 148 | + ->andReturn('b'); |
|
| 149 | 149 | $os->shouldReceive('read') |
| 150 | - ->zeroOrMoreTimes() |
|
| 151 | - ->andReturn(false); |
|
| 150 | + ->zeroOrMoreTimes() |
|
| 151 | + ->andReturn(false); |
|
| 152 | 152 | |
| 153 | 153 | $encoder->encodeByteStream($os, $is); |
| 154 | 154 | $this->assertEquals($expected, $collection->content); |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | |
| 58 | 58 | $this->assertEquals( |
| 59 | 59 | 'a a a a a a a a a a a a a a a a a a a a a a a a a '."\r\n".//50 * |
| 60 | - 'a a a a a a a a a a a a a a a a a a a a a a a a a', //99 |
|
| 60 | + 'a a a a a a a a a a a a a a a a a a a a a a a a a', //99 |
|
| 61 | 61 | $encoder->encodeString($input, 0, 50), |
| 62 | 62 | '%s: Lines should be wrapped at 50 chars' |
| 63 | 63 | ); |
@@ -474,6 +474,9 @@ |
||
| 474 | 474 | |
| 475 | 475 | // -- Creation Methods |
| 476 | 476 | |
| 477 | + /** |
|
| 478 | + * @return Swift_CharacterStream |
|
| 479 | + */ |
|
| 477 | 480 | private function _createCharacterStream($stub = false) |
| 478 | 481 | { |
| 479 | 482 | return $this->getMockery('Swift_CharacterStream')->shouldIgnoreMissing(); |
@@ -46,19 +46,19 @@ discard block |
||
| 46 | 46 | $collection = new Swift_StreamCollector(); |
| 47 | 47 | |
| 48 | 48 | $is->shouldReceive('write') |
| 49 | - ->zeroOrMoreTimes() |
|
| 50 | - ->andReturnUsing($collection); |
|
| 49 | + ->zeroOrMoreTimes() |
|
| 50 | + ->andReturnUsing($collection); |
|
| 51 | 51 | $charStream->shouldReceive('flushContents') |
| 52 | - ->once(); |
|
| 52 | + ->once(); |
|
| 53 | 53 | $charStream->shouldReceive('importByteStream') |
| 54 | - ->once() |
|
| 55 | - ->with($os); |
|
| 54 | + ->once() |
|
| 55 | + ->with($os); |
|
| 56 | 56 | $charStream->shouldReceive('readBytes') |
| 57 | - ->once() |
|
| 58 | - ->andReturn(array($ordinal)); |
|
| 57 | + ->once() |
|
| 58 | + ->andReturn(array($ordinal)); |
|
| 59 | 59 | $charStream->shouldReceive('readBytes') |
| 60 | - ->zeroOrMoreTimes() |
|
| 61 | - ->andReturn(false); |
|
| 60 | + ->zeroOrMoreTimes() |
|
| 61 | + ->andReturn(false); |
|
| 62 | 62 | |
| 63 | 63 | $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); |
| 64 | 64 | $encoder->encodeByteStream($os, $is); |
@@ -101,34 +101,34 @@ discard block |
||
| 101 | 101 | $collection = new Swift_StreamCollector(); |
| 102 | 102 | |
| 103 | 103 | $is->shouldReceive('write') |
| 104 | - ->zeroOrMoreTimes() |
|
| 105 | - ->andReturnUsing($collection); |
|
| 104 | + ->zeroOrMoreTimes() |
|
| 105 | + ->andReturnUsing($collection); |
|
| 106 | 106 | $charStream->shouldReceive('flushContents') |
| 107 | - ->once(); |
|
| 107 | + ->once(); |
|
| 108 | 108 | $charStream->shouldReceive('importByteStream') |
| 109 | - ->once() |
|
| 110 | - ->with($os); |
|
| 109 | + ->once() |
|
| 110 | + ->with($os); |
|
| 111 | 111 | $charStream->shouldReceive('readBytes') |
| 112 | - ->once() |
|
| 113 | - ->andReturn(array(ord('a'))); |
|
| 112 | + ->once() |
|
| 113 | + ->andReturn(array(ord('a'))); |
|
| 114 | 114 | $charStream->shouldReceive('readBytes') |
| 115 | - ->once() |
|
| 116 | - ->andReturn(array(0x09)); |
|
| 115 | + ->once() |
|
| 116 | + ->andReturn(array(0x09)); |
|
| 117 | 117 | $charStream->shouldReceive('readBytes') |
| 118 | - ->once() |
|
| 119 | - ->andReturn(array(0x09)); |
|
| 118 | + ->once() |
|
| 119 | + ->andReturn(array(0x09)); |
|
| 120 | 120 | $charStream->shouldReceive('readBytes') |
| 121 | - ->once() |
|
| 122 | - ->andReturn(array(0x0D)); |
|
| 121 | + ->once() |
|
| 122 | + ->andReturn(array(0x0D)); |
|
| 123 | 123 | $charStream->shouldReceive('readBytes') |
| 124 | - ->once() |
|
| 125 | - ->andReturn(array(0x0A)); |
|
| 124 | + ->once() |
|
| 125 | + ->andReturn(array(0x0A)); |
|
| 126 | 126 | $charStream->shouldReceive('readBytes') |
| 127 | - ->once() |
|
| 128 | - ->andReturn(array(ord('b'))); |
|
| 127 | + ->once() |
|
| 128 | + ->andReturn(array(ord('b'))); |
|
| 129 | 129 | $charStream->shouldReceive('readBytes') |
| 130 | - ->zeroOrMoreTimes() |
|
| 131 | - ->andReturn(false); |
|
| 130 | + ->zeroOrMoreTimes() |
|
| 131 | + ->andReturn(false); |
|
| 132 | 132 | |
| 133 | 133 | $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); |
| 134 | 134 | $encoder->encodeByteStream($os, $is); |
@@ -142,34 +142,34 @@ discard block |
||
| 142 | 142 | $collection = new Swift_StreamCollector(); |
| 143 | 143 | |
| 144 | 144 | $is->shouldReceive('write') |
| 145 | - ->zeroOrMoreTimes() |
|
| 146 | - ->andReturnUsing($collection); |
|
| 145 | + ->zeroOrMoreTimes() |
|
| 146 | + ->andReturnUsing($collection); |
|
| 147 | 147 | $charStream->shouldReceive('flushContents') |
| 148 | - ->once(); |
|
| 148 | + ->once(); |
|
| 149 | 149 | $charStream->shouldReceive('importByteStream') |
| 150 | - ->once() |
|
| 151 | - ->with($os); |
|
| 150 | + ->once() |
|
| 151 | + ->with($os); |
|
| 152 | 152 | $charStream->shouldReceive('readBytes') |
| 153 | - ->once() |
|
| 154 | - ->andReturn(array(ord('a'))); |
|
| 153 | + ->once() |
|
| 154 | + ->andReturn(array(ord('a'))); |
|
| 155 | 155 | $charStream->shouldReceive('readBytes') |
| 156 | - ->once() |
|
| 157 | - ->andReturn(array(0x20)); |
|
| 156 | + ->once() |
|
| 157 | + ->andReturn(array(0x20)); |
|
| 158 | 158 | $charStream->shouldReceive('readBytes') |
| 159 | - ->once() |
|
| 160 | - ->andReturn(array(0x20)); |
|
| 159 | + ->once() |
|
| 160 | + ->andReturn(array(0x20)); |
|
| 161 | 161 | $charStream->shouldReceive('readBytes') |
| 162 | - ->once() |
|
| 163 | - ->andReturn(array(0x0D)); |
|
| 162 | + ->once() |
|
| 163 | + ->andReturn(array(0x0D)); |
|
| 164 | 164 | $charStream->shouldReceive('readBytes') |
| 165 | - ->once() |
|
| 166 | - ->andReturn(array(0x0A)); |
|
| 165 | + ->once() |
|
| 166 | + ->andReturn(array(0x0A)); |
|
| 167 | 167 | $charStream->shouldReceive('readBytes') |
| 168 | - ->once() |
|
| 169 | - ->andReturn(array(ord('b'))); |
|
| 168 | + ->once() |
|
| 169 | + ->andReturn(array(ord('b'))); |
|
| 170 | 170 | $charStream->shouldReceive('readBytes') |
| 171 | - ->zeroOrMoreTimes() |
|
| 172 | - ->andReturn(false); |
|
| 171 | + ->zeroOrMoreTimes() |
|
| 172 | + ->andReturn(false); |
|
| 173 | 173 | |
| 174 | 174 | $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); |
| 175 | 175 | $encoder->encodeByteStream($os, $is); |
@@ -212,43 +212,43 @@ discard block |
||
| 212 | 212 | $collection = new Swift_StreamCollector(); |
| 213 | 213 | |
| 214 | 214 | $is->shouldReceive('write') |
| 215 | - ->zeroOrMoreTimes() |
|
| 216 | - ->andReturnUsing($collection); |
|
| 215 | + ->zeroOrMoreTimes() |
|
| 216 | + ->andReturnUsing($collection); |
|
| 217 | 217 | $charStream->shouldReceive('flushContents') |
| 218 | - ->once(); |
|
| 218 | + ->once(); |
|
| 219 | 219 | $charStream->shouldReceive('importByteStream') |
| 220 | - ->once() |
|
| 221 | - ->with($os); |
|
| 220 | + ->once() |
|
| 221 | + ->with($os); |
|
| 222 | 222 | $charStream->shouldReceive('readBytes') |
| 223 | - ->once() |
|
| 224 | - ->andReturn(array(ord('a'))); |
|
| 223 | + ->once() |
|
| 224 | + ->andReturn(array(ord('a'))); |
|
| 225 | 225 | $charStream->shouldReceive('readBytes') |
| 226 | - ->once() |
|
| 227 | - ->andReturn(array(0x0D)); |
|
| 226 | + ->once() |
|
| 227 | + ->andReturn(array(0x0D)); |
|
| 228 | 228 | $charStream->shouldReceive('readBytes') |
| 229 | - ->once() |
|
| 230 | - ->andReturn(array(0x0A)); |
|
| 229 | + ->once() |
|
| 230 | + ->andReturn(array(0x0A)); |
|
| 231 | 231 | $charStream->shouldReceive('readBytes') |
| 232 | - ->once() |
|
| 233 | - ->andReturn(array(ord('b'))); |
|
| 232 | + ->once() |
|
| 233 | + ->andReturn(array(ord('b'))); |
|
| 234 | 234 | $charStream->shouldReceive('readBytes') |
| 235 | - ->once() |
|
| 236 | - ->andReturn(array(0x0D)); |
|
| 235 | + ->once() |
|
| 236 | + ->andReturn(array(0x0D)); |
|
| 237 | 237 | $charStream->shouldReceive('readBytes') |
| 238 | - ->once() |
|
| 239 | - ->andReturn(array(0x0A)); |
|
| 238 | + ->once() |
|
| 239 | + ->andReturn(array(0x0A)); |
|
| 240 | 240 | $charStream->shouldReceive('readBytes') |
| 241 | - ->once() |
|
| 242 | - ->andReturn(array(ord('c'))); |
|
| 241 | + ->once() |
|
| 242 | + ->andReturn(array(ord('c'))); |
|
| 243 | 243 | $charStream->shouldReceive('readBytes') |
| 244 | - ->once() |
|
| 245 | - ->andReturn(array(0x0D)); |
|
| 244 | + ->once() |
|
| 245 | + ->andReturn(array(0x0D)); |
|
| 246 | 246 | $charStream->shouldReceive('readBytes') |
| 247 | - ->once() |
|
| 248 | - ->andReturn(array(0x0A)); |
|
| 247 | + ->once() |
|
| 248 | + ->andReturn(array(0x0A)); |
|
| 249 | 249 | $charStream->shouldReceive('readBytes') |
| 250 | - ->zeroOrMoreTimes() |
|
| 251 | - ->andReturn(false); |
|
| 250 | + ->zeroOrMoreTimes() |
|
| 251 | + ->andReturn(false); |
|
| 252 | 252 | |
| 253 | 253 | $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); |
| 254 | 254 | $encoder->encodeByteStream($os, $is); |
@@ -273,22 +273,22 @@ discard block |
||
| 273 | 273 | $collection = new Swift_StreamCollector(); |
| 274 | 274 | |
| 275 | 275 | $is->shouldReceive('write') |
| 276 | - ->zeroOrMoreTimes() |
|
| 277 | - ->andReturnUsing($collection); |
|
| 276 | + ->zeroOrMoreTimes() |
|
| 277 | + ->andReturnUsing($collection); |
|
| 278 | 278 | $charStream->shouldReceive('flushContents') |
| 279 | - ->once(); |
|
| 279 | + ->once(); |
|
| 280 | 280 | $charStream->shouldReceive('importByteStream') |
| 281 | - ->once() |
|
| 282 | - ->with($os); |
|
| 281 | + ->once() |
|
| 282 | + ->with($os); |
|
| 283 | 283 | |
| 284 | 284 | for ($seq = 0; $seq <= 140; ++$seq) { |
| 285 | 285 | $charStream->shouldReceive('readBytes') |
| 286 | - ->once() |
|
| 287 | - ->andReturn(array(ord('a'))); |
|
| 286 | + ->once() |
|
| 287 | + ->andReturn(array(ord('a'))); |
|
| 288 | 288 | } |
| 289 | 289 | $charStream->shouldReceive('readBytes') |
| 290 | - ->zeroOrMoreTimes() |
|
| 291 | - ->andReturn(false); |
|
| 290 | + ->zeroOrMoreTimes() |
|
| 291 | + ->andReturn(false); |
|
| 292 | 292 | |
| 293 | 293 | $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); |
| 294 | 294 | $encoder->encodeByteStream($os, $is); |
@@ -303,22 +303,22 @@ discard block |
||
| 303 | 303 | $collection = new Swift_StreamCollector(); |
| 304 | 304 | |
| 305 | 305 | $is->shouldReceive('write') |
| 306 | - ->zeroOrMoreTimes() |
|
| 307 | - ->andReturnUsing($collection); |
|
| 306 | + ->zeroOrMoreTimes() |
|
| 307 | + ->andReturnUsing($collection); |
|
| 308 | 308 | $charStream->shouldReceive('flushContents') |
| 309 | - ->once(); |
|
| 309 | + ->once(); |
|
| 310 | 310 | $charStream->shouldReceive('importByteStream') |
| 311 | - ->once() |
|
| 312 | - ->with($os); |
|
| 311 | + ->once() |
|
| 312 | + ->with($os); |
|
| 313 | 313 | |
| 314 | 314 | for ($seq = 0; $seq <= 100; ++$seq) { |
| 315 | 315 | $charStream->shouldReceive('readBytes') |
| 316 | - ->once() |
|
| 317 | - ->andReturn(array(ord('a'))); |
|
| 316 | + ->once() |
|
| 317 | + ->andReturn(array(ord('a'))); |
|
| 318 | 318 | } |
| 319 | 319 | $charStream->shouldReceive('readBytes') |
| 320 | - ->zeroOrMoreTimes() |
|
| 321 | - ->andReturn(false); |
|
| 320 | + ->zeroOrMoreTimes() |
|
| 321 | + ->andReturn(false); |
|
| 322 | 322 | |
| 323 | 323 | $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); |
| 324 | 324 | $encoder->encodeByteStream($os, $is, 0, 54); |
@@ -340,19 +340,19 @@ discard block |
||
| 340 | 340 | $collection = new Swift_StreamCollector(); |
| 341 | 341 | |
| 342 | 342 | $is->shouldReceive('write') |
| 343 | - ->zeroOrMoreTimes() |
|
| 344 | - ->andReturnUsing($collection); |
|
| 343 | + ->zeroOrMoreTimes() |
|
| 344 | + ->andReturnUsing($collection); |
|
| 345 | 345 | $charStream->shouldReceive('flushContents') |
| 346 | - ->once(); |
|
| 346 | + ->once(); |
|
| 347 | 347 | $charStream->shouldReceive('importByteStream') |
| 348 | - ->once() |
|
| 349 | - ->with($os); |
|
| 348 | + ->once() |
|
| 349 | + ->with($os); |
|
| 350 | 350 | $charStream->shouldReceive('readBytes') |
| 351 | - ->once() |
|
| 352 | - ->andReturn(array($ordinal)); |
|
| 351 | + ->once() |
|
| 352 | + ->andReturn(array($ordinal)); |
|
| 353 | 353 | $charStream->shouldReceive('readBytes') |
| 354 | - ->zeroOrMoreTimes() |
|
| 355 | - ->andReturn(false); |
|
| 354 | + ->zeroOrMoreTimes() |
|
| 355 | + ->andReturn(false); |
|
| 356 | 356 | |
| 357 | 357 | $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); |
| 358 | 358 | $encoder->encodeByteStream($os, $is); |
@@ -374,19 +374,19 @@ discard block |
||
| 374 | 374 | $collection = new Swift_StreamCollector(); |
| 375 | 375 | |
| 376 | 376 | $is->shouldReceive('write') |
| 377 | - ->zeroOrMoreTimes() |
|
| 378 | - ->andReturnUsing($collection); |
|
| 377 | + ->zeroOrMoreTimes() |
|
| 378 | + ->andReturnUsing($collection); |
|
| 379 | 379 | $charStream->shouldReceive('flushContents') |
| 380 | - ->once(); |
|
| 380 | + ->once(); |
|
| 381 | 381 | $charStream->shouldReceive('importByteStream') |
| 382 | - ->once() |
|
| 383 | - ->with($os); |
|
| 382 | + ->once() |
|
| 383 | + ->with($os); |
|
| 384 | 384 | $charStream->shouldReceive('readBytes') |
| 385 | - ->once() |
|
| 386 | - ->andReturn(array(61)); |
|
| 385 | + ->once() |
|
| 386 | + ->andReturn(array(61)); |
|
| 387 | 387 | $charStream->shouldReceive('readBytes') |
| 388 | - ->zeroOrMoreTimes() |
|
| 389 | - ->andReturn(false); |
|
| 388 | + ->zeroOrMoreTimes() |
|
| 389 | + ->andReturn(false); |
|
| 390 | 390 | |
| 391 | 391 | $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); |
| 392 | 392 | $encoder->encodeByteStream($os, $is); |
@@ -408,19 +408,19 @@ discard block |
||
| 408 | 408 | $collection = new Swift_StreamCollector(); |
| 409 | 409 | |
| 410 | 410 | $is->shouldReceive('write') |
| 411 | - ->zeroOrMoreTimes() |
|
| 412 | - ->andReturnUsing($collection); |
|
| 411 | + ->zeroOrMoreTimes() |
|
| 412 | + ->andReturnUsing($collection); |
|
| 413 | 413 | $charStream->shouldReceive('flushContents') |
| 414 | - ->once(); |
|
| 414 | + ->once(); |
|
| 415 | 415 | $charStream->shouldReceive('importByteStream') |
| 416 | - ->once() |
|
| 417 | - ->with($os); |
|
| 416 | + ->once() |
|
| 417 | + ->with($os); |
|
| 418 | 418 | $charStream->shouldReceive('readBytes') |
| 419 | - ->once() |
|
| 420 | - ->andReturn(array($ordinal)); |
|
| 419 | + ->once() |
|
| 420 | + ->andReturn(array($ordinal)); |
|
| 421 | 421 | $charStream->shouldReceive('readBytes') |
| 422 | - ->zeroOrMoreTimes() |
|
| 423 | - ->andReturn(false); |
|
| 422 | + ->zeroOrMoreTimes() |
|
| 423 | + ->andReturn(false); |
|
| 424 | 424 | |
| 425 | 425 | $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); |
| 426 | 426 | $encoder->encodeByteStream($os, $is); |
@@ -436,8 +436,8 @@ discard block |
||
| 436 | 436 | $collection = new Swift_StreamCollector(); |
| 437 | 437 | |
| 438 | 438 | $is->shouldReceive('write') |
| 439 | - ->zeroOrMoreTimes() |
|
| 440 | - ->andReturnUsing($collection); |
|
| 439 | + ->zeroOrMoreTimes() |
|
| 440 | + ->andReturnUsing($collection); |
|
| 441 | 441 | $charStream->shouldReceive('flushContents') |
| 442 | 442 | ->once(); |
| 443 | 443 | $charStream->shouldReceive('importByteStream') |
@@ -446,8 +446,8 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | for ($seq = 0; $seq <= 140; ++$seq) { |
| 448 | 448 | $charStream->shouldReceive('readBytes') |
| 449 | - ->once() |
|
| 450 | - ->andReturn(array(ord('a'))); |
|
| 449 | + ->once() |
|
| 450 | + ->andReturn(array(ord('a'))); |
|
| 451 | 451 | } |
| 452 | 452 | $charStream->shouldReceive('readBytes') |
| 453 | 453 | ->zeroOrMoreTimes() |
@@ -465,8 +465,8 @@ discard block |
||
| 465 | 465 | { |
| 466 | 466 | $stream = $this->_createCharacterStream(); |
| 467 | 467 | $stream->shouldReceive('setCharacterSet') |
| 468 | - ->once() |
|
| 469 | - ->with('windows-1252'); |
|
| 468 | + ->once() |
|
| 469 | + ->with('windows-1252'); |
|
| 470 | 470 | |
| 471 | 471 | $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($stream); |
| 472 | 472 | $encoder->charsetChanged('windows-1252'); |
@@ -182,6 +182,9 @@ |
||
| 182 | 182 | $this->assertEquals('References: <a@b> <x@y>'."\r\n", $header->toString()); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | + /** |
|
| 186 | + * @param string $name |
|
| 187 | + */ |
|
| 185 | 188 | private function _getHeader($name) |
| 186 | 189 | { |
| 187 | 190 | return new Swift_Mime_Headers_IdentificationHeader($name, new Swift_Mime_Grammar()); |
@@ -307,6 +307,9 @@ discard block |
||
| 307 | 307 | ); |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | + /** |
|
| 311 | + * @param string $name |
|
| 312 | + */ |
|
| 310 | 313 | private function _getHeader($name, $encoder) |
| 311 | 314 | { |
| 312 | 315 | $header = new Swift_Mime_Headers_MailboxHeader($name, $encoder, new Swift_Mime_Grammar()); |
@@ -315,6 +318,9 @@ discard block |
||
| 315 | 318 | return $header; |
| 316 | 319 | } |
| 317 | 320 | |
| 321 | + /** |
|
| 322 | + * @param string $type |
|
| 323 | + */ |
|
| 318 | 324 | private function _getEncoder($type, $stub = false) |
| 319 | 325 | { |
| 320 | 326 | $encoder = $this->getMockery('Swift_Mime_HeaderEncoder')->shouldIgnoreMissing(); |
@@ -168,7 +168,7 @@ |
||
| 168 | 168 | )); |
| 169 | 169 | $this->assertEquals( |
| 170 | 170 | array('[email protected]' => 'Chris Corbyn', |
| 171 | - '[email protected]' => 'Mark Corbyn', ), |
|
| 171 | + '[email protected]' => 'Mark Corbyn',), |
|
| 172 | 172 | $header->getNameAddresses() |
| 173 | 173 | ); |
| 174 | 174 | $this->assertEquals( |
@@ -373,6 +373,9 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | // -- Private helper |
| 375 | 375 | |
| 376 | + /** |
|
| 377 | + * @param string $name |
|
| 378 | + */ |
|
| 376 | 379 | private function _getHeader($name, $encoder, $paramEncoder) |
| 377 | 380 | { |
| 378 | 381 | $header = new Swift_Mime_Headers_ParameterizedHeader($name, $encoder, |
@@ -383,6 +386,9 @@ discard block |
||
| 383 | 386 | return $header; |
| 384 | 387 | } |
| 385 | 388 | |
| 389 | + /** |
|
| 390 | + * @param string $type |
|
| 391 | + */ |
|
| 386 | 392 | private function _getHeaderEncoder($type, $stub = false) |
| 387 | 393 | { |
| 388 | 394 | $encoder = $this->getMockery('Swift_Mime_HeaderEncoder')->shouldIgnoreMissing(); |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | $paramEncoder = $this->_getParameterEncoder(); |
| 262 | 262 | $paramEncoder->shouldReceive('encodeString') |
| 263 | - ->once() |
|
| 264 | - ->with($value, \Mockery::any(), \Mockery::any(), \Mockery::any()) |
|
| 265 | - ->andReturn('fo%8Fbar'); |
|
| 263 | + ->once() |
|
| 264 | + ->with($value, \Mockery::any(), \Mockery::any(), \Mockery::any()) |
|
| 265 | + ->andReturn('fo%8Fbar'); |
|
| 266 | 266 | |
| 267 | 267 | $header = $this->_getHeader('X-Foo', $encoder, $paramEncoder); |
| 268 | 268 | $header->setValue($value); |
@@ -319,9 +319,9 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | $paramEncoder = $this->_getParameterEncoder(); |
| 321 | 321 | $paramEncoder->shouldReceive('encodeString') |
| 322 | - ->once() |
|
| 323 | - ->with($value, \Mockery::any(), \Mockery::any(), \Mockery::any()) |
|
| 324 | - ->andReturn('fo%8Fbar'); |
|
| 322 | + ->once() |
|
| 323 | + ->with($value, \Mockery::any(), \Mockery::any(), \Mockery::any()) |
|
| 324 | + ->andReturn('fo%8Fbar'); |
|
| 325 | 325 | |
| 326 | 326 | $header = $this->_getHeader('X-Foo', $encoder, $paramEncoder); |
| 327 | 327 | $header->setLanguage('en'); |
@@ -70,6 +70,9 @@ |
||
| 70 | 70 | ); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | + /** |
|
| 74 | + * @param string $name |
|
| 75 | + */ |
|
| 73 | 76 | private function _getHeader($name) |
| 74 | 77 | { |
| 75 | 78 | return new Swift_Mime_Headers_PathHeader($name, new Swift_Mime_Grammar()); |