getScore()); } /** * @testdox The net promoter score, detractors, passives and promoters are correct * @group framework */ public function testScoreDetractorPassivePromotor() : void { $nps = new NetPromoterScore(); for ($i = 0; $i < 10; ++$i) { $nps->add(\mt_rand(0, 6)); } for ($i = 0; $i < 30; ++$i) { $nps->add(\mt_rand(7, 8)); } for ($i = 0; $i < 60; ++$i) { $nps->add(\mt_rand(9, 10)); } self::assertEquals(50, $nps->getScore()); self::assertEquals(10, $nps->countDetractors()); self::assertEquals(30, $nps->countPassives()); self::assertEquals(60, $nps->countPromoters()); } }