Unit testing with PHPUnit: Testing a Calculator: Finishing up (10/10)

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ต.ค. 2024

ความคิดเห็น • 43

  • @SimpleLangSolution
    @SimpleLangSolution 6 ปีที่แล้ว +18

    This series is by far one of the best things that ever happened in my entire life.
    Thank you.

  • @spicytuna08
    @spicytuna08 6 ปีที่แล้ว +3

    Can you my claps. I am standing up and giving a standing ovation and shouting "Encore'.

  • @reszko
    @reszko 4 ปีที่แล้ว +7

    assertInternalType("array") is deprecated. Now you can use assertIsArray() or its internal types variations;

  • @ralphmoran
    @ralphmoran 5 ปีที่แล้ว +1

    Wow! I really appreciate for the invested time you've put on this series. I learned a lot. Thanks much

  • @m41kdevelops41
    @m41kdevelops41 6 ปีที่แล้ว +2

    That series was perfect. thanks for sharing such valuable information for free!

  • @maz4962
    @maz4962 7 ปีที่แล้ว +3

    Exactly what i need, thanks for this series!

  • @daliusslavickas6609
    @daliusslavickas6609 6 ปีที่แล้ว +2

    Had to implement Unit testing for a task given for a job application, this helped a lot !

  • @achso-ok
    @achso-ok 7 ปีที่แล้ว +5

    Thanks for the series!

  • @spicytuna08
    @spicytuna08 6 ปีที่แล้ว +1

    wow! writing test code seems more difficult than functional code. thanks . this was brilliant.

  • @abdulrahman19_
    @abdulrahman19_ 7 ปีที่แล้ว +1

    You are AWESOME, and this playlist is great.
    Thanks form Egypt :D

  • @ahanafi-id
    @ahanafi-id 2 ปีที่แล้ว

    Amazing tutorials! Thank you so much!

  • @megaBreezy
    @megaBreezy 6 ปีที่แล้ว

    Brilliant work. Thanks very much for these!

  • @ShoterOTP
    @ShoterOTP 4 ปีที่แล้ว

    Thank you for this, this will help many people.

  • @n8finch
    @n8finch ปีที่แล้ว

    This was super helpful for a PHPUnit crash course, thank you! 👏👏👏

    • @NymulIslamMoon
      @NymulIslamMoon 10 หลายเดือนก่อน

      $this->assertIsArray( 'array', $calculator->calculate() ); how to solve this problem?

  • @sainag11
    @sainag11 7 ปีที่แล้ว +1

    Excellent series! Thank you

  • @MathijsGroothuis
    @MathijsGroothuis 4 ปีที่แล้ว

    Thanks, nice and easy to follow! :)
    How do you know that you covered enough tests for a certain class?

  • @leeyoung5765
    @leeyoung5765 2 ปีที่แล้ว

    Nice! Very helpful. Thank you.

  • @moisheschwartz6553
    @moisheschwartz6553 4 ปีที่แล้ว

    Thanks for the course, great explanation

  • @silversun7107
    @silversun7107 3 ปีที่แล้ว

    Amazing tutorial, thanks a lot🙏🔥

  • @sethtaylor7519
    @sethtaylor7519 6 ปีที่แล้ว

    Thanks for the much needed refresher! Back to actually writing tests FIRST! lol

  • @johnb8739
    @johnb8739 7 ปีที่แล้ว +2

    great series... thanks a lot

  • @wilbertopachecobatista5049
    @wilbertopachecobatista5049 5 ปีที่แล้ว

    Thanks for sharing the knowledge. If its not to much to ask I would love to see at least one more video about how you test a database connection and results from queries.

  • @jurgentreep
    @jurgentreep 7 ปีที่แล้ว +1

    Thank you. I enjoyed this series :)

  • @LearnProgramsCJ
    @LearnProgramsCJ 6 ปีที่แล้ว

    Its really a good tutorial for learners.. Please keep posting for update.

  • @ynslife
    @ynslife 5 ปีที่แล้ว

    Thank you for this valuable knowledge

  • @SpiritualFacts
    @SpiritualFacts 6 ปีที่แล้ว

    I made it till the last video!

  • @bobsort
    @bobsort 3 ปีที่แล้ว

    Nice series, I liked it. even though it is about testing and logic of programming has nothing to do with it. a few points. First when calling `set`, logically a programmer will expect a `set` not a `merge`. for merge I would assume an `append` or `merge` is in order. Next dropping items from array because they are not match and accepting the rest is a bad practice, it should throw exception or if a little more polite, return an error message or code. in a complex program if you drop some items silently it will cause headache during debug to figure out why I'm passing 3 object and I am receiving 2 object down the line in a chain of 20 classes (if ever they figure out there is such a bug).
    One more thing. when writing test, fixed numbers shouldn't be used. testing upon a fixed value, your method might return your expected result (accidentally or intentionally just to make test pass) and your test will pass even though there is a bug in the application. In such situations an array of fixed values or random values if possible should be used.

  • @swastikrocker123
    @swastikrocker123 4 ปีที่แล้ว

    Can somebody explain what is going on where he passed $addition (a addition class object) to setOperation method having argument OpeartionInterface $operation on calculator class ?? on 2:11 line number 12 ??

  • @aluzulpahegu3653
    @aluzulpahegu3653 5 ปีที่แล้ว +1

    so useful videos

  • @berliniyaat
    @berliniyaat 6 ปีที่แล้ว

    Can't Thank You Enough

  • @catidew
    @catidew 4 ปีที่แล้ว

    thanks a lot fot the tutorial

  • @NymulIslamMoon
    @NymulIslamMoon 11 หลายเดือนก่อน

    would you please update your code for php latest version . this will help alot.

  • @Soochoup
    @Soochoup 4 ปีที่แล้ว

    Why typehint the Interface and not the abstract class ?

  • @xelhuajosephcoronaperez3531
    @xelhuajosephcoronaperez3531 6 ปีที่แล้ว

    Thanks!

  • @orkhanfarmanli
    @orkhanfarmanli 6 ปีที่แล้ว

    a simpler way for setOperations function would be:
    foreach ($operations as $operation) {
    if ($operation instanceof OperationInterface) {
    $this->operations[] = $operation;
    }
    }

  • @ddaniyalh
    @ddaniyalh 7 ปีที่แล้ว +1

    name of this IDE?

    • @paulvos7146
      @paulvos7146 7 ปีที่แล้ว

      Atom, it is a free IDE. I used it too

    • @ddaniyalh
      @ddaniyalh 7 ปีที่แล้ว +1

      Wilbert Vos really? i am using Atom but i think this was a different theme.

    • @rickyj1
      @rickyj1 7 ปีที่แล้ว +2

      Yup this is Sublime with the material theme.

    • @sethtaylor7519
      @sethtaylor7519 6 ปีที่แล้ว

      SublimeText is even lighter than Atom is. (If you are just wanting to get simple work done without all the bells and whistles) You can/should have many tools to choose from depending on the situation, no one thing is the answer!

    • @alaindettorre5807
      @alaindettorre5807 6 ปีที่แล้ว +1

      It is Sublime, both because he used it in the past and also because an orange S logo appears sometimes while deleting files, which is the logo of Sublime. Atom is fine and freeware, Sublime is paid, but if you want to try Atom try Visual Studio Code instead: freeware as well, but better!

  • @NymulIslamMoon
    @NymulIslamMoon 10 หลายเดือนก่อน

    here is the updated method for prevent the error
    use PHPUnit\Framework\TestCase;
    use App\Calculator\Addition;
    use App\Calculator\Division;
    use App\Calculator\Calculator;
    class CalculatorTest extends TestCase
    {
    /** @test */
    public function calculateMethodReturnsMultipleResults()
    {
    $addition = new Addition();
    $addition->setOperands([5, 10]);
    $division = new Division();
    $division->setOperands([50, 2]);
    $calculator = new Calculator();
    $calculator->setOperations([$addition, $division]);
    $results = $calculator->calculate();
    $this->assertIsArray($results);
    $this->assertEquals(15, $results[0]);
    $this->assertEquals(25, $results[1]);
    }
    }