示例#1
0
    /**
     * Tests the JWeb::compress method.
     *
     * @return  void
     *
     * @since   11.3
     */
    public function testCompressWithUnsupportedEncodings()
    {
        // Fill the header body with a value.
        $this->inspector->setClassProperty('response', (object) array('cachable' => null, 'headers' => null, 'body' => array('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
					eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
					veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
					consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
					dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
					sunt in culpa qui officia deserunt mollit anim id est laborum.')));
        // Load the client encoding with a value.
        $this->inspector->setClassProperty('client', (object) array('encodings' => array('foo', 'bar')));
        $this->inspector->compress();
        // Ensure that the compressed body is the same as the raw body since there is no supported compression.
        $this->assertThat(strlen($this->inspector->getBody()), $this->equalTo(471), 'Checks the compressed output is the same as the uncompressed output -- no supported compression.');
        // Ensure that the compression headers were not set.
        $this->assertThat($this->inspector->getClassProperty('response')->headers, $this->equalTo(null), 'Checks the headers were set correctly.');
    }