« first day (2375 days earlier)      last day (2567 days later) » 

1:00 PM
showing you screenshot, please wait
@tereško
did you see it?
 
yes .. well ... that tells me almost nothing
what do you see, when checking view-source for each of those?
 
the same code
second image is after removing space and tabe
 
that makes no sense
 
first is before removing
 
unless your CSS is fucked (something with display: inline, and no-wrap)
and that's if your HTML is actually identical in both cases
you could start by dumping it in validator.w3.org, @NeelIon
 
1:08 PM
does css have anything to do with spaces and tabs?
ok i am trying
 
@NeelIon sometimes, if CSS is written especially badly
 
Wes
OK (1 test, 2 assertions) \o/
first step.
 
ok teresko
thanks man
 
@Wes so you have started using unit test for the first time?
@NeelIon did you find the problem?
 
Wes
@tereško pretty much.
 
1:10 PM
@Wes will it be something that we can look at or is it something closed-sourced?
 
Wes
@tereško first tests i've written for the mocking framework i'm writing using niki's php parser :B
 
@NeelIon is that the broken version?
 
yes
 
Wes
i will make it open. right now it's just poo. it's like the fifth attempt and everything is a mess
 
1:11 PM
can you see it?
 
Wes
do you use mocks teresko?
 
@Wes yes, though I prefer stubs instead
 
Wes
do you hate too phpunit's, mockery, mockito? :B
 
phpunit's built-in mocks
 
@tereško
 
1:13 PM
hi, I'm writing php extensions. how does one debug such php extensions during development
 
@NeelIon I am looking. Stop being impatient
 
@tereško did you see it?
@tereško lol, thanks
 
@NeelIon thin this rule: @media (min-width: 768px) .vcenter {
you have float: none
 
Wes
$mock = will()->needObject(SomeClass::CLASS);
will()->getAndCall($mock, "method", ["using", "these", "arguments"], "will return this");
assertSame("will return this", $mock->method("using", "these", "arguments"]));
 
whenever you use float, it overrides display and makes it block, @NeelIon
remove that line ant it should all work
basically, you additional spaces were messing with the "inline" elements
 
1:18 PM
@tereško Do you want to see how it looks after removing spaces?
ok
i am doing as you said
 
@NeelIon no really
 
ok
 
so, did that fix it?
 
Wes
class SomeClass{
    private $bar; // irrelevant
    function foo(int $a, int $b, int $c){ /* irrelevant */ }

    function subjectUnderTest($a, $b, $c){
        $this->bar = 555;
        return $this->foo(++$a, ++$b, ++$c);
    }
}

$mock = will()->needObject(SomeClass::CLASS, "subjectUnderTest");
will()->set($mock, "bar", 555);
will()->getAndCall($mock, "foo", [5, 6, 7], 666);
assertSame(666, $mock->subjectUnderTest(4, 5, 6));
 
@tereško checking for inline elements
 
Wes
1:21 PM
what i wanted was something minimal and capable of testing private stuff
 
@tereško actually i didnt design that page
 
hello, anyone here who has some experience writing php extensions. I'm trying to find ways to debug such php extensions
 
Wes
now thanks to @NikiC's parser i can also do:
class SomeClass{
    function subjectUnderTest($a, $b, $c){
        return parent::bla(++$a, ++$b, ++$c);
    }
}

$mock = will()->needObject(SomeClass::CLASS, "subjectUnderTest");

will()->getAndCall($mock, "parent::bla", [5, 6, 7], "return");

$mock->subjectUnderTest(4, 5, 6);
should i make it open?
 
