Language: PHP
Label: vulnerable
CWE: CWE-755 \u2014 Improper Handling of Exceptional Conditions
The product does not handle or incorrectly handles an exceptional condition.

Code:
    public function testSaveMedia()
    {
        $picture = array(
            'rel_type' => 'content',
            'rel_id' => 3,
            'title' => 'My new pic',
            'media_type' => 'picture',
            'src' => 'http://lorempixel.com/400/200/',
        );
        $saved_pic_id = save_media($picture);

        $picture_data = get_media_by_id($saved_pic_id);

        $src = $picture_data['filename'];
        $title = $picture_data['title'];

        $this->assertEquals(intval($saved_pic_id) > 0, true);
        $this->assertEquals(is_array($picture_data), true);
        $this->assertEquals($title, 'My new pic');
        $this->assertEquals($src, 'http://lorempixel.com/400/200/');
    }