Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    I didnt write the code hence the Spec was written afterwards - I have now bundled the code that was supplied from help on a StackOverFlow question & want to cover it with a Spec
    Christophe Coevoet
    @stof
    getMessages is not part of the Symfony Translator interface, and so is not implemented in the LoggingTranslator
    Eddie Jaoude
    @eddiejaoude
    thank you! it was a long day yesterday, I dont know what I was doing :(
    Mark Harding
    @markharding
    Hey. Is it possible to set the construct variables of a dependency
    Christophe Coevoet
    @stof
    PhpSpec is mocking collaborators and does not call their constructors
    CarstenHoyer
    @CarstenHoyer
    This message was deleted
    Kévin Liagre
    @BboyKeen
    Does it makes sense to spec simple model class ? I've seen this a lot in the Sylius project
    Ciaran McNulty
    @ciaranmcnulty
    Sure
    Kévin Liagre
    @BboyKeen
    @ciaranmcnulty Even for simple getters/setters ? Seems like overkill, no ?
    What should I write for example for a "name" field ?
    it_should_return_a_name() ?
    it_should_have_name_mutable() ?
    Ciaran McNulty
    @ciaranmcnulty
    Oh that sort of 'model' :-)
    Doesn't hurt if it helps you create it
    Kévin Liagre
    @BboyKeen
    Yes, for complex model, I already use it
    Ciaran McNulty
    @ciaranmcnulty
    I tend to because I find stopping my TDD workflow in those cases slows me down slightly
    DTOs don't specifically need it if they have no logic
    But I'd fix it by pushing logic into the model rather than by skipping the tests
    Kévin Liagre
    @BboyKeen
    Right, that's what I'm trying to do.
    And you always start by specifiying your class ? Looks like I still need a lot of training for complex cases :D
    Ciaran McNulty
    @ciaranmcnulty
    I do for core stuff but it's because I use PhpSpec so it does magic for me
    It's either that or get some other tool to generate the class eh
    Kévin Liagre
    @BboyKeen
    Fine, I'll try to let PhpSpec do the magic for me too :)
    Ciaran McNulty
    @ciaranmcnulty
    Don't feel you have to, but thinking 'is this one of the ones I spec?' Inside the core is an overhead for me
    That said I don't spec adapters
    Christophe Coevoet
    @stof
    @ciaranmcnulty which is logical, as it would force you to mock something you don't own :smile:
    Ciaran McNulty
    @ciaranmcnulty
    I'm not 100% anti that if it adds something to your workflow. It's just a waste of time most of the time
    I have some specs for adapters that just check it fits an interface, artefacts of my workflow
    I could delete them I guess
    Mohamed Cherif Bouchelaghem
    @cherifGsoul
    hi, ask, how to pass callable as argument?
    Mohamed Cherif Bouchelaghem
    @cherifGsoul
    I try to go with this phpspec/phpspec#653
    I want to test tactician middelware
    Kévin Liagre
    @BboyKeen
    Hi, I've taken a look at the specificications written in the Sylius project to use them as inspiration but I had the feeling that the specifications were just repeating the same source code as in the final class except they added the suffixes willReturn, shouldBeCalled, etc.
    Is this really the way PhpSpec should be used ?
    Do you guys have any good and complex examples I can follow ? (by complex I mean classes doing a bit more than just echoing "Hello World" )
    Roel Monnens
    @roelmonnens_twitter
    hey, is it possible to detect return void? something like shouldReturnVoid?
    Jakub Zalas
    @jakzal
    shouldReturnNull()
    Yura Lukashik
    @YuraLukashik
    @roelmonnens_twitter functions without return by default return null value
    there is no void in php
    there is only return typehint in php7 https://wiki.php.net/rfc/void_return_type which doesn’t allow any return statements
    Mohamed Cherif Bouchelaghem
    @cherifGsoul
    Hey all, Im mocking PSR7 interfaces does it mean it is a violation of "Dont mock what you dont own" rule? https://github.com/cherifGsoul/identity-access/blob/master/spec/Infrastructure/Expressive/Http/AuthenticationMiddlewareSpec.php#L32
    Yura Lukashik
    @YuraLukashik
    @cherifGsoul PSR7 is stable enough(it’s even probably more stable than your own interfaces), so I don’t think you should worry about it
    Mohamed Cherif Bouchelaghem
    @cherifGsoul
    @YuraLukashik thank you no doubt for the stability :)
    Christophe Coevoet
    @stof
    just make sure that your mock actually behave exactly like what PSR-7 describes
    this is not easy (especially due to immutability when you need to use the cloning mutators in your code)
    Mohamed Cherif Bouchelaghem
    @cherifGsoul
    @stof Yeah,for now it works, I didnt write integration tests yet to make sure everything is fine
    Roel Monnens
    @roelmonnens_twitter
    hello, does anybody has some guidelines about speeding up our phpspec suite? We are running:
    275 specs
    876 examples (876 passed)
    9672ms
    we run this inside of a vagrant box
    could that be the slow factor?
    Christophe Coevoet
    @stof
    is the code in a vagrant shared folder ? The slow filesystem might be the culprit
    Ciaran McNulty
    @ciaranmcnulty
    That is indeed slow. Why does it need to run inside vagrant?