logs archiveIRC Archive / Freenode / #php / 2015 / October / 5 / 1
lenswipe
im trying to assert that the exception is thrown under those conditions
sorabji
then yeah
lenswipe
just mock the function?
sorabji
function/functions
lenswipe
right, so if I define the function in my test...
sorabji
there's no need to test that json_encode will barf on deep desting
lenswipe
json_decode*
no, but i need to test that when it does barf, my code catches the error and throws an exception
sorabji
right
so you call a mocked function that will barf on command
lenswipe
how do i mock the function?
i mean, i know i just define it in the namespace....but still
         

sorabji
define it in the namespace it'll be called from
alternatively, the class that uses it can isolate it in a function
that'd be easier to mock
Syngress
Hi there, is it posiible to breake string between those long white space in PHP ? http://pastebin.com/ssVpkX60
lenswipe
can i define it in my test JUST before my method gets called?
sorabji
method*
_xXTaha_ProXx_
i tried getting the PHP YAML dll files, and made extentions, the YAML.dll file works, but PHP_YAML.dll doesn't work, it gives me that there is a problem, i've added all the extensions. Help Please if i can right here.
sorabji
lenswipe: nah, it'd have to be at the top of the file
and it'll hold for the rest of that file.
i'd probably use the class approach
lenswipe
sh*t.
sorabji
what's your parser class look like?
lenswipe
no, but i need to test that when it does
oops
https://gist.github.com/fa2e434b7b9f69edc103
it looks like that
xyphoid
man, a PDF generator inhouse app i worked on just reached 12
one more year and it's a teenager
NoiseEee
nice xyphoid
sorabji
lenswipe: right. so isolate json_decode and json_last_error in their own methods that you can mock
lenswipe
and then accept them as arguments to my decode function?
xyphoid
if it was on the internet it'd have been owned so bad by now, but it just keeps ticking
lenswipe
actually, they could just be public static methods - couldn't they?
Syngress
Is it posiible to breake string between long white space's in PHP ? http://pastebin.com/ssVpkX60
sorabji
lenswipe: there's a lot of ways to tackle it. i'd go instance methods or a separate adapter class
lenswipe
the is an adapter class in itself - dont really want another adapter adapter
Bad_Advice_Cat
Syngress, where precisely did you get this data from?
lenswipe
should they be public?
brb/...dinner
         

stercor
Syngress: If I understand your question correctly, strtok might do it.
Syngress
Bad_Advice_Cat: what do you mean -> is it matter ? i have string like XXXXX XXXXXX XXXXXX and i need to put <br /> between this empty space
bugoff
NoiseEee: Its site says "3.1.3 (2014-10-28)" for last update. :/
larsi
lol
bugoff
That's almost a year ago.
NoiseEee
bugoff: it is the definitive industry standard
Bad_Advice_Cat
Syngress, context matters :3
stercor
Syngress: strtok, then. You can specify the characters to skip, ' ', \n, \t, usw.
_xXTaha_ProXx_
why are some of you being Off-Topic?
w
oops.
Syngress
stercor: give me sec, i try - thanks
stercor
Syngress: every time it hits a character NOT in the string, it gives control back to the caller. You can put whatever you want into it
If you need an example, I'll write one for you.
I'm sitting here, waiting for a stick to burn.
next »