Skip to content

Include negative and edge cases testing and validation #9

@bizmate

Description

@bizmate

The Web::Url object is relying a lot on parse_url but this is too flexible and does not always yield a valid URL.
As validation is not done for how urls are passed on the result might be unexpected and throw error unrelated to URL such as invalid Scheme as below

$imageUrl = 'notAUrl';
Url::fromNative($imageUrl);

Throws a type error as parse_url output is not tested

TypeError: Argument 1 passed to ValueObjects\Web\SchemeName::__construct() must be of the type string, null given, called in /var/www/html/vendor/ytake/valueobjects/src/Web/Url.php on line 133

/var/www/html/vendor/ytake/valueobjects/src/Web/SchemeName.php:32
/var/www/html/vendor/ytake/valueobjects/src/Web/Url.php:133

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions