How do you write a negative test?



  • How to write a negative test that I want to point out that if count($jsonToArrayAll) 2 is a lie.

    $this->assertFalse(assertNotEquals(2, count($jsonToArrayAll)));
    


  • assertNotEquals() - procedure, not function - she's not returning anything. Accordingly assertFalse() won't work as expected.

    That's right.

    // проверяет, что всё условие не верно
    $this->assertFalse(2 == count($jsonToArrayAll)); 
    

    // проверяет, что count($jsonToArrayAll) не равно 2
    $this->assertNotEquals(2, count($jsonToArrayAll));




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2