Skip to content

Commit

Permalink
Merge pull request #126 from seboettg/feature/125-refeactor-namespace…
Browse files Browse the repository at this point in the history
…s-of-unit-tests

#125 refactored namespaces of unit tests
  • Loading branch information
seboettg committed May 20, 2022
2 parents ef12d98 + 58001c9 commit 4e99970
Show file tree
Hide file tree
Showing 25 changed files with 116 additions and 68 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"autoload-dev": {
"psr-4": {
"Seboettg\\CiteProc\\": "tests/src/"
"Seboettg\\CiteProc\\Test\\": "tests/src/"
}
},
"require": {
Expand Down
14 changes: 6 additions & 8 deletions tests/src/BugfixTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
* @license https://opensource.org/licenses/MIT
*/

namespace Seboettg\CiteProc;
namespace Seboettg\CiteProc\Test;

use PHPUnit\Framework\TestCase;
use Seboettg\CiteProc\CiteProc;
use Seboettg\CiteProc\Exception\CiteProcException;
use Seboettg\CiteProc\StyleSheet;

/**
* Class BugfixTest
* @package Seboettg\CiteProc
* @author Sebastian Böttger <seboettg@gmail.com>
*/
class BugfixTest extends TestCase
{

Expand Down Expand Up @@ -57,7 +55,7 @@ public function testBugfixGithub50()
}

/**
* @throws Exception\CiteProcException
* @throws CiteProcException
*/
public function testBugfixGithub58()
{
Expand All @@ -72,7 +70,7 @@ public function testBugfixGithub58()
}

/**
* @throws Exception\CiteProcException
* @throws CiteProcException
*/
public function testBugfixGithub59()
{
Expand Down
23 changes: 22 additions & 1 deletion tests/src/CiteProcTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
* @license https://opensource.org/licenses/MIT
*/

namespace Seboettg\CiteProc;
namespace Seboettg\CiteProc\Test;

use PHPUnit\Framework\TestCase;
use Seboettg\CiteProc\CiteProc;
use Seboettg\CiteProc\Exception\CiteProcException;
use Seboettg\CiteProc\StyleSheet;

class CiteProcTest extends TestCase
{
Expand Down Expand Up @@ -61,6 +64,9 @@ public function testRenderCitationNumber()
$this->runTestSuite("text_renderCitationNumber");
}

/**
* @throws CiteProcException
*/
public function testRenderCssStyle()
{
$style = StyleSheet::loadStyleSheet("international-journal-of-humanoid-robotics");
Expand All @@ -71,6 +77,9 @@ public function testRenderCssStyle()
$this->assertTrue(strpos($cssStyles, "csl-right-inline") !== false);
}

/**
* @throws CiteProcException
*/
public function testRenderCssStyleHangingIndent()
{
$style = StyleSheet::loadStyleSheet("din-1505-2");
Expand All @@ -80,6 +89,9 @@ public function testRenderCssStyleHangingIndent()
$this->assertTrue(strpos($cssStyles, "text-indent: -2em") !== false);
}

/**
* @throws CiteProcException
*/
public function testRenderCssStyleLineAndEntrySpacing()
{
$style = StyleSheet::loadStyleSheet("harvard-north-west-university");
Expand All @@ -90,6 +102,9 @@ public function testRenderCssStyleLineAndEntrySpacing()
$this->assertTrue(strpos($cssStyles, "padding-left: 2em") !== false);
}

/**
* @throws CiteProcException
*/
public function testGetInfo()
{
$style = StyleSheet::loadStyleSheet("harvard-north-west-university");
Expand All @@ -100,6 +115,9 @@ public function testGetInfo()
$this->assertEquals("North-West University - Harvard", $info->getTitle());
}

/**
* @throws CiteProcException
*/
public function testFilterCitations()
{
$style = StyleSheet::loadStyleSheet("harvard-north-west-university");
Expand Down Expand Up @@ -167,6 +185,9 @@ public function testFilterCitations()
}


/**
* @throws CiteProcException
*/
public function testRenderCitationNumberResultAsArray()
{
$style = StyleSheet::loadStyleSheet("elsevier-vancouver");
Expand Down
9 changes: 8 additions & 1 deletion tests/src/ContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
* @license https://opensource.org/licenses/MIT
*/

namespace Seboettg\CiteProc;
namespace Seboettg\CiteProc\Test;

use PHPUnit\Framework\TestCase;
use Seboettg\CiteProc\CiteProc;
use Seboettg\CiteProc\Context;
use Seboettg\CiteProc\Data\DataList;
use Seboettg\CiteProc\Exception\CiteProcException;
use Seboettg\CiteProc\StyleSheet;

class ContextTest extends TestCase
{
Expand All @@ -28,6 +32,9 @@ class ContextTest extends TestCase
*/
private $context;

/**
* @throws CiteProcException
*/
public function setUp(): void
{
$style = StyleSheet::loadStyleSheet("din-1505-2");
Expand Down
6 changes: 2 additions & 4 deletions tests/src/Locale/LocaleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
* @license https://opensource.org/licenses/MIT
*/

namespace Seboettg\CiteProc\Locale;
namespace Seboettg\CiteProc\Test\Locale;

use PHPUnit\Framework\TestCase;
use Seboettg\CiteProc\Locale\Locale;

/**
* Generated by PHPUnit_SkeletonGenerator 1.2.0 on 2012-12-02 at 13:29:49.
*/
class LocaleTest extends TestCase
{
/**
Expand Down
2 changes: 1 addition & 1 deletion tests/src/LocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* created at 07.04.20, 18:49
*/

namespace Seboettg\CiteProc;
namespace Seboettg\CiteProc\Test;

use PHPUnit\Framework\TestCase;

Expand Down
4 changes: 2 additions & 2 deletions tests/src/Rendering/Choose/ChooseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
* @license https://opensource.org/licenses/MIT
*/

namespace Seboettg\CiteProc\Node\Choose\Choose;
namespace Seboettg\CiteProc\Test\Rendering\Choose;

use PHPUnit\Framework\TestCase;
use Seboettg\CiteProc\CiteProc;
use Seboettg\CiteProc\Context;
use Seboettg\CiteProc\Exception\ClassNotFoundException;
use Seboettg\CiteProc\Exception\InvalidStylesheetException;
use Seboettg\CiteProc\Rendering\Choose\Choose;
use Seboettg\CiteProc\TestSuiteTestCaseTrait;
use Seboettg\CiteProc\Test\TestSuiteTestCaseTrait;
use SimpleXMLElement;

class ChooseTest extends TestCase
Expand Down
6 changes: 3 additions & 3 deletions tests/src/Rendering/Date/DateTest.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php
/**
/*
* citeproc-php
*
* @link http://github.com/seboettg/citeproc-php for the source repository
* @copyright Copyright (c) 2016 Sebastian Böttger.
* @license https://opensource.org/licenses/MIT
*/

namespace Seboettg\CiteProc\Rendering\Date;
namespace Seboettg\CiteProc\Test\Rendering\Date;

use PHPUnit\Framework\TestCase;
use Seboettg\CiteProc\TestSuiteTestCaseTrait;
use Seboettg\CiteProc\Test\TestSuiteTestCaseTrait;

class DateTest extends TestCase
{
Expand Down
26 changes: 21 additions & 5 deletions tests/src/Rendering/GroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
* @license https://opensource.org/licenses/MIT
*/

namespace Seboettg\CiteProc\Rendering;
namespace Seboettg\CiteProc\Test\Rendering;

use Exception;
use PHPUnit\Framework\TestCase;
use Seboettg\CiteProc\CiteProc;
use Seboettg\CiteProc\Context;
use Seboettg\CiteProc\Exception\InvalidStylesheetException;
use Seboettg\CiteProc\Locale\Locale;
use Seboettg\CiteProc\TestSuiteTestCaseTrait;
use Seboettg\CiteProc\Rendering\Group;
use Seboettg\CiteProc\Test\TestSuiteTestCaseTrait;
use SimpleXMLElement;

class GroupTest extends TestCase
{
Expand All @@ -29,24 +33,36 @@ public function setUp(): void
CiteProc::setContext($context);
}

/**
* @throws InvalidStylesheetException
* @throws Exception
*/
public function testRenderDelimiter()
{
$str = '<group delimiter=" "><text term="retrieved"/><text term="from"/><text variable="URL"/></group>';
$group = new Group(new \SimpleXMLElement($str), null);
$group = new Group(new SimpleXMLElement($str), null);
$this->assertEquals("abgerufen von http://foo.bar", $group->render(json_decode($this->data)));
}

/**
* @throws InvalidStylesheetException
* @throws Exception
*/
public function testRenderAffixes()
{
$str = '<group prefix="[" suffix="]" delimiter=" "><text term="retrieved"/><text term="from"/><text variable="URL"/></group>';
$group = new Group(new \SimpleXMLElement($str), null);
$group = new Group(new SimpleXMLElement($str), null);
$this->assertEquals("[abgerufen von http://foo.bar]", $group->render(json_decode($this->data)));
}

/**
* @throws InvalidStylesheetException
* @throws Exception
*/
public function testRenderDisplay()
{
$str = '<group display="indent" prefix="[" suffix="]" delimiter=" "><text term="retrieved"/><text term="from"/><text variable="URL"/></group>';
$group = new Group(new \SimpleXMLElement($str), null);
$group = new Group(new SimpleXMLElement($str), null);
$this->assertEquals("<div class=\"csl-indent\">[abgerufen von http://foo.bar]</div>", $group->render(json_decode($this->data)));
}

Expand Down
7 changes: 4 additions & 3 deletions tests/src/Rendering/LabelTest.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?php
/**
/*
* citeproc-php
*
* @link http://github.com/seboettg/citeproc-php for the source repository
* @copyright Copyright (c) 2016 Sebastian Böttger.
* @license https://opensource.org/licenses/MIT
*/

namespace Seboettg\CiteProc\Rendering;
namespace Seboettg\CiteProc\Test\Rendering;

use PHPUnit\Framework\TestCase;
use Seboettg\CiteProc\TestSuiteTestCaseTrait;
use Seboettg\CiteProc\Test\TestSuiteTestCaseTrait;

class LabelTest extends TestCase
{
Expand Down
4 changes: 2 additions & 2 deletions tests/src/Rendering/Name/NameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
* @license https://opensource.org/licenses/MIT
*/

namespace Seboettg\CiteProc\Rendering\Name;
namespace Seboettg\CiteProc\Test\Rendering\Name;

use PHPUnit\Framework\TestCase;
use Seboettg\CiteProc\CiteProc;
use Seboettg\CiteProc\StyleSheet;
use Seboettg\CiteProc\TestSuiteTestCaseTrait;
use Seboettg\CiteProc\Test\TestSuiteTestCaseTrait;

class NameTest extends TestCase
{
Expand Down
9 changes: 2 additions & 7 deletions tests/src/Rendering/Name/NameorderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,11 @@
* @license https://opensource.org/licenses/MIT
*/

namespace Seboettg\CiteProc\Rendering\Name;
namespace Seboettg\CiteProc\Test\Rendering\Name;

use PHPUnit\Framework\TestCase;
use Seboettg\CiteProc\TestSuiteTestCaseTrait;
use Seboettg\CiteProc\Test\TestSuiteTestCaseTrait;

/**
* Class NameDemoteNonDroppingParticleTest
* @package src\Seboettg\CiteProc\Rendering\Name
* @author Sebastian Böttger <seboettg@gmail.com>
*/
class NameorderTest extends TestCase
{
use TestSuiteTestCaseTrait;
Expand Down
9 changes: 7 additions & 2 deletions tests/src/Rendering/Name/NamesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
* @license https://opensource.org/licenses/MIT
*/

namespace Seboettg\CiteProc\Rendering\Names;
namespace Seboettg\CiteProc\Test\Rendering\Name;

use Exception;
use PHPUnit\Framework\TestCase;
use Seboettg\CiteProc\TestSuiteTestCaseTrait;
use Seboettg\CiteProc\CiteProc;
use Seboettg\CiteProc\Context;
use Seboettg\CiteProc\Rendering\Name\Names;
use Seboettg\CiteProc\Test\TestSuiteTestCaseTrait;
use SimpleXMLElement;

class NamesTest extends TestCase
{
Expand Down
4 changes: 2 additions & 2 deletions tests/src/Rendering/Name/SubstituteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
* @license https://opensource.org/licenses/MIT
*/

namespace Seboettg\CiteProc\Rendering\Name;
namespace Seboettg\CiteProc\Test\Rendering\Name;

use PHPUnit\Framework\TestCase;
use Seboettg\CiteProc\TestSuiteTestCaseTrait;
use Seboettg\CiteProc\Test\TestSuiteTestCaseTrait;


class SubstituteTest extends TestCase
Expand Down
5 changes: 3 additions & 2 deletions tests/src/Rendering/NumberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
* @license https://opensource.org/licenses/MIT
*/

namespace Seboettg\CiteProc\Rendering;
namespace Seboettg\CiteProc\Test\Rendering;

use PHPUnit\Framework\TestCase;
use Seboettg\CiteProc\Locale\Locale;
use Seboettg\CiteProc\CiteProc;
use Seboettg\CiteProc\Context;
use Seboettg\CiteProc\TestSuiteTestCaseTrait;
use Seboettg\CiteProc\Rendering\Number;
use Seboettg\CiteProc\Test\TestSuiteTestCaseTrait;

class NumberTest extends TestCase
{
Expand Down
4 changes: 2 additions & 2 deletions tests/src/Rendering/TextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
* @license https://opensource.org/licenses/MIT
*/

namespace Seboettg\CiteProc\Rendering;
namespace Seboettg\CiteProc\Test\Rendering;

use PHPUnit\Framework\TestCase;
use Seboettg\CiteProc\CiteProc;
use Seboettg\CiteProc\StyleSheet;
use Seboettg\CiteProc\TestSuiteTestCaseTrait;
use Seboettg\CiteProc\Test\TestSuiteTestCaseTrait;

class TextTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Style/MacroTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @license https://opensource.org/licenses/MIT
*/

namespace Seboettg\CiteProc\Rendering;
namespace Seboettg\CiteProc\Test\Rendering;

use PHPUnit\Framework\TestCase;
use Seboettg\CiteProc\CiteProc;
Expand Down
Loading

0 comments on commit 4e99970

Please sign in to comment.