9 mins ago, by tereško
@NeelIon thin this rule: @media (min-width: 768px) .vcenter {
look for that rule in CSS
 
ok
 
1:25 PM
also, next time use a different person to slice CSS
 
Wes
that though is the phpunit wrapper, but can also do custom assertions
will()->getAndCall($mock, "parent::bla", function(){ assert(func_get_args() === [5, 6, 7]); return "return"; });
 
@tereško after removing float: none it is getting fixed
@tereško Thanks man
@tereško for sure
 
Wes
@NeelIon what's the problem?
 
@NeelIon cool. Just check the other pages. Because that line smells like it could have been a bugfix from something else
@Wes you should never have to mock the class that you are attempting to test
and you should never try to unittest private methods
 
@tereško lol
 
1:31 PM
@NeelIon I am quite serious
 
Wes
@tereško why?
 
@tereško ya, think so
 
Wes
@tereško i mock everything except the method that is being tested
 
@tereško that guy used the same css for every page
 
Wes
all collaborators are faked and are programmable externally
 
1:33 PM
@Wes because it is pointless. Unit test are there to verify, that the public interface works as documented. When you start messing with private methods, you suddenly are verifying the specific implementation details.
@Wes that's a terrible idea
 
Wes
so you test the smallest unit possible
 
smallest unit is class
 
Wes
@tereško no, that's black box (or functional) testing, and it's not usually used for unit testing
 
nope
 
Wes
yes
 
1:35 PM
oh , well, do what thou wilt
 
besides, if you can't hit the private methods code paths through public methods, there's something wrong
 
Wes
knowledge of all code paths implies white box testing
 
you dont understand, but you can just learn from your own mistakes
 
@NikiC congrats on the new blog post, and on getting on HN!
 
Alternatively you can use the formatting preserving pretty printer (on master)
 
Wes
1:41 PM
@tereško what if... you are wrong? i did document myself a lot before starting this. testing a private method through the public api is a form of integration testing
 
hey
if you make a IS_REFERENCE containing an IS_UNDEF, what happens? :p
…I want to try this now
 
@Andrea thanks :)
 
@NikiC I envy your technical writing.
 
ah, true, that was a nice one, congrats @NikiC
 
@Andrea probably things breaking in odd ways because that shouldn't ever happen ^^
 
1:42 PM
I struggle to achieve the same kind of clarity. Practice makes perfect, though.
@NikiC :D
 
Wes
 
what's a simple function that returns a reference
 
the only critique I would have is that it felt weird to have no goal... but I guess that's also the point of the post, to be just some sort of "reference explaining stuff"
 
@Wes you just dont understand what unit tests is and how the differ from integration tests
but, as I said before - do what thou wilt
 
> This video can't be read on your current operating system.
 
Wes
1:43 PM
sure.
 
I have no intention to spend more time to convince you
 
Wes
@tereško retreat makes you wrong
#shotsfired
 
@Wes now you're just trolling him :)
for the record, I'm on his side there, but yeah, you don't look like you want to listen, so I'm not trying either
 
@Andrea I'm not sure if there actually are any builtin functions that return by reference
 
Wes
@FlorianMargaine give me an explanation, i haven't read any
 
1:46 PM
@NikiC I think I remember there being one, but I'm sure it's rare
oh wait I don't need something returning a reference anyway, just something that takes one
 
Wes
how is a private method different from a public method? would you test a database query through services? everything is private to something else, and the unit is a single function/method. not a class
 
also hey wait I should update my StackOverflow ~æsthetic~
 
Wes
@FlorianMargaine i'm actually open to discussion as long there is an actual discussion
 
@Wes I'm pretty sure I already discussed this with you once
But you insistent on being wrong :P
 
$ sapi/cli/php -r '$x = []; array_push($x, 1); var_dump($x);'
UNKNOWN:0
yep, UNDEF in a REFERENCE does weird things :D
$ sapi/cli/php -r '$x = []; array_push($x, 1); $x *= 2; var_dump($x);'

Fatal error: Uncaught Error: Unsupported operand types in Command line code:1
Stack trace:
#0 {main}
  thrown in Command line code on line 1
In case it's not obvious, I modified array_push by adding this:
zval_ptr_dtor(stack);
ZVAL_UNDEF(stack);

RETURN_NULL();
 
Wes
1:54 PM
@NikiC sorry if i ask again then, why private methods shouldn't be tested singularly?
 
because they are not part of published API
 
@Wes difference between public and private methods tests is similar to between integration and unit tests, IMO
you can test the underlying components comprising a whole, but IMHO it's much more important to test the behaviour of the whole
 
private methods are "implementation detail"
 
@tereško exactly
 
Wes
@tereško @Andrea
unit tests _are_ about implementation. we test code paths. that's not the interface, it's the implementation
https://vimeo.com/80533536
http://softwaretestingfundamentals.com/
http://jasonpolites.github.io/tao-of-testing/intro-1.1.html
book "The Art of Unit Testing"
one of these i don't remember which writes:
how do you test a function that calls itself recursively, forever? a private method is a similar bond, you shouldn't care what collaborators do
 
2:06 PM
so, you think that the "unit" is a procedure
 
one of the perils of unit testing and the like is that it makes changing the implementation hard
because now you have to rewrite all those tests
but the result usually matters more than the implementation
that being said, if it's something particularly tricky, I can see a case for the unit test…
 
So I am getting into classes and I'm hella confused
 
Wes
@tereško yes. the smallest, kind-of-reusable piece of code
sorry wrong ping
 
@Alesana you will have to elaborate
also, I am out of wine ... sec
 
@Alesana A class defines a particular kind of object. An object is just a thing that has some data (properties), and some functions for operating on that data (methods).
 
2:16 PM
Haha good call on the wine ^^
 
ok .. so .. details
 
First I have to figure out what my question is o.o
I have all these files that all extend this particular class, which is great I understand that
But they also all have namespaces
Which I am reading about, and it totally throws me off
 
namespaces are a way to group the classes (they also double a a handy way for autoloading)
 
They group classes or they group things inside classes?
 
@Alesana that is a joke right?
 
Wes
2:19 PM
@Andrea that is inevitable imho, you can't cover everything just by checking input and output
 
@Alesana when you define a class, you can also describe the namespace in which it is
 
@Wes you don't need to cover everything, only what matters
 
@FélixGagnon-Grenier Haha no :|
 
for example, class PasswordIdentity is in namespace Entity\Authentication
 
I'm not a 100% coverage person
@Alesana namespaces are just a shortcut for naming things, to save you writing out the full name of something over and over again
 
2:21 PM
Ah okay, so it's just like a directory of classes?
 
@Andrea your PEAR trauma is showing
 
@Alesana pretty much
@tereško nah, it's C :p
zend_ zend_ zend_
 
@Alesana kinda. At least that's how they get autoloaded. But I would call them "categories" instead of "directories.
 
@Andrea It it doesn't matter it should be removed from the codebase
 
@Alesana think: phylogeny
 
2:22 PM
:)
 
@Alesana the syntax works basically the same too
 
@Wes if checking input and output is not enough, it probably means your code sucks
 
@Alesana it's like UNIX directories or URL paths where / is the root, except it uses backslashes
 
Okay yeah that part I understand pretty well
 
namespace foo; at the top of a file basically sets the current directory
 
Wes
2:23 PM
@NikiC it's what i'm saying. you can't just do that
> one of these i don't remember which writes:
how do you test a function that calls itself recursively, forever? a private method is a similar bond, you shouldn't care what collaborators do
 
so if you want to use the class \foo\bar within that file, you can just type bar
but if you wanted to use \qux\bar you'd have to type out the full path
 
Ahhh I see
 
@NikiC I think what wes is trying to say is about covering code paths
 
That makes a lot of sense
 
Which imo is a valid point
 
2:24 PM
So what confuses me is I have all these files that list their own specific namespace then say Class Guest extends \Api_abstract, all using the same Class Guest, and they all extend the same \Api_abstract, so how would they have different namespaces each if they extend the same class?
 
Wes
you should only test the code path within the method, not other stuff
 
If you haven't covered all code paths either the code can be removed or you are missing tests
 
@Wes you don't write a function that recursively calls itself forever
 
@Alesana namespaces and inheritance are completely orthogonal, any class in any namespace can extend any other class
 
Wes
@PeeHaa for the record, it's not my point :B i was confused too, as you know
 
2:25 PM
oh
 
Wes
@NikiC it's an exaggeration, yes
 
Then you are wrong :P
:D
 
Wes
:B
 
*then
 
