public function testCalcCategoriesScore() { $questions = array('1' => array('category' => '1', 'score' => 1.5, 'weight' => 3), '2' => array('category' => '2', 'score' => 0.5, 'weight' => 1), '3' => array('category' => '1', 'score' => 1.0, 'weight' => 1), '4' => array('category' => '2', 'score' => 1.0, 'weight' => 2)); $category = array('1' => 'category1', '2' => 'category2'); $expectation = array('category1' => 75, 'category2' => 50); $this->assertEquals($expectation, TestController::calcCategoriesScore($questions, $category)); }