2
0
mirror of https://github.com/boostorg/website.git synced 2026-01-24 18:32:38 +00:00
Files
website/common/code/test/tests/libraries.phpt
Daniel James 0cfef1fceb Store library path in metadata, instead of module.
This allowed me to simplify some of update-doc-list as there's no longer
any need to work out the module for a library.  This might break
update-doc-list in places. Will work on that next.
2016-07-04 22:45:49 +01:00

80 lines
2.8 KiB
PHP

<?php
use Tester\Assert;
require_once(__DIR__.'/../config/bootstrap.php');
require_once(__DIR__.'/../../boost.php');
$libraries = BoostLibraries::from_xml('<?xml version="1.0" encoding="US-ASCII"?>
<boost xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<categories>
<category name="Math">
<title>Maths stuff.</title>
</category>
<category name="Generic">
<title>Nonbranded stuff.</title>
</category>
</categories>
<library>
<key>accumulators</key>
<library_path>libs/accumulators</library_path>
<boost-version>1.36.0</boost-version>
<name>Accumulators</name>
<authors>Eric Niebler</authors>
<description>Framework for incremental calculation, and collection of statistical accumulators.</description>
<documentation>libs/accumulators/</documentation>
<std-proposal>false</std-proposal>
<std-tr1>false</std-tr1>
<category>Math</category>
</library>
</boost>
');
$accumulators_details = '{
"key" : "accumulators",
"library_path": "libs/accumulators",
"name": "Accumulators",
"authors": "Eric Niebler",
"description": "Framework for incremental calculation, and collection of statistical accumulators.",
"documentation": "libs/accumulators/",
"category": [ "math" ]
}';
$libraries->update('1.36.0', BoostLibrary::read_libraries_json($accumulators_details));
$r = $libraries->get_history('accumulators');
Assert::same(count($r), 1);
$libraries->update('develop', BoostLibrary::read_libraries_json($accumulators_details));
$r = $libraries->get_history('accumulators');
Assert::same(count($r), 1);
$new_accumulators_details = '{
"key": "accumulators",
"library_path": "libs/accumulators",
"boost-version": "1.36.0",
"name": "Accumulators",
"authors": "Eric Niebler",
"description": "Framework for incremental calculation, and collection of statistical accumulators.",
"documentation": "libs/accumulators/",
"category": [ "Math", "Generic" ]
}';
$libraries->update('develop', BoostLibrary::read_libraries_json($new_accumulators_details));
$r = $libraries->get_history('accumulators');
Assert::same(count($r), 2);
Assert::true(isset($r['1.36.0']));
Assert::true(isset($r['develop']));
Assert::same($r['1.36.0']->details['category'], array('Math'));
Assert::same($r['develop']->details['category'], array('Generic', 'Math'));
Assert::false(isset($r['master']));
$libraries->update('master', BoostLibrary::read_libraries_json($new_accumulators_details));
$r = $libraries->get_history('accumulators');
Assert::same(count($r), 2);
Assert::true(isset($r['1.36.0']));
Assert::true(isset($r['master']));
Assert::false(isset($r['develop']));
Assert::same($r['1.36.0']->details['category'], array('Math'));
Assert::same($r['master']->details['category'], array('Generic', 'Math'));
Assert::false(isset($r['develop']));