<?php include 'person.php'; include 'bridge.php'; // Get random persons, with random speeds. $people = Person::getRandom(10); // Create a bridge with length 1 and width 2. $bridge = new Bridge(1, 2); echo $bridge->getTimeToPass($people) . PHP_EOL;
public function testWiderAverageCrossing() { $people = array(new Person(20), new Person(30), new Person(50), new Person(10), new Person(1)); $bridge = new Bridge(1, 3); $this->assertEquals(71, $bridge->getTimeToPass($people)); }