Skip to content

Commit

Permalink
Updated structure to be more consistent and added vendor namespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjsaylor committed Feb 11, 2013
1 parent 890d0e1 commit 4b7409c
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions Samples/PizzaTest.php → examples/PizzaTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class PizzaTest extends \PHPUnit\Extensions\Mongo\TestCase {
class PizzaTest extends \Zumba\PHPUnit\Extensions\Mongo\TestCase {

const DEFAULT_DATABASE = 'mongounit_test';

Expand All @@ -20,15 +20,15 @@ public function setUp() {

public function getConnection() {
if (empty($this->connection)) {
$this->connection = new \PHPUnit\Extensions\Mongo\Client\Connector(new \MongoClient());
$this->connection = new \Zumba\PHPUnit\Extensions\Mongo\Client\Connector(new \MongoClient());
$this->connection->setDb(static::DEFAULT_DATABASE);
}
return $this->connection;
}

public function getDataSet() {
if (empty($this->dataSet)) {
$this->dataSet = new PHPUnit\Extensions\Mongo\DataSet\DataSet($this->getConnection());
$this->dataSet = new \Zumba\PHPUnit\Extensions\Mongo\DataSet\DataSet($this->getConnection());
$this->dataSet->setFixture($this->fixture);
}
return $this->dataSet;
Expand Down
14 changes: 7 additions & 7 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="./PHPUnit/Extensions/Mongo/AutoLoader.php"
bootstrap="./src/Zumba/PHPUnit/Extensions/Mongo/AutoLoader.php"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
Expand All @@ -12,21 +12,21 @@
colors="true">
<testsuites>
<testsuite name="Core Test Suite">
<directory suffix="Test.php">./Tests</directory>
<directory suffix="Test.php">./tests</directory>
</testsuite>
<testsuite name="Sample Test">
<directory suffix="Test.php">./Samples</directory>
<directory suffix="Test.php">./examples</directory>
</testsuite>
</testsuites>
<filter>
<blacklist>
<file>./PHPUnit/Extensions\Mongo\AutoLoader.php</file>
<directory>./Tests</directory>
<file>./src/Zumba/PHPUnit/Extensions/Mongo/AutoLoader.php</file>
<directory>./tests</directory>
</blacklist>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory>./PHPUnit</directory>
<directory>./src/Zumba/PHPUnit</directory>
<exclude>
<file>./PHPUnit/Extensions\Mongo\AutoLoader.php</file>
<file>./src/Zumba/PHPUnit/Extensions/Mongo/AutoLoader.php</file>
</exclude>
</whitelist>
</filter>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace PHPUnit\Extensions\Mongo;
namespace Zumba\PHPUnit\Extensions\Mongo;

spl_autoload_register(function($classname) {
$namespaces = array(
'PHPUnit' => array(dirname(dirname(dirname(__DIR__))) . '/')
'Zumba' => array(dirname(dirname(dirname(dirname(__DIR__)))) . '/')
);
$classname = ltrim($classname, '\\');
foreach ($namespaces as $ns => $paths) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace PHPUnit\Extensions\Mongo\Base;
namespace Zumba\PHPUnit\Extensions\Mongo\Base;

interface Connector {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

namespace PHPUnit\Extensions\Mongo\Client;
use PHPUnit\Extensions\Mongo\Base\Connector as BaseConnector;
namespace Zumba\PHPUnit\Extensions\Mongo\Client;
use Zumba\PHPUnit\Extensions\Mongo\Base\Connector as BaseConnector;

class Connector implements BaseConnector {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

namespace PHPUnit\Extensions\Mongo\DataSet;
use \PHPUnit\Extensions\Mongo\Client\Connector;
namespace Zumba\PHPUnit\Extensions\Mongo\DataSet;
use \Zumba\PHPUnit\Extensions\Mongo\Client\Connector;

class DataSet {

Expand All @@ -17,14 +17,14 @@ class DataSet {
/**
* Connection object.
*
* @var PHPUnit\Extensions\Mongo\Client\Connector
* @var Zumba\PHPUnit\Extensions\Mongo\Client\Connector
*/
protected $connection;

/**
* Constructor.
*
* @param PHPUnit\Extensions\Mongo\Client\Connector
* @param Zumba\PHPUnit\Extensions\Mongo\Client\Connector
*/
public function __construct(Connector $connection) {
$this->connection = $connection;
Expand All @@ -36,7 +36,7 @@ public function __construct(Connector $connection) {
* see $this->fixture
*
* @param array $data
* @return PHPUnit\Extensions\Mongo\DataSet\DataSet
* @return Zumba\PHPUnit\Extensions\Mongo\DataSet\DataSet
*/
public function setFixture(array $data) {
$this->fixture = $data;
Expand All @@ -46,7 +46,7 @@ public function setFixture(array $data) {
/**
* Drops all collections specified in the fixture keys.
*
* @return PHPUnit\Extensions\Mongo\DataSet\DataSet
* @return Zumba\PHPUnit\Extensions\Mongo\DataSet\DataSet
*/
public function dropAllCollections() {
foreach (array_keys($this->fixture) as $collection) {
Expand All @@ -58,7 +58,7 @@ public function dropAllCollections() {
/**
* Creates all collections with data from the fixture.
*
* @return PHPUnit\Extensions\Mongo\DataSet\DataSet
* @return Zumba\PHPUnit\Extensions\Mongo\DataSet\DataSet
*/
public function buildCollections() {
foreach ($this->fixture as $collection => $data) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

namespace PHPUnit\Extensions\Mongo;
use PHPUnit\Extensions\Mongo\DataSet\DataSet;
namespace Zumba\PHPUnit\Extensions\Mongo;
use \Zumba\PHPUnit\Extensions\Mongo\DataSet\DataSet;

abstract class TestCase extends \PHPUnit_Framework_TestCase {

Expand Down Expand Up @@ -34,14 +34,14 @@ public function tearDown() {
/**
* Retrieve a mongo connection client.
*
* @return PHPUnit\Extensions\Mongo\Client\Connector
* @return Zumba\PHPUnit\Extensions\Mongo\Client\Connector
*/
protected abstract function getConnection();

/**
* Retrieve a dataset object.
*
* @return PHPUnit\Extensions\Mongo\DataSet\DataSet
* @return Zumba\PHPUnit\Extensions\Mongo\DataSet\DataSet
*/
protected abstract function getDataSet();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

use PHPUnit\Extensions\Mongo\Client\Connector;
use Zumba\PHPUnit\Extensions\Mongo\Client\Connector;

class ConnectorTest extends \PHPUnit_Framework_TestCase {

public function testGeneralConnection() {
$connection = new Connector(new \MongoClient());
$connection->setDb('test');
$this->assertInstanceOf('PHPUnit\Extensions\Mongo\Client\Connector', $connection);
$this->assertInstanceOf('Zumba\PHPUnit\Extensions\Mongo\Client\Connector', $connection);
$connection->collection('test')->insert(array(
'document' => 'test document'
));
Expand Down

0 comments on commit 4b7409c

Please sign in to comment.