예제 #1
0
 function testDebugInformationExcludedFromIteration()
 {
     $set = new RecommendationSet('X');
     $set->addDebug(new Debug\SourceDocument('forum post', 1));
     $set->add($rec = new Recommendation('forum post', 42));
     $out = [];
     foreach ($set as $r) {
         $out[] = $r;
     }
     $this->assertSame($out, [$rec]);
 }
예제 #2
0
 function testEngineProvidesDebugInformation()
 {
     $engineSet = new EngineSet();
     $engineSet->register('test-a', new Engine\FakeEngine([['type' => 'wiki page', 'object' => 'Content A'], new Debug\SourceDocument('wiki page', 'Content Z')]));
     $comparator = new Comparator($engineSet);
     $input = new Input\UserInput('bob');
     $expect = new RecommendationSet('test-a');
     $expect->add(new Recommendation('wiki page', 'Content A'));
     $expect->addDebug(new Debug\SourceDocument('wiki page', 'Content Z'));
     $this->assertEquals([$expect], $comparator->generate($input));
 }