lithium\tests\cases\net\http\MediaTest::testContentTypeDetection PHP Метод

testContentTypeDetection() публичный Метод

Tests that Media will return the correct type name of recognized, registered content types.
    public function testContentTypeDetection()
    {
        $this->assertNull(Media::type('application/foo'));
        $this->assertEqual('js', Media::type('application/javascript'));
        $this->assertEqual('html', Media::type('*/*'));
        $this->assertEqual('json', Media::type('application/json'));
        $this->assertEqual('json', Media::type('application/json; charset=UTF-8'));
        $result = Media::type('json');
        $expected = array('content' => array('application/json'), 'options' => array('cast' => true, 'encode' => 'json_encode', 'decode' => $result['options']['decode']));
        $this->assertEqual($expected, $result);
    }