Пример #1
0
 /**
  * @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
 /**
  * @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
 /**
  * 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
 /**
  * @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');
 }