Skip to content

Commit

Permalink
Move tests to the Fhaculty\Graph\Tests namespace.
Browse files Browse the repository at this point in the history
Update composer.json to use autoload-dev to autoload the new Fhaculty\Graph\Tests namespace.
Rename bootstrap.php to TestCase.php and remove the unnecessary include_once.
Update phpunit.xml.dist to use vendor/autoload.php instead of tests/bootstrap.php.
  • Loading branch information
tomzx committed Jul 7, 2016
1 parent 9159d94 commit aa3d5be
Show file tree
Hide file tree
Showing 19 changed files with 61 additions and 8 deletions.
17 changes: 15 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,24 @@
"name": "clue/graph",
"type": "library",
"description": "A mathematical graph/network library written in PHP",
"keywords": ["graph", "network", "mathematical", "vertex", "edge"],
"keywords": [
"graph",
"network",
"mathematical",
"vertex",
"edge"
],
"homepage": "https://github.com/clue/graph",
"license": "MIT",
"autoload": {
"psr-4": {"Fhaculty\\Graph\\": "src/"}
"psr-4": {
"Fhaculty\\Graph\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Fhaculty\\Graph\\Tests\\": "tests/"
}
},
"require": {
"php": ">=5.3.0"
Expand Down
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="tests/bootstrap.php"
<phpunit bootstrap="vendor/autoload.php"
colors="true" convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
Expand All @@ -15,4 +15,4 @@
<directory>./src/</directory>
</whitelist>
</filter>
</phpunit>
</phpunit>
4 changes: 4 additions & 0 deletions tests/Attribute/AbstractAttributeAwareTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?php

namespace Fhaculty\Graph\Tests\Attribute;

use Fhaculty\Graph\Attribute\AttributeAware;
use Fhaculty\Graph\Tests\TestCase;

abstract class AbstractAttributeAwareTest extends TestCase
{
abstract protected function createAttributeAware();
Expand Down
2 changes: 2 additions & 0 deletions tests/Attribute/AttributeBagContainerTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Fhaculty\Graph\Tests\Attribute;

use Fhaculty\Graph\Attribute\AttributeBagContainer;

class AttributeBagContainerTest extends AbstractAttributeAwareTest
Expand Down
2 changes: 2 additions & 0 deletions tests/Attribute/AttributeBagNamespacedTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Fhaculty\Graph\Tests\Attribute;

use Fhaculty\Graph\Graph;
use Fhaculty\Graph\Attribute\AttributeBagNamespaced;
use Fhaculty\Graph\Attribute\AttributeAware;
Expand Down
2 changes: 2 additions & 0 deletions tests/Attribute/AttributeBagReferenceTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Fhaculty\Graph\Tests\Attribute;

use Fhaculty\Graph\Attribute\AttributeBagReference;

class AttributeBagReferenceTest extends AbstractAttributeAwareTest
Expand Down
4 changes: 3 additions & 1 deletion tests/Edge/EdgeAttributesTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php

namespace Fhaculty\Graph\Tests\Edge;

use Fhaculty\Graph\Graph;
use Fhaculty\Graph\Edge\Base as Edge;
use Fhaculty\Graph\Tests\TestCase;

class EdgeAttributesTest extends TestCase
{

/**
*
* @var Edge
Expand Down
4 changes: 3 additions & 1 deletion tests/Edge/EdgeBaseTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php

namespace Fhaculty\Graph\Tests\Edge;

use Fhaculty\Graph\Graph;
use Fhaculty\Graph\Edge\Base as Edge;
use Fhaculty\Graph\Tests\Attribute\AbstractAttributeAwareTest;

abstract class EdgeBaseTest extends AbstractAttributeAwareTest
{

protected $graph;
protected $v1;
protected $v2;
Expand Down
2 changes: 2 additions & 0 deletions tests/Edge/EdgeDirectedTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Fhaculty\Graph\Tests\Edge;

class EdgeDirectedTest extends EdgeBaseTest
{
protected function createEdge()
Expand Down
2 changes: 2 additions & 0 deletions tests/Edge/EdgeUndirectedTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Fhaculty\Graph\Tests\Edge;

class EdgeUndirectedTest extends EdgeBaseTest
{
protected function createEdge()
Expand Down
3 changes: 3 additions & 0 deletions tests/Exception/NegativeCycleExceptionTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

namespace Fhaculty\Graph\Tests\Exception;

use Fhaculty\Graph\Tests\TestCase;
use Fhaculty\Graph\Walk;
use Fhaculty\Graph\Exception\NegativeCycleException;

Expand Down
3 changes: 3 additions & 0 deletions tests/GraphTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

namespace Fhaculty\Graph\Tests;

use Fhaculty\Graph\Exception\RuntimeException;
use Fhaculty\Graph\Tests\Attribute\AbstractAttributeAwareTest;
use Fhaculty\Graph\Vertex;
use Fhaculty\Graph\Exception\OverflowException;
use Fhaculty\Graph\Exception\InvalidArgumentException;
Expand Down
3 changes: 3 additions & 0 deletions tests/Set/BaseVerticesTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php

namespace Fhaculty\Graph\Tests\Set;

use Fhaculty\Graph\Exception\OutOfBoundsException;
use Fhaculty\Graph\Graph;
use Fhaculty\Graph\Tests\TestCase;
use Fhaculty\Graph\Vertex;
use Fhaculty\Graph\Set\Vertices;

Expand Down
3 changes: 3 additions & 0 deletions tests/Set/EdgesTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php

namespace Fhaculty\Graph\Tests\Set;

use Fhaculty\Graph\Exception\OutOfBoundsException;
use Fhaculty\Graph\Graph;
use Fhaculty\Graph\Tests\TestCase;
use Fhaculty\Graph\Vertex;
use Fhaculty\Graph\Edge\Base as Edge;
use Fhaculty\Graph\Set\Edges;
Expand Down
2 changes: 2 additions & 0 deletions tests/Set/VerticesMapTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Fhaculty\Graph\Tests\Set;

use Fhaculty\Graph\Set\VerticesMap;

class VerticesMapTest extends BaseVerticesTest
Expand Down
2 changes: 2 additions & 0 deletions tests/Set/VerticesTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Fhaculty\Graph\Tests\Set;

use Fhaculty\Graph\Set\Vertices;
use Fhaculty\Graph\Graph;
use Fhaculty\Graph\Exception\InvalidArgumentException;
Expand Down
5 changes: 3 additions & 2 deletions tests/bootstrap.php → tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php

namespace Fhaculty\Graph\Tests;

use Fhaculty\Graph\Edge\Directed;
use Fhaculty\Graph\Edge\Base as Edge;
use Fhaculty\Graph\Graph;
use Fhaculty\Graph\Vertex;
use Fhaculty\Graph\Set\Vertices;

(include_once __DIR__ . '/../vendor/autoload.php') OR die(PHP_EOL . 'ERROR: composer autoloader not found, run "composer install" or see README for instructions' . PHP_EOL);
use PHPUnit_Framework_TestCase;

class TestCase extends PHPUnit_Framework_TestCase
{
Expand Down
3 changes: 3 additions & 0 deletions tests/VertexTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

namespace Fhaculty\Graph\Tests;

use Fhaculty\Graph\Graph;
use Fhaculty\Graph\Tests\Attribute\AbstractAttributeAwareTest;
use Fhaculty\Graph\Vertex;

class VertexTest extends AbstractAttributeAwareTest
Expand Down
2 changes: 2 additions & 0 deletions tests/WalkTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Fhaculty\Graph\Tests;

use Fhaculty\Graph\Graph;
use Fhaculty\Graph\Walk;
use Fhaculty\Graph\Algorithm\Property\WalkProperty;
Expand Down

0 comments on commit aa3d5be

Please sign in to comment.