Code review comment for lp:~stevanr/linaro-license-protection/phpunit-tests

Revision history for this message
Данило Шеган (danilo) wrote :

Sorry: I missed this (I thought you just mistakenly quoted the entire
email). Can I ask you to cut out everything but the relevant bit when
replying, please?

У уто, 08. 05 2012. у 14:36 +0000, Stevan Radaković пише:
> >
> > "Running checkFile on a symbolic link to an existing file returns true."
> >
> > Which reminds me, what happens if it's run on a symbolic link to a non-
> > existant file?
> >
>
> Very good point. Unfortunately, I'm not sure what was the authors expected behavior for this method (suggestion below), but here's how is_file and is_link work for links and files in PHP.
>
> is_file(file) - TRUE
> is_file(hard_link) - TRUE
> is_file(soft_link) - TRUE
> is_file(broken_soft_link) - FALSE
>
> is_link(file) - FALSE
> is_link(hard_link) - FALSE
> is_link(soft_link) - TRUE
> is_link(broken_soft_link) - TRUE
>
> Some of those are really odd, and in my opinion we should only use the standard is_file function, because it basically serves to identify files and links from directories.

For exactly the reason you are not sure what the "expected behavior for
this method" is, we should document it. Let's add a test which confirms
the current behavior, and it will serve as documentation in the future
as well.

« Back to merge proposal