コード例 #1
0
ファイル: RFC822Test.php プロジェクト: mast3rpee/blw
 /**
  * @depends test_getSection
  * @covers ::addSection
  */
 public function test_addSection()
 {
     $Expected = new Section('multipart/mixed', 'xxx-xxx');
     $this->assertTrue($this->Body->addSection($Expected), 'Body::addSection() should return true');
     $this->assertSame($Expected, $this->Body->getSection(), 'Body::addSection() failed to modify $_Sections');
     $this->assertEquals($this->Section->createBoundary(), $this->Body[count($this->Body) - 3], 'Body::addSection() failed to add a mime boundary');
 }
コード例 #2
0
ファイル: RequestFactory.php プロジェクト: mast3rpee/blw
 /**
  * @ignore
  * @param \BLW\Type\HTTP\IRequest $Request
  * @param array $Fields
  */
 private function _addMultipartFields(IRequest $Request, array $Fields)
 {
     // Section
     $Section = new Section('multipart/form-data');
     // Set Content-Type Header
     $Request->Header['Content-Type'] = $Section->createStart();
     // Add fields
     foreach ($Fields as $Field) {
         $Request->Body[] = $Section->createBoundary();
         $Request->Body[] = $Field;
     }
     // End section
     $Request->Body[] = $Section->createEnd();
 }
コード例 #3
0
ファイル: RFC822.php プロジェクト: mast3rpee/blw
 /**
  * All objects must have a string representation.
  *
  * @return string $this
  */
 public function __toString()
 {
     $return = '';
     // Add headers
     foreach ($this as $v) {
         if ($v instanceof IHeader) {
             $return .= $v;
         }
     }
     // Mime version
     $return .= $this->_Version;
     // Section start
     $return .= $this->_Section->createStart();
     $return .= $this->_CRLF;
     // Done
     return $return;
 }
コード例 #4
0
ファイル: SectionTest.php プロジェクト: mast3rpee/blw
 /**
  * @depends test_construct
  * @covers ::createBoundary
  */
 public function test_createBoundary()
 {
     $Expected = "--0-00000:=00000\r\n";
     $this->assertInstanceOf('\\BLW\\Model\\MIME\\Boundary', $this->Section->createBoundary(), 'Section::createStart() returned an invalid value');
     $this->assertEquals($Expected, strval($this->Section->createBoundary()), 'Section::createStart() returned an invalid value');
 }