Skip to content

Commit

Permalink
Code Style fixed, full namespaces in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
neOk committed Nov 23, 2015
1 parent 2bc1513 commit 9791468
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 54 deletions.
36 changes: 18 additions & 18 deletions examples/PizzaTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@ class PizzaTraitTest extends \PHPUnit_Framework_TestCase {

use \Zumba\PHPUnit\Extensions\Mongo\TestTrait;

/**
* Default Database name
*/
/**
* Default Database name
*/
const DEFAULT_DATABASE = 'mongounit_test';

/**
* @var Connector
*/
/**
* @var \Zumba\PHPUnit\Extensions\Mongo\Client\Connector
*/
protected $connection;

/**
* @var DataSet
*/
/**
* @var \Zumba\PHPUnit\Extensions\Mongo\DataSet\DataSet
*/
protected $dataSet;

/**
* @var array
*/
/**
* @var array
*/
protected $fixture = [
'orders' => [
['size' => 'large', 'toppings' => ['cheese', 'ham']],
['size' => 'medium', 'toppings' => ['cheese']]
]
];

/**
* @return Connector
*/
/**
* @return \Zumba\PHPUnit\Extensions\Mongo\Client\Connector
*/
public function getMongoConnection() {
if (empty($this->connection)) {
$this->connection = new Connector(new \MongoClient());
Expand All @@ -46,9 +46,9 @@ public function getMongoConnection() {
return $this->connection;
}

/**
* @return DataSet
*/
/**
* @return \Zumba\PHPUnit\Extensions\Mongo\DataSet\DataSet
*/
public function getMongoDataSet() {
if (empty($this->dataSet)) {
$this->dataSet = new DataSet($this->getMongoConnection());
Expand Down
48 changes: 24 additions & 24 deletions src/DataSet/DataSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,49 +21,49 @@ class DataSet {
/**
* Connection object.
*
* @var Connector
* @var \Zumba\PHPUnit\Extensions\Mongo\Client\Connector
*/
protected $connection;

/**
* Constructor.
*
* @param Connector $connection
*/
/**
* Constructor.
*
* @param \Zumba\PHPUnit\Extensions\Mongo\Client\Connector $connection
*/
public function __construct(Connector $connection) {
$this->connection = $connection;
}

/**
* Sets up the fixture data.
*
* see $this->fixture
*
* @param array $data
* @return $this
*/
/**
* Sets up the fixture data.
*
* see $this->fixture
*
* @param array $data
* @return $this
*/
public function setFixture(array $data) {
$this->fixture = $data;
return $this;
}

/**
* Drops all collections specified in the fixture keys.
*
* @return $this
*/
/**
* Drops all collections specified in the fixture keys.
*
* @return $this
*/
public function dropAllCollections() {
foreach ($this->fixture as $collectionKey => $collectionData) {
$this->connection->collection($collectionKey)->drop();
}
return $this;
}

/**
* Creates all collections with data from the fixture.
*
* @return $this
*/
/**
* Creates all collections with data from the fixture.
*
* @return $this
*/
public function buildCollections() {
foreach ($this->fixture as $collection => $data) {
foreach ($data as $entry) {
Expand Down
22 changes: 10 additions & 12 deletions src/TestTrait.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php

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

/**
* Class TestTrait
Expand Down Expand Up @@ -36,18 +34,18 @@ public function mongoTearDown() {
$this->getMongoDataSet()->dropAllCollections();
}

/**
* Retrieve a mongo connection client.
*
* @return Connector
*/
/**
* Retrieve a mongo connection client.
*
* @return \Zumba\PHPUnit\Extensions\Mongo\Client\Connector
*/
protected abstract function getMongoConnection();

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

}

0 comments on commit 9791468

Please sign in to comment.