/** * 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; }
/** * @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(); }
/** * @depends test_construct * @covers ::createStart */ public function test_createStart() { $Expected = "Content-Type: multipart/mixed; boundary=\"0-00000:=00000\"\r\n"; $this->assertInstanceOf('\\BLW\\Model\\MIME\\ContentType', $this->Section->createStart(), 'Section::createStart() returned an invalid value'); $this->assertEquals($Expected, strval($this->Section->createStart()), 'Section::createStart() returned an invalid value'); }