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 testDeleteMedia()
    {
        $picture = array(
            'rel_type' => 'content',
            'rel_id' => 3,
            'title' => 'My new pic to del',
            'media_type' => 'picture',
            'src' => 'http://lorempixel.com/400/200/',
        );
        $saved_pic_id = save_media($picture);
        $picture_data = get_media_by_id($saved_pic_id);
        $to_delete = array('id' => $saved_pic_id);
        $delete = delete_media($to_delete);
        $title = $picture_data['title'];
        $picture_null = get_media_by_id($saved_pic_id);

        $this->assertEquals($picture_null, false);
        $this->assertEquals(is_array($picture_data), true);
        $this->assertEquals($title, 'My new pic to del');
        $this->assertEquals(!($delete), false);
    }