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

[BUG] Inconsistency in Tag::stylesheetLink/javascriptInclude - local links #1486

Closed
niden opened this issue Oct 30, 2013 · 13 comments
Closed
Labels
bug A bug report status: medium Medium

Comments

@niden
Copy link
Member

niden commented Oct 30, 2013

There is a minor inconsistency when creating stylesheet links or javascript includes, depending on how you pass your parameters.

Tag::stylesheetLink('css/phalcon.css')

produces

<link rel="stylesheet" href="css/phalcon.css" type="text/css">

If you use

Tag::stylesheetLink(array('css/phalcon.css'))

it produces

<link rel="stylesheet" href="/css/phalcon.css" type="text/css">

Note the / in the href

@dreamsxin
Copy link
Contributor

The default local value has question.

Tag::stylesheetLink(array('css/phalcon.css', true))

This was referenced Oct 31, 2013
niden added a commit that referenced this issue Oct 31, 2013
niden added a commit that referenced this issue Oct 31, 2013
@niden
Copy link
Member Author

niden commented Nov 1, 2013

@dreamsxin I seem to have a problem still with this one.

This is what I am calling:

Tag::stylesheetLink('css/phalcon.css')

and I get

-'<link rel="stylesheet" href="css/phalcon.css" type="text/css" />
+'<link rel="stylesheet" href="/css/phalcon.css" type="text/css" />

(expected/actual)

The call:

Tag::stylesheetLink(array('css/phalcon.css'))

works just fine.

This also happens when I call javascriptInclude

When you get a chance could you be so kind and look at it?

Thanks!

@niden
Copy link
Member Author

niden commented Nov 1, 2013

I am testing this in 1.2.5

@dreamsxin
Copy link
Contributor

Can you pass the test? I can't find the problem.

phpunit unit-tests/TagTest.php

@niden
Copy link
Member Author

niden commented Nov 1, 2013

Sadly it fails

ndimopoulos@ARGON:~/Applications/niden-cphalcon (Codeception u=) $ phpunit unit-tests/TagTest.php 
PHPUnit 3.7.27 by Sebastian Bergmann.

..F

Time: 463 ms, Memory: 3.00Mb

There was 1 failure:

1) TagTest::testIssue1486
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'<link rel="stylesheet" href="css/phalcon.css" type="text/css" />
+'<link rel="stylesheet" href="/css/phalcon.css" type="text/css" />
 '

/home/ndimopoulos/Applications/niden-cphalcon/unit-tests/TagTest.php:114

FAILURES!
Tests: 3, Assertions: 11, Failures: 1.

Note that the parameters are reversed - the top one is the actual and the bottom the expected

@niden
Copy link
Member Author

niden commented Nov 1, 2013

Hmmm odd. It passes in the phalcon/cphalcon repo but not in my fork....

Let me check this a bit more

@dreamsxin
Copy link
Contributor

Ok, I just in 1.2.5 test pass.

@niden
Copy link
Member Author

niden commented Nov 1, 2013

I had to regenerate the build files - strange.

I now have another issue with the remote:

Tag::stylesheetLink(array('<link rel="stylesheet" href="/css/phalcon.css" type="text/css">'));

produces

-'<link rel="stylesheet" href="http://fonts.googleapis.com/css?family&#x3d;Rosario" type="text/css">
+'<link rel="stylesheet" href="/http://fonts.googleapis.com/css?family&#x3d;Rosario" type="text/css">

using

Tag::stylesheetLink('<link rel="stylesheet" href="/css/phalcon.css" type="text/css">');

works fine

@niden
Copy link
Member Author

niden commented Nov 1, 2013

Same thing with the javascriptInclude.

If you want to see the tests I am running you can clone my fork and check the Codeception branch. You can run the tests using

cd tests
php codecept.phar run tests/unit/

My forked repo is here:

https://github.com/niden/cphalcon.git

@dreamsxin
Copy link
Contributor

OK, Let me try.

@dreamsxin
Copy link
Contributor

$localCssOutput  = '<link rel="stylesheet" '
                         . 'href="css/phalcon.css" type="text/css"';

Should

$localCssOutput  = '<link rel="stylesheet" '
                         . 'href="/css/phalcon.css" type="text/css"';

And this, if param is array, the second parameter is invalid

Tag::javascriptInclude(array($this->remoteJsSource, ), false)

should

Tag::javascriptInclude(array($this->remoteJsSource, false))

@niden
Copy link
Member Author

niden commented Nov 1, 2013

That works.

We need to change the docs a bit to state that if you pass an array then all params should be in the array

Thanks for all the help :)

@niden niden closed this as completed Nov 1, 2013
@dreamsxin
Copy link
Contributor

Not at all. You're welcome.

@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

2 participants