Skip to content

Commit

Permalink
Update test 11.3.1 to only work for recipient-country-budget, not the…
Browse files Browse the repository at this point in the history
… other elements with a budget-line part

VAL-264
  • Loading branch information
rolfkleef committed Dec 12, 2019
1 parent ea192c0 commit caed7ff
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rules/iati/dates.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<xsl:next-match/>
</xsl:template>

<xsl:template match="budget-line/value[@value-date]" mode="rules" priority="11.3">
<xsl:template match="recipient-country-budget/budget-line/value[@value-date]" mode="rules" priority="11.3">
<xsl:if test="@value-date castable as xs:date and
../../period-start/@iso-date and
../../period-start/@iso-date castable as xs:date and
Expand Down
43 changes: 42 additions & 1 deletion tests/iati/dates.xspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:me="http://iati.me"
xslt-version="3.0">

<x:scenario label="Dates">
<x:scenario label="Dates in activity files">
<x:scenario label="If activity start dates are after activity end dates">
<x:context>
<iati-activities>
Expand Down Expand Up @@ -58,4 +58,45 @@

</x:scenario>

<x:scenario label="Dates in organisation files">
<x:scenario label="If budget-line value dates are outside the budget period">
<x:context>
<iati-organisation>
<total-budget>
<period-start iso-date="2014-01-01" />
<period-end iso-date="2014-12-31" />
<budget-line>
<value value-date="2013-12-01">2000000</value>
</budget-line>
</total-budget>
<recipient-org-budget>
<period-start iso-date="2014-01-01" />
<period-end iso-date="2014-12-31" />
<budget-line>
<value value-date="2013-12-01">2000000</value>
</budget-line>
</recipient-org-budget>
<recipient-region-budget>
<period-start iso-date="2014-01-01" />
<period-end iso-date="2014-12-31" />
<budget-line>
<value value-date="2013-12-01">2000000</value>
</budget-line>
</recipient-region-budget>
<recipient-country-budget>
<period-start iso-date="2014-01-01" />
<period-end iso-date="2014-12-31" />
<budget-line>
<value value-date="2013-12-01">2000000</value>
</budget-line>
</recipient-country-budget>
</iati-organisation>
</x:context>
<x:expect label="It should not produce message 11.3.1 for total-budget" test="not(//total-budget/budget-line//me:feedback[@id='11.3.1'])"/>
<x:expect label="It should not produce message 11.3.1 for recipient-org-budget" test="not(//recipient-org-budget/budget-line//me:feedback[@id='11.3.1'])"/>
<x:expect label="It should not produce message 11.3.1 for recipient-region-budget" test="not(//recipient-region-budget/budget-line//me:feedback[@id='11.3.1'])"/>
<x:expect label="It should produce message 11.3.1 for recipient-country-budget" test="boolean(//recipient-country-budget/budget-line//me:feedback[@id='11.3.1'])"/>
</x:scenario>

</x:scenario>
</x:description>
2 changes: 1 addition & 1 deletion tests/iati/testfiles/11.3.1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<period-end iso-date="2014-12-31" />
<value currency="USD" value-date="2014-01-01">25000000</value>
<budget-line ref="1234">
<value currency="USD" value-date="2014-01-01">2000000</value>
<value currency="USD" value-date="2015-01-01">2000000</value>
<narrative>Budget Line</narrative>
</budget-line>
</recipient-country-budget>
Expand Down

0 comments on commit caed7ff

Please sign in to comment.