Skip to content

test to gzgetss function #1479

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

Closed
wants to merge 11 commits into from
Closed

test to gzgetss function #1479

wants to merge 11 commits into from

Conversation

marcosptf
Copy link
Contributor

this is a test to gzgetss();
tests to this function don't exist yet;
Thanks!

:-)

?>
--FILE--
<?php
$handle = gzopen('gzgetss.gz', 'r');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always use absolute paths in PHPT (otherwise the files may not be found):

$handle = gzopen(__DIR__ . '/gzgetss.gz', 'r');

@marcosptf
Copy link
Contributor Author

hi @cmb69 !
how are you? fine?

i really need your help, i think i don't understand what the third argument work ( [, string $allowable_tags ] );

follow the steps that i did:
1)i use the function with the third argument , "'opentag' h1 'closetag'"
$buffer = gzgetss($handle, 4096, "'opentag' h1 'closetag'");

2)the tag 'opentag' h1 'closetag' on gzgetss.test is this:
'opentag' h1 class="title">Description'opentag' /h1 'closetag'
(just have one 'opentag' h1 'closetag' there )

3)i convert the .test file to gz file:
!bash-4.2# gzip -c gzgetss.test > gzgetss.gz

4)i ran the gzgetss.phpt test and the anwser was it:
[root@localhost php]# phpunit gzgetss.phpt
PHPUnit 3.7.34 by Sebastian Bergmann.

F

Time: 438 ms, Memory: 1.75Mb

There was 1 failure:

  1. gzgetss.phpt
    --- Expected
    +++ Actual
    @@ @@

Description

- - string gzgetss - ( resource $zp - , int $length - [, string $allowable_tags - ] ) - - Identical to gzgets(), except that - gzgetss() attempts to strip any HTML and PHP - tags from the text it reads. - - - - Parameters - - - +string gzgetss(resource $zp, int $length [, string $allowable_tags ]); +zp - - - The gz-file pointer. It must be valid, and must point to a file - successfully opened by >gzopen(). - - - +length - - - The length of data to get. - - - +allowable_tags - - - You can use this optional parameter to specify tags which should not - be stripped. - - - - - - - Return Values - - The uncompressed and stripped string, or FALSE on error. - - - - Examples - - - Example #1 gzgetss() example - + +<?php$handle = gzopen()) {   $buffer = gzgetss($handle?>

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

My question is, what i doing wrong?
becouse on the docs php online, dont have any example how to use the third argument, http://php.net/manual/en/function.gzgetss.php .

ill really apreciate your help.
thanks, have a nice day!!!!!

:-)

@cmb69
Copy link
Member

cmb69 commented Aug 21, 2015

gzgetss() basically works like strip_tags() with regard to the $allowable_tags parameter. See the example in the docs, and consider also:

strip_tags('<p>foo <b>bar</b> baz</p>', '<p>'); // => '<p>foo bar baz</p>'

@marcosptf
Copy link
Contributor Author

👍
thanks

@marcosptf
Copy link
Contributor Author

hi @cmb69 , i rewrote the test, i think now is correct!

Thanks
:-)

@php-pulls
Copy link

Comment on behalf of cmb at php.net:

Squashed and applied.

Please try to write more meaningful commit messages next time. :)

@php-pulls php-pulls closed this Aug 23, 2015
@marcosptf
Copy link
Contributor Author

thanks 👍

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

Successfully merging this pull request may close these issues.

3 participants