/** * @depends testApplyScoreOnlyWithCustomScoreVariableIdentifier */ public function testApplyScoreOnlyWithCustomScoreVariableIdentifierAndCustomWeightIdentifier() { $generator = new TestCategoryRulesGenerator(); $generator->setScoreVariableIdentifier('MY_SCORE'); $generator->setWeightIdentifier('MY_WEIGHT'); $doc = new XmlDocument(); $doc->load(self::samplesDir() . 'categories.xml'); $generator->apply($doc->getDocumentComponent(), TestCategoryRulesGenerator::SCORE); $outcomes = $doc->getDocumentComponent()->getOutcomeDeclarations(); $this->assertCount(2, $outcomes); $this->assertTrue(isset($outcomes['MATH' . TestCategoryRulesUtils::TOTAL_SCORE_SUFFIX])); $this->assertTrue(isset($outcomes['ENGLISH' . TestCategoryRulesUtils::TOTAL_SCORE_SUFFIX])); $setOutcomeValues = $doc->getDocumentComponent()->getComponentsByClassName('setOutcomeValue'); $this->assertCount(2, $setOutcomeValues); $this->assertEquals('MY_SCORE', $setOutcomeValues[0]->getExpression()->getExpressions()[0]->getVariableIdentifier()); $this->assertEquals('MY_WEIGHT', $setOutcomeValues[0]->getExpression()->getExpressions()[0]->getWeightIdentifier()); $this->assertEquals('MY_SCORE', $setOutcomeValues[1]->getExpression()->getExpressions()[0]->getVariableIdentifier()); $this->assertEquals('MY_WEIGHT', $setOutcomeValues[1]->getExpression()->getExpressions()[0]->getWeightIdentifier()); }