Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not save to DB when template is empty #63

Open
faloude opened this issue Nov 11, 2017 · 2 comments
Open

Does not save to DB when template is empty #63

faloude opened this issue Nov 11, 2017 · 2 comments

Comments

@faloude
Copy link

faloude commented Nov 11, 2017

Found out a strange reproducable error.

When the template which is used to render the shortcodable dataobject is empty, the shortcode will not be saved to the DB. When I type a simple 'Foo' in the template file, the bug vanishes.

public static function parse_shortcode($attributes, $content, $parser, $shortcode) {

    if (isset($attributes['id']) && $map = self::get()->byID($attributes['id'])) {
        return $map->customise($data)->renderWith('Map'); // Map.ss cannot be empty
    }
}
@wernerkrauss
Copy link
Contributor

Isn't that a good start to write a unit test that prooves this wrong behaviour?

@faloude
Copy link
Author

faloude commented Nov 12, 2017

I've never written one before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants