add_media_page function not creating submenu

Whenever you would use a class method within add_action function, then within the array parameter, you have to pass an instance of that class as the first value and then you the method name as the second value of the array. In your code, you did not pass any instance actually. And that’s why it did not work.

Try this:

class customFields {

    private function createMenu () {
        add_media_page('Custom Media Options', 'Add Fields to Media',     'manage_options', 'custom_media_options', $this->createMenuOptionsPage());

    }

    private function createMenuOptionsPage () {
        echo 'test';

    }

    public function buildOptions () {
        $this->createMenu();
    }

}  

$customFields = new customFields();
add_action('admin_menu', array($customFields, 'buildOptions'));