|
Open Journal Systems
3.3.0
|
12 use PHPUnit\Framework\TestCase;
229 "title": "My Anonymous Heritage",
233 $enrichAuthorWithLinkFunction =
function($authorItem, $authorName) {
234 return isset($authorItem->id) ?
'<a href="https://example.org/author/' . $authorItem->id .
'" title="' . $authorName .
'">'
235 . $authorName .
'</a>' : $authorName;
239 $citeproc =
new CiteProc($apa,
"de-DE", [
240 'author' => $enrichAuthorWithLinkFunction
242 $actual = $citeproc->render(json_decode($cslJson),
"bibliography");
244 $expected =
'<div class="csl-bib-body">
245 <div class="csl-entry"><a href="https://example.org/author/doe" title="Doe, J.">Doe, J.</a>, & Müller, A. (2001). <i>My Anonymous Heritage</i>.</div>
247 $this->assertEquals($expected, $actual);
272 "title": "My Anonymous Heritage",
276 $enrichAuthorWithLinkFunctionBibliography =
function($authorItem, $authorName) {
277 return isset($authorItem->id) ?
'<a href="https://example.org/author/' . $authorItem->id .
'" title="' . $authorName .
'">'
278 . $authorName .
'</a>' : $authorName;
282 $citeproc =
new CiteProc($apa,
"de-DE", [
284 "author" => $enrichAuthorWithLinkFunctionBibliography,
285 "csl-entry" =>
function($item, $renderedItem) {
286 return '<a id="' . $item->id .
'"></a>' . $renderedItem;
290 "csl-entry" =>
function($item, $renderedItem) {
291 return '<a href="#' . $item->id .
'">' . $renderedItem .
'</a>';
295 $actualBibliography = $citeproc->
render(json_decode($cslJson),
"bibliography");
296 $actualCitation = $citeproc->render(json_decode($cslJson),
"citation");
297 $expectedBibliography =
'<div class="csl-bib-body">
298 <div class="csl-entry"><a id="item-1"></a><a href="https://example.org/author/doe" title="Doe, J.">Doe, J.</a>, & Müller, A. (2001). <i>My Anonymous Heritage</i>.</div>
300 $expectedCitation =
'(<a href="#item-1">Doe & Müller, 2001</a>)';
301 $this->assertEquals($expectedCitation, $actualCitation);
302 $this->assertEquals($expectedBibliography, $actualBibliography);
trait TestSuiteTestCaseTrait
testNameAuthorCountWithSameVarContentAndCombinedTermSucceed()
testNameAuthorCountWithMultipleVariables()
testNameAttrSortSeparator()
testNameNamepartAffixesNameAsSortOrder()
render($data, $mode="bibliography", $citationItems=[], $citationAsArray=false)
testNameArticularNameAsSortOrder()
testNameAttrEtAlSubsequentNone()
testNameCeltsAndToffsCrowdedInitials()
testNameAttrNameDelimiter()
testNameAttrEtAlSubsequentCompleteEach()
testNameAttrEtAlSubsequentPartialEach()
testNameAttrDelimiterPrecedesEtAl()
testNameAttrEtAlSubsequentUseFirst()
testNameAttrEtAlSubsequentPartialFirst()
testNameAttrEtAlUseFirst()
_testRenderTestSuite($filterTests, $ignore=null)
testNameAttrDelimiterPrecedesLast()
static loadStyleSheet($styleName)
testNameAuthorCountWithSameVarContentAndCombinedTermFail()
testNameCeltsAndToffsWithHyphens()
testEnrichMarkupNamesCitationsAndBibliography()
testNameCitationMacroNoInheritanceFromRoot()
testNameAttrEtAlSubsequentCompleteAll()
testNameAttrNameAsSortOrder()
testNameArticularShortForm()
testNameCeltsAndToffsNoHyphens()
testNameAuthorEditorCount()
testNameAttrEtAlSubsequentMin()
testNameCeltsAndToffsSpacedInitials()
testNameNamepartAffixes()
testInitializeCyrillicName()
testNameAttrInitializeWith()