new Length(10, new Unit('m')); $length2 = new Length(5, new Unit('m')); $expected = new Length(15, new Unit('m')); $this->assertEquals( $expected, $length1->add($length2) ); } }
CanNotCompareDifferentUnits */ function it_throws_when_adding_lengths_of_different_unit() { $length1 = new Length(10, new Unit('m')); $length2 = new Length(5, new Unit('cm')); $length1->add($length2); } // etcetera }