Damnit just too late :(
@NikiC Could you please add a delay to your brain finger interface kthxbye
 
2:26 PM
Ahh that makes a lot of sense then. I thought that the way they wrote this must have been insane
 
it's not like packages in Java or something where the “package” part of a name is significant in that way
although even then, I think classes in one Java package can extend classes in another, so long as the class lets them
 
if the song was released in current year, someone would have an aneurysm and the band should apologize profusely (was listening to Guano Apes cover)
 
I took a couple seconds of looking at Java syntax and decided I liked PHP better haha
So if I have both the classes First and Second in namespace Project\User\Something, I could just call Second from First by using it's name... but if I have First in Project\Guest\Something and Second in Project\User\Something I would have to type in the full namespace to call Second from within First? And, where the files are located won't have any effect?
Wow that was confusing ^^
 
Wes
anyway @NikiC i can test forever running recursive methods :B
class A{
    private function subjectUnderTest($a){
        $this->subjectUnderTest($a + 1);
    } // foreverish running recursive method
}
$a = will()->needObject(A::CLASS, "subjectUnderTest");
will()->getAndCall($a, "subjectUnderTest", [78]); // expects the inner call
$a->subjectUnderTest(77);
 
@Alesana yes, or you could alias them using use statement
you just write use Project\Guest\Something\First at the top and in the rest of the file you can write First
or you can write use Project\Guest\Something\First as FooBar and write FooBar when ever you would need then instance of Project\Guest\Something\First
 
Wes
2:34 PM
@NikiC uhm, where is that?
 
Ahh okay I had read about use as well. If I only use a class if a conditional is met should I lay off on using use at the top for efficiency or does it not increase workload to use a class?
 
there is the concept of "fully qualified class name", @Alesana
the use is just a syntax sugar to make the usage simpler
 
Ah okay cool
 
I think that code should still work
 
2:37 PM
Oh god I just got done trying to figure out what a fully qualified domain name is
 
"fully qualified class name"
:D
you can get it by calling $name = Foo::class; where Foo is some class
 
Haha I know, I was just joking
And the FQCN would be the absolute namespace of the class?
Or am I way off?
 
absolute namespace + class name
it's what you would actually use in autoloading
(if you are not inclined to use composer's PSR4 autoloader)
 
Okay
 
yay, got a refund approved on steam
 
2:44 PM
So if the class is in namespace A has the same name as a class in namespace B, and I want to use both (or use the one from A from within the one from B), I would have to use the fully qualified name?
Then also give it an alias?
And nice I didn't think people actually got refunds from Steam haha
 
you can either use the fully qualified name or an alias:
 
Wes
@NikiC is it normal that ClassMethod::$name is Identifier rather than:
/** @var string Name */
public $name;
 
> * symbol_table is a typically unused symbol table used in case some crazy person actually uses variable variables or similar features.
@NikiC @ me next time
 
namespace A {
    class Foo {}
}
namespace B {
    class Foo {}
}
namespace C {
    new A\Foo;
    new B\Foo;
}
namespace D {
    use A\Foo;
    new Foo; // A\Foo
    new B\Foo;
}
namespace E {
    use A\Foo;
    use B\Foo as BFoo;
    new Foo; // A\Foo
    new BFoo; // B\Foo
}
 
@ircmaxell I saw you fond the only good quote from DHH (probably plagiarized)
 
2:52 PM
I don't like everything that Uncle Bob says. So that means I likely don't dislike everything DHH says
 
:D
 
That makes sense then
 
@ircmaxell I blame Rails for that .. well .. both of them
 
well, considering one was the creator of rails... ;)
 
Wes
@NikiC i should've continued reading :B
Changes to non-Node subnodes results in formatting being lost. The reason is that we don't have offset information for non-Node subnodes. Some of the parser options specified above (e.g. useIdentifierNodes) make use of Nodes where previously strings were used. For example, this allows changing the name of a function while preserving formatting. On the other hand changing a function to return by ref (this is a boolean subnode) will drop formatting.
 
2:54 PM
Thanks for helping me out guys ^^
 
fuck, I will really have to but Battle Brothers :(
 
@NikiC I note that call frames can't cross page boundaries. Does that then set an effective upper limit on the number of variadic parameters you can send (i.e. the page size)?
(I know you shouldn't unpack massive arrays into argument lists, but I also know it might happen in practice.)
 
3:28 PM
@Andrea nope, we'll alloc a page of sufficient size in that case
> However if this would cross a stack page boundary, a new page has to be allocated and the entire call frame (including already pushed arguments) needs to be copied to the new page (we are not be able to handle a call frame crossing a page boundary).
 
3:47 PM
@tereško how r u ?
are you there?
 
wat
 
So there is this gem I read on imgur sooner today:
@NeelIon this is so random it's cryptographycally secure
7
 
@tereško sleep is for weaklings
 
4:02 PM
@Saitama and rested people
 
@Wes @NikiC @Andrea @PeeHaa I don't understand, how can you miss a private method codepath by testing only the public methods?
 
@FlorianMargaine I am talking about testing it all through the public interface, not going into it a directly testing privates
 
Exactly
 
You're supposed to be able to test your implementation details through the public methods
 
4:08 PM
2 hours ago, by PeeHaa
If you haven't covered all code paths either the code can be removed or you are missing tests
 
I wish I could vote several :P
 
@FlorianMargaine well ... if your code is shit and you have "dangling privates", then you can :D
 
@PeeHaa you can, just sign up for multiple twitter accounts :-P
 
@ircmaxell what are "poor product choices"? Do you mean it as "product was been badly defined"?
 
4:12 PM
@ircmaxell I like your pragmatic approach :P
 
@tereško it was vague because I want to hear the discussion around it ;)
 
in that case - none of the above
 
that's perfectly fine :)
 
I would also say that "communication" and "process" is basically the same problem ... that someone has tried to solve ineffectively
as I see it, the provided options boil down to: tools, management or requirements
 
it is the same problem, but it's interesting that it's not perceived as the same ;)
 
4:22 PM
mysqlnd error on utf8mb4 charset used by MySQL 8.0 – #74461
 
some of the people have forgotten that there exists code that is almost impossible to refactor
 
well, it gets to be impossible to refactor
it's always possible, it just approaches
@ircmaxell attempt to avoid technical debt by overengineering made it worse. ;)
yes!
 
