Esempio n. 1
0
 /**
  * @dataProvider settingHeadersDataProvider
  */
 public function testOperatingOnHeaders($replace, $headerValues)
 {
     $headersNum = count($headerValues);
     foreach ($headerValues as $value) {
         $this->object->setHeader(self::TEST_HEADER_NAME, $value, $replace);
     }
     $header = $this->object->getHeader(self::TEST_HEADER_NAME);
     if ($replace) {
         $this->assertEquals(1, count($this->object->getHeaders()));
         $this->assertEquals(1, count($header));
         $this->assertEquals(self::TEST_HEADER_VALUE2, $header[0]['value']);
     } else {
         $this->assertEquals($headersNum, count($this->object->getHeaders()));
         $this->assertEquals($headersNum, count($header));
         $i = 0;
         foreach ($headerValues as $value) {
             $this->assertEquals($value, $header[$i]['value']);
             $i++;
         }
     }
     // there is one additional header to be send, content-type
     $headersNum = $replace ? 2 : $headersNum + 1;
     $this->object->expects($this->exactly($headersNum))->method('sendHeader');
     $this->object->sendHeaders();
 }