sitecrafting / conifer

:evergreen_tree: A powerful WordPress library plugin for OO development
https://www.coniferplug.in
MIT License
18 stars 2 forks source link

Setting directory cascade paths requires a trailing slash #76

Closed sdunham closed 5 years ago

sdunham commented 5 years ago

Expected behavior

Setting custom directory cascade paths should either not require a trailing slash, or an exception should be thrown if an invalid path is submitted. In either case, the documentation should match the required format

Actual behavior

When setting custom directory cascade paths for views/js/css, the provided paths need to include a trailing slash, which doesn't match what's included in the documentation.

Steps to reproduce behavior

// Set a custom js directory path without the trailing slash
$this->set_script_directory_cascade([
    get_template_directory() . '/js',
]);

// Try the get a script URI for a file that exists in /js and throw an exception when it fails
if ($site->get_script_uri('file_that_exists.js') === '') {
    throw new Exception('FOILED AGAIN');
}

What version of WordPress/PHP/Timber/Conifer are you using?

Conifer 0.4

How did you install Conifer? (for example, via git clone, GitHub zip download, Composer/Packagist?)

GitHub zip download

acobster commented 5 years ago

@sdunham I believe this is fixed. Can you confirm?

acobster commented 5 years ago

@sdunham saw your comment about trailingslashit, but I don't really care to add more mocks to the tests just to shave off a few lines of code. Going ahead and closing this.