@ircmaxell that's the "almost" part ... but I am right now looking at code, that is include oriented with globals, and someone has slapped on it doctrine in some places
about 2 years ago I would have said that there is no way to even try refactoring it
 
yup, it may take a ton of effort, and not be worth it, but you can technically do it
 
Wes
@ircmaxell I would vote ( ) Poor programmer (me) but it's not listed :B
 
4:36 PM
hhehehehehe
 
Wes
@FlorianMargaine that's not the point. if your private method is called in 30 different places, you are testing it indirectly from 30 different places... if your private methods has 20 different code paths you are testing each code path 30 times...
 
@Wes yeah, that was basically my choice too
 
Wes
do the math...
if you can't avoid traversing the private method from other methods it's fine, but it must be tested in isolation first/too
 
also, @Wes, you are missing the point of unit testing
it is not called function testing
 
Wes
... are you aware of the countless papers that specifically discuss about "what is the unit"
so, i'm not missing anything, i'm perhaps as confused as everybody is, some less, some more
 
4:40 PM
@Wes since when "there are papers about it" has become a valid reason ?!? twitter.com/RealPeerReview
you are attempting to argue from authority
 
Wes
there is no authority, it is fine disagreeing
you keep saying "you are wrong" "you are missing the point"
and that's a conversation i don't want to have
 
because am lazy and half drunk
 
Wes
:B
 
4:52 PM
evenin
 
\o
 
p/
lol that cat looks too old
@tereško is that from any game?
 
@Linus yes .. skyrim :D
 
:P
 
5:18 PM
Lies.
Is called Catrim.
 
hahah
 
Wes
5:30 PM
@PeeHaa do you know how code coverage works?
 
5:44 PM
!!dad
 
Did you hear about the new restaurant called Karma? There’s no menu; You get what you deserve.
 
:)
 
5:59 PM
do you all write scripts for automated testing?
 

« first day (2375 days earlier)      last day (2567 days later) »