5 Commits

Author SHA1 Message Date
Emanuele Minotto
6faf449755 Include code coverage (with coveralls) 2016-07-09 12:52:30 +02:00
Emanuele Minotto
5ecca2e0e2 Force coding style 2016-07-09 12:51:59 +02:00
Emanuele Minotto
22af505cac Remove notifications 2016-07-09 12:51:30 +02:00
Emanuele Minotto
16c1bc3d3d Use travis cache 2016-07-09 12:51:14 +02:00
Emanuele Minotto
5e6144a852 Fixed coding style 2016-07-09 12:50:45 +02:00
67 changed files with 183 additions and 3745 deletions

View File

@@ -4,6 +4,10 @@ services:
- mongodb
- redis-server
cache:
directories:
- $HOME/.composer/cache
php:
- 5.5
- 5.6
@@ -15,7 +19,17 @@ before_install:
- composer self-update
install:
- composer --prefer-source install
- composer require satooshi/php-coveralls:~0.6@stable --no-update
- composer install --prefer-dist --no-interaction --no-progress
before_script:
- vendor/bin/php-cs-fixer -v fix --diff --dry-run
script:
- vendor/bin/phpunit --verbose
- vendor/bin/phpunit --verbose --coverage-text --coverage-clover=coverage.clover
after_script:
- if [[ $TRAVIS_PHP_VERSION != "5.6" && $TRAVIS_PULL_REQUEST == "false" ]]; then php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover; fi
notifications:
email: false

View File

@@ -9,7 +9,8 @@
"doctrine/couchdb": "^1.0.0-beta4",
"phpunit/phpunit": "^4.8|^5.0",
"aws/aws-sdk-php": "^3.8",
"riak/riak-client": "dev-master"
"riak/riak-client": "dev-master",
"friendsofphp/php-cs-fixer": "^1.11"
},
"suggest": {
"aws/aws-sdk-php": "to use the DynamoDB storage",
@@ -26,8 +27,7 @@
},
"autoload-dev": {
"psr-4": {
"Doctrine\\Tests\\": "tests/Doctrine/Tests",
"Doctrine\\KeyValueStore\\": "tests/Doctrine/KeyValueStore"
"Doctrine\\Tests\\": "tests/Doctrine/Tests"
}
}
}

View File

@@ -34,98 +34,88 @@ use Doctrine\KeyValueStore\Id\NullIdConverter;
class Configuration
{
/**
* @var null|MappingDriver
* @param array
*/
private $mappingDriver;
/**
* @var null|Cache
*/
private $metadataCache;
/**
* @var null|IdConverterStrategy
*/
private $idConverter;
private $config;
/**
* Get mapping driver implementation used with this configuration.
*
* @return MappingDriver
* @return \Doctrine\Common\Persistence\Mapping\Driver\MappingDriver
*/
public function getMappingDriverImpl()
{
if (! isset($this->mappingDriver)) {
if (! isset($this->config['mappingDriver'])) {
throw KeyValueStoreException::mappingDriverMissing();
}
return $this->mappingDriver;
return $this->config['mappingDriver'];
}
/**
* Set the mapping driver implementation.
*
* @param MappingDriver $driver
* @param \Doctrine\Common\Persistence\Mapping\Driver\MappingDriver $driver
*
* @return Configuration
* @return \Doctrine\KeyValueStore\Configuration
*/
public function setMappingDriverImpl(MappingDriver $driver)
{
$this->mappingDriver = $driver;
$this->config['mappingDriver'] = $driver;
return $this;
}
/**
* Set the Metadata Mapping cache used with this configuration.
*
* @param Cache $cache
* @param \Doctrine\Common\Cache\Cache $cache
*
* @return Configuration
* @return \Doctrine\KeyValueStore\Configuration
*/
public function setMetadataCache(Cache $cache)
{
$this->metadataCache = $cache;
$this->config['metadataCache'] = $cache;
return $this;
}
/**
* Get the metadata mapping cache used with this configuration.
*
* @return Cache
* @return \Doctrine\Common\Cache\Cache $cache
*/
public function getMetadataCache()
{
if (! isset($this->metadataCache)) {
$this->metadataCache = new ArrayCache();
if (! isset($this->config['metadataCache'])) {
$this->config['metadataCache'] = new ArrayCache();
}
return $this->metadataCache;
return $this->config['metadataCache'];
}
/**
* Set the ID Converter Strategy
*
* @param IdConverterStrategy $strategy
* @param \Doctrine\KeyValueStore\Id\IdConverterStrategy
*
* @return Configuration
* @return \Doctrine\KeyValueStore\Configuration
*/
public function setIdConverterStrategy(IdConverterStrategy $strategy)
{
$this->idConverter = $strategy;
$this->config['idConverter'] = $strategy;
return $this;
}
/**
* Get the Id Converter strategy
*
* @return IdConverterStrategy
* @return \Doctrine\KeyValueStore\Id\IdConverterStrategy
*/
public function getIdConverterStrategy()
{
if (! isset($this->idConverter)) {
$this->idConverter = new NullIdConverter();
if (! isset($this->config['idConverter'])) {
$this->config['idConverter'] = new NullIdConverter();
}
return $this->idConverter;
return $this->config['idConverter'];
}
}

View File

@@ -45,14 +45,14 @@ class EntityManager
* Create a new EntityManager
*
* @param Storage $storageDriver
* @param Configuration $configuration
* @param Configuration $config
*/
public function __construct(Storage $storageDriver, Configuration $configuration)
public function __construct(Storage $storageDriver, Configuration $config)
{
$classMetadataFactory = new ClassMetadataFactory($configuration->getMappingDriverImpl());
$classMetadataFactory->setCacheDriver($configuration->getMetadataCache());
$cmf = new ClassMetadataFactory($config->getMappingDriverImpl());
$cmf->setCacheDriver($config->getMetadataCache());
$this->unitOfWork = new UnitOfWork($classMetadataFactory, $storageDriver, $configuration);
$this->unitOfWork = new UnitOfWork($cmf, $storageDriver, $config);
$this->storageDriver = $storageDriver;
}
@@ -79,7 +79,7 @@ class EntityManager
* @param string $className
* @param string $partitionKey
*
* @return RangeQuery
* @return \Doctrine\KeyValueStore\Query\RangeQuery
*/
public function createRangeQuery($className, $partitionKey)
{
@@ -124,16 +124,13 @@ class EntityManager
}
/**
* @return UnitOfWork
* @return \Doctrine\KeyValueStore\UnitOfWork
*/
public function getUnitOfWork()
{
return $this->unitOfWork;
}
/**
* @see UnitOfWork::clear()
*/
public function clear()
{
return $this->unitOfWork->clear();

View File

@@ -21,50 +21,35 @@
namespace Doctrine\KeyValueStore\Id;
use Doctrine\KeyValueStore\Mapping\ClassMetadata;
use InvalidArgumentException;
class CompositeIdHandler implements IdHandlingStrategy
{
/**
* {@inheritDoc}
*/
public function normalizeId(ClassMetadata $metadata, $key)
{
if (! $metadata->isCompositeKey && ! is_array($key)) {
return [
$metadata->identifier[0] => $key,
];
}
if (! is_array($key)) {
throw new InvalidArgumentException('Array of identifier key-value pairs is expected!');
}
$id = [];
foreach ($metadata->identifier as $field) {
if (! isset($key[$field])) {
throw new InvalidArgumentException(
sprintf('Missing identifier field %s in request for the primary key.', $field)
);
$id = [$metadata->identifier[0] => $key];
} elseif (! is_array($key)) {
throw new \InvalidArgumentException('Array of identifier key-value pairs is expected!');
} else {
$id = [];
foreach ($metadata->identifier as $field) {
if (! isset($key[$field])) {
throw new \InvalidArgumentException(
"Missing identifier field $field in request for the primary key."
);
}
$id[$field] = $key[$field];
}
$id[$field] = $key[$field];
}
return $id;
}
/**
* {@inheritDoc}
*/
public function getIdentifier(ClassMetadata $metadata, $object)
{
return $metadata->getIdentifierValues($object);
}
/**
* {@inheritDoc}
*/
public function hash($key)
{
return implode('__##__', (array) $key);

View File

@@ -31,23 +31,6 @@ namespace Doctrine\KeyValueStore\Id;
*/
interface IdConverterStrategy
{
/**
* Serialize data for the persistence.
*
* @param string $class
* @param mixed $data
*
* @return string
*/
public function serialize($class, $data);
/**
* Unserialize data from the persistence system.
*
* @param string $class
* @param mixed $data
*
* @return mixed
*/
public function unserialize($class, $data);
}

View File

@@ -22,17 +22,11 @@ namespace Doctrine\KeyValueStore\Id;
class NullIdConverter implements IdConverterStrategy
{
/**
* {@inheritDoc}
*/
public function serialize($class, $data)
{
return $data;
}
/**
* {@inheritDoc}
*/
public function unserialize($class, $data)
{
return $data;

View File

@@ -24,9 +24,6 @@ use Doctrine\KeyValueStore\Mapping\ClassMetadata;
class SingleIdHandler implements IdHandlingStrategy
{
/**
* {@inheritDoc}
*/
public function normalizeId(ClassMetadata $metadata, $key)
{
if (is_scalar($key)) {
@@ -37,18 +34,12 @@ class SingleIdHandler implements IdHandlingStrategy
}
}
/**
* {@inheritDoc}
*/
public function getIdentifier(ClassMetadata $metadata, $object)
{
$values = $metadata->getIdentifierValues($object);
return $values[$metadata->identifier[0]];
}
/**
* {@inheritDoc}
*/
public function hash($key)
{
return $key;

View File

@@ -21,12 +21,8 @@
namespace Doctrine\KeyValueStore\Mapping;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Persistence\Mapping\ClassMetadata as CommonClassMetadata;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\KeyValueStore\Mapping\Annotations\Entity;
use Doctrine\KeyValueStore\Mapping\Annotations\Id;
use Doctrine\KeyValueStore\Mapping\Annotations\Transient;
use ReflectionClass;
class AnnotationDriver implements MappingDriver
{
@@ -50,19 +46,19 @@ class AnnotationDriver implements MappingDriver
/**
* Loads the metadata for the specified class into the provided container.
*
* @param string $className
* @param CommonClassMetadata $metadata
* @param string $className
* @param ClassMetadata $metadata
*/
public function loadMetadataForClass($className, CommonClassMetadata $metadata)
public function loadMetadataForClass($className, ClassMetadata $metadata)
{
$class = $metadata->getReflectionClass();
if (! $class) {
// this happens when running annotation driver in combination with
// static reflection services. This is not the nicest fix
$class = new ReflectionClass($metadata->name);
$class = new \ReflectionClass($metadata->name);
}
$entityAnnot = $this->reader->getClassAnnotation($class, Entity::class);
$entityAnnot = $this->reader->getClassAnnotation($class, 'Doctrine\KeyValueStore\Mapping\Annotations\Entity');
if (! $entityAnnot) {
throw new \InvalidArgumentException($metadata->name . ' is not a valid key-value-store entity.');
}
@@ -70,26 +66,21 @@ class AnnotationDriver implements MappingDriver
// Evaluate annotations on properties/fields
foreach ($class->getProperties() as $property) {
$idAnnot = $this->reader->getPropertyAnnotation($property, Id::class);
$idAnnot = $this->reader->getPropertyAnnotation(
$property,
'Doctrine\KeyValueStore\Mapping\Annotations\Id'
);
$transientAnnot = $this->reader->getPropertyAnnotation(
$property,
'Doctrine\KeyValueStore\Mapping\Annotations\Transient'
);
if ($idAnnot) {
$metadata->mapIdentifier($property->getName());
// if it's an identifier, can't be also a transient
// nor a mapped field
continue;
}
$transientAnnot = $this->reader->getPropertyAnnotation($property, Transient::class);
if ($transientAnnot) {
} elseif ($transientAnnot) {
$metadata->skipTransientField($property->getName());
// if it's a transiend, can't be also a mapped field
continue;
} else {
$metadata->mapField(['fieldName' => $property->getName()]);
}
$metadata->mapField([
'fieldName' => $property->getName(),
]);
}
}
@@ -100,7 +91,6 @@ class AnnotationDriver implements MappingDriver
*/
public function getAllClassNames()
{
return [];
}
/**

View File

@@ -25,91 +25,37 @@ use ReflectionClass;
class ClassMetadata implements BaseClassMetadata
{
/**
* @var string
*/
public $name;
/**
* @var string
*/
public $storageName;
/**
* @var array
*/
public $fields = [];
/**
* @var array
*/
public $identifier = [];
/**
* @var bool
*/
public $isCompositeKey = false;
/**
* @var array
*/
public $rootClassName;
public $fields = [];
public $identifier = [];
public $isCompositeKey = false;
public $transientFields = [];
public $reflFields = [];
public $reflClass;
/**
* @var array
*/
public $reflFields = [];
/**
* @var null|mixed
*/
private $prototype;
/**
* @param string|object $class
*/
public function __construct($class)
public function __construct($className)
{
if (is_object($class)) {
$reflectionClass = new ReflectionClass($class);
$class = $reflectionClass->getName();
}
$this->name = $class;
$this->name = $className;
}
/**
* Add a mapped identifier.
*
* @param string $fieldName
*/
public function mapIdentifier($fieldName)
{
$this->identifier[] = $fieldName;
$this->isCompositeKey = count($this->identifier) > 1;
$this->mapField([
'fieldName' => $fieldName,
'id' => true,
]);
$this->mapField(['fieldName' => $fieldName, 'id' => true]);
}
/**
* Add a mapped field.
*
* @param array $mapping
*/
public function mapField(array $mapping)
public function mapField($mapping)
{
if (! isset($this->transientFields[$mapping['fieldName']])) {
$this->fields[$mapping['fieldName']] = $mapping;
}
}
/**
* Add a transient field.
*
* @param string $fieldName
*/
public function skipTransientField($fieldName)
{
// it's necessary to unset because ClassMetadataFactory::initializeReflection has already run
@@ -132,29 +78,21 @@ class ClassMetadata implements BaseClassMetadata
return clone $this->prototype;
}
/**
* @return array
*/
public function __sleep()
{
return ['fields', 'isCompositeKey', 'identifier', 'name', 'storageName'];
}
/**
* Get identifiers values.
*
* @param object $object
*
* @return array
*/
public function getIdentifierValues($object)
{
$instance = $object ?: $this->newInstance();
return array_intersect_key(
get_object_vars($instance),
array_flip($this->identifier)
);
$id = [];
foreach ($this->identifier as $field) {
$value = $this->reflFields[$field]->getValue($object);
if ($value !== null) {
$id[$field] = $value;
}
}
return $id;
}
/**

View File

@@ -21,9 +21,10 @@
namespace Doctrine\KeyValueStore\Mapping;
use Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory;
use Doctrine\Common\Persistence\Mapping\ClassMetadata as CommonClassMetadata;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Common\Persistence\Mapping\ReflectionService;
use Doctrine\KeyValueStore\Mapping\ClassMetadata as KeyValueMetadata;
/**
* Load Metadata of an entity.
@@ -32,29 +33,17 @@ use Doctrine\Common\Persistence\Mapping\ReflectionService;
*/
class ClassMetadataFactory extends AbstractClassMetadataFactory
{
/**
* @var MappingDriver
*/
private $mappingDriver;
/**
* @param MappingDriver $driver
*/
public function __construct(MappingDriver $driver)
{
$this->mappingDriver = $driver;
}
/**
* {@inheritDoc}
*/
protected function initialize()
{
}
/**
* {@inheritDoc}
*/
protected function getFqcnFromAlias($namespaceAlias, $simpleClassName)
{
throw new \InvalidArgumentException('aliasing is not supported.');
@@ -79,26 +68,17 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
}
}
/**
* {@inheritDoc}
*/
protected function newClassMetadataInstance($className)
{
return new ClassMetadata($className);
return new KeyValueMetadata($className);
}
/**
* {@inheritDoc}
*/
protected function getDriver()
{
return $this->mappingDriver;
}
/**
* {@inheritDoc}
*/
protected function wakeupReflection(CommonClassMetadata $class, ReflectionService $reflService)
protected function wakeupReflection(ClassMetadata $class, ReflectionService $reflService)
{
$class->reflClass = $reflService->getClass($class->name);
foreach ($class->fields as $fieldName => $mapping) {
@@ -106,28 +86,20 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
}
}
/**
* {@inheritDoc}
*/
protected function initializeReflection(CommonClassMetadata $class, ReflectionService $reflService)
protected function initializeReflection(ClassMetadata $class, ReflectionService $reflService)
{
$class->reflClass = $reflService->getClass($class->name);
if (! $class->reflClass) {
return;
}
foreach ($class->reflClass->getProperties() as $property) {
$class->mapField([
'fieldName' => $property->getName(),
]);
if ($class->reflClass) {
foreach ($class->reflClass->getProperties() as $property) {
$class->mapField(['fieldName' => $property->getName()]);
}
}
}
/**
* {@inheritDoc}
* copied from doctrine/common - tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php
*/
protected function isEntity(CommonClassMetadata $class)
protected function isEntity(ClassMetadata $class)
{
return true;
}

View File

@@ -23,8 +23,6 @@ namespace Doctrine\KeyValueStore\Mapping;
use Doctrine\Common\Persistence\Mapping\ClassMetadata as CommonClassMetadata;
use Doctrine\Common\Persistence\Mapping\Driver\FileDriver;
use Doctrine\Common\Persistence\Mapping\MappingException;
use InvalidArgumentException;
use ReflectionClass;
class XmlDriver extends FileDriver
{
@@ -72,14 +70,14 @@ class XmlDriver extends FileDriver
try {
$xmlRoot = $this->getElement($className);
} catch (MappingException $exception) {
throw new InvalidArgumentException($metadata->name . ' is not a valid key-value-store entity.');
throw new \InvalidArgumentException($metadata->name . ' is not a valid key-value-store entity.');
}
if ($xmlRoot->getName() != 'entity') {
throw new InvalidArgumentException($metadata->name . ' is not a valid key-value-store entity.');
throw new \InvalidArgumentException($metadata->name . ' is not a valid key-value-store entity.');
}
$class = new ReflectionClass($className);
$class = new \ReflectionClass($className);
if (isset($xmlRoot['storage-name'])) {
$metadata->storageName = $xmlRoot['storage-name'];

View File

@@ -73,11 +73,6 @@ class RangeQuery
*/
protected $em;
/**
* @param EntityManager $em
* @param string $className
* @param string $partitionKey
*/
public function __construct(EntityManager $em, $className, $partitionKey)
{
$this->em = $em;
@@ -85,33 +80,21 @@ class RangeQuery
$this->partitionKey = $partitionKey;
}
/**
* Set query limit.
*
* @param int $limit
*
* @return RangeQuery
*/
public function setLimit($limit)
{
$this->limit = $limit;
return $this;
}
/**
* Get query results limit.
*
* @return int
*/
public function getLimit()
{
return $this->limit;
}
/**
* Get class name.
* Get className.
*
* @return string
* @return className.
*/
public function getClassName()
{
@@ -119,9 +102,9 @@ class RangeQuery
}
/**
* Get partition key.
* Get partitionKey.
*
* @return string
* @return partitionKey.
*/
public function getPartitionKey()
{

View File

@@ -36,13 +36,10 @@ use WindowsAzure\Table\TableRestProxy;
class AzureSdkTableStorage implements Storage, RangeQueryStorage
{
/**
* @var TableRestProxy
* @var \WindowsAzure\Table\TableRestProxy
*/
private $client;
/**
* @param TableRestProxy $client
*/
public function __construct(TableRestProxy $client)
{
$this->client = $client;
@@ -154,11 +151,6 @@ class AzureSdkTableStorage implements Storage, RangeQueryStorage
return $this->getProperties($result->getEntity());
}
/**
* @param Entity $entity
*
* @return array
*/
private function getProperties(Entity $entity)
{
$properties = [];
@@ -213,11 +205,6 @@ class AzureSdkTableStorage implements Storage, RangeQueryStorage
return $rows;
}
/**
* @param string $value
*
* @return string
*/
private function quoteFilterValue($value)
{
return "'" . str_replace("'", '', $value) . "'";
@@ -229,7 +216,7 @@ class AzureSdkTableStorage implements Storage, RangeQueryStorage
* @param array $key
* @param array $data
*
* @return Entity
* @return \WindowsAzure\Table\Model\Entity
*/
private function createEntity(array $key, array $data)
{
@@ -249,10 +236,6 @@ class AzureSdkTableStorage implements Storage, RangeQueryStorage
/**
* Infer the property type of variables.
*
* @param mixed $propertyValue
*
* @return string
*/
private function getPropertyType($propertyValue)
{

View File

@@ -34,13 +34,10 @@ use Doctrine\KeyValueStore\NotFoundException;
class CassandraStorage implements Storage
{
/**
* @var Session
* @var \Cassandra\Session
*/
private $session;
/**
* @param Session $session
*/
public function __construct(Session $session)
{
$this->session = $session;

View File

@@ -20,7 +20,6 @@
namespace Doctrine\KeyValueStore\Storage;
use Couchbase;
use Doctrine\KeyValueStore\NotFoundException;
/**
@@ -29,16 +28,16 @@ use Doctrine\KeyValueStore\NotFoundException;
class CouchbaseStorage implements Storage
{
/**
* @var Couchbase
* @var \Couchbase
*/
protected $client;
/**
* Constructor
*
* @param Couchbase $couchbase
* @param \Couchbase $couchbase
*/
public function __construct(Couchbase $couchbase)
public function __construct(\Couchbase $couchbase)
{
$this->client = $couchbase;
}

View File

@@ -32,32 +32,11 @@ use Doctrine\KeyValueStore\NotFoundException;
*/
class DBALStorage implements Storage
{
/**
* @var Connection
*/
private $conn;
/**
* @var string
*/
private $table;
/**
* @var string
*/
private $keyColumn;
/**
* @var string
*/
private $dataColumn;
/**
* @param Connection $conn
* @param string $table
* @param string $keyColumn
* @param string $dataColumn
*/
public function __construct(
Connection $conn,
$table = 'storage',
@@ -70,16 +49,15 @@ class DBALStorage implements Storage
$this->dataColumn = $dataColumn;
}
/**
* {@inheritDoc}
*/
public function supportsPartialUpdates()
{
return false;
}
/**
* {@inheritDoc}
* Does this storage support composite primary keys?
*
* @return bool
*/
public function supportsCompositePrimaryKeys()
{
@@ -87,7 +65,9 @@ class DBALStorage implements Storage
}
/**
* {@inheritDoc}
* Does this storage require composite primary keys?
*
* @return bool
*/
public function requiresCompositePrimaryKeys()
{
@@ -95,7 +75,10 @@ class DBALStorage implements Storage
}
/**
* {@inheritDoc}
* Insert data into the storage key specified.
*
* @param array|string $key
* @param array $data
*/
public function insert($storageName, $key, array $data)
{
@@ -109,7 +92,10 @@ class DBALStorage implements Storage
}
/**
* {@inheritDoc}
* Update data into the given key.
*
* @param array|string $key
* @param array $data
*/
public function update($storageName, $key, array $data)
{
@@ -124,7 +110,9 @@ class DBALStorage implements Storage
}
/**
* {@inheritDoc}
* Delete data at key
*
* @param array|string $key
*/
public function delete($storageName, $key)
{
@@ -135,7 +123,11 @@ class DBALStorage implements Storage
}
/**
* {@inheritDoc}
* Find data at key
*
* @param array|string $key
*
* @return array
*/
public function find($storageName, $key)
{
@@ -158,7 +150,9 @@ class DBALStorage implements Storage
}
/**
* {@inheritDoc}
* Return a name of the underlying storage.
*
* @return string
*/
public function getName()
{

View File

@@ -33,55 +33,33 @@ use Doctrine\Common\Cache\Cache;
class DoctrineCacheStorage implements Storage
{
/**
* @var Cache
* @var Doctrine\Common\Cache\Cache
*/
private $cache;
/**
* @var bool
*/
private $supportsCompositeKeys;
/**
* @param Cache $cache
* @param bool $supportsCompositeKeys
*/
public function __construct(Cache $cache, $supportsCompositeKeys = true)
{
$this->cache = $cache;
$this->supportsCompositeKeys = $supportsCompositeKeys;
}
/**
* {@inheritDoc}
*/
public function supportsPartialUpdates()
{
return false;
}
/**
* {@inheritDoc}
*/
public function supportsCompositePrimaryKeys()
{
return $this->supportsCompositeKeys;
}
/**
* {@inheritDoc}
*/
public function requiresCompositePrimaryKeys()
{
return false;
}
/**
* @param string $storageName
* @param array|string $key
*
* @return string
*/
private function flattenKey($storageName, $key)
{
if (! $this->supportsCompositeKeys) {
@@ -96,45 +74,30 @@ class DoctrineCacheStorage implements Storage
return $hash;
}
/**
* {@inheritDoc}
*/
public function insert($storageName, $key, array $data)
{
$key = $this->flattenKey($storageName, $key);
$this->cache->save($key, $data);
}
/**
* {@inheritDoc}
*/
public function update($storageName, $key, array $data)
{
$key = $this->flattenKey($storageName, $key);
$this->cache->save($key, $data);
}
/**
* {@inheritDoc}
*/
public function delete($storageName, $key)
{
$key = $this->flattenKey($storageName, $key);
$this->cache->delete($key);
}
/**
* {@inheritDoc}
*/
public function find($storageName, $key)
{
$key = $this->flattenKey($storageName, $key);
return $this->cache->fetch($key);
}
/**
* {@inheritDoc}
*/
public function getName()
{
return 'doctrine_cache';

View File

@@ -290,7 +290,9 @@ class DynamoDbStorage implements Storage
}
/**
* {@inheritDoc}
* Return a name of the underlying storage.
*
* @return string
*/
public function getName()
{

View File

@@ -21,8 +21,6 @@
namespace Doctrine\KeyValueStore\Storage;
use Doctrine\KeyValueStore\NotFoundException;
use Mongo;
use RuntimeException;
/**
* MongoDb storage
@@ -32,7 +30,7 @@ use RuntimeException;
class MongoDbStorage implements Storage
{
/**
* @var Mongo
* @var \Mongo
*/
protected $mongo;
@@ -49,10 +47,10 @@ class MongoDbStorage implements Storage
/**
* Constructor
*
* @param Mongo $mongo
* @param array $dbOptions
* @param \Mongo $mongo
* @param array $dbOptions
*/
public function __construct(Mongo $mongo, array $dbOptions = [])
public function __construct(\Mongo $mongo, array $dbOptions = [])
{
$this->mongo = $mongo;
$this->dbOptions = array_merge([
@@ -64,7 +62,7 @@ class MongoDbStorage implements Storage
/**
* Initialize the mongodb collection
*
* @throws RuntimeException
* @throws \RuntimeException
*/
public function initialize()
{
@@ -73,10 +71,10 @@ class MongoDbStorage implements Storage
}
if (empty($this->dbOptions['database'])) {
throw new RuntimeException('The option "database" must be set');
throw new \RuntimeException('The option "database" must be set');
}
if (empty($this->dbOptions['collection'])) {
throw new RuntimeException('The option "collection" must be set');
throw new \RuntimeException('The option "collection" must be set');
}
$this->collection = $this
@@ -166,7 +164,9 @@ class MongoDbStorage implements Storage
}
/**
* {@inheritDoc}
* Return a name of the underlying storage.
*
* @return string
*/
public function getName()
{

View File

@@ -21,7 +21,6 @@
namespace Doctrine\KeyValueStore\Storage;
use Doctrine\KeyValueStore\NotFoundException;
use Redis;
/**
* @author Marcel Araujo <admin@marcelaraujo.me>
@@ -29,7 +28,7 @@ use Redis;
class RedisStorage implements Storage
{
/**
* @var Redis
* @var \Redis
*/
protected $client;
@@ -48,10 +47,10 @@ class RedisStorage implements Storage
/**
* Constructor
*
* @param Redis $redis
* @param array $dbOptions
* @param \Redis $redis
* @param array $dbOptions
*/
public function __construct(Redis $redis, $dbOptions = [])
public function __construct($redis, $dbOptions = [])
{
$this->client = $redis;
@@ -127,7 +126,9 @@ class RedisStorage implements Storage
}
/**
* {@inheritDoc}
* Return a name of the underlying storage.
*
* @return string
*/
public function getName()
{

View File

@@ -29,12 +29,15 @@ use Riak\Client;
class RiakStorage implements Storage
{
/**
* @var Client
* @var \Riak\Client
*/
protected $client;
/**
* @param Client $riak
* Constructor
*
* @param \Riak\Client $riak
* @param string $bucketName
*/
public function __construct(Client $riak)
{

View File

@@ -34,12 +34,14 @@ use Doctrine\KeyValueStore\NotFoundException;
class SimpleDbStorage implements Storage
{
/**
* @var SimpleDbClient
* @var \Aws\SimpleDb\SimpleDbClient
*/
protected $client;
/**
* @param SimpleDbClient $client
* Constructor
*
* @param \Aws\SimpleDb\SimpleDbClient $client
*/
public function __construct(SimpleDbClient $client)
{
@@ -132,7 +134,9 @@ class SimpleDbStorage implements Storage
}
/**
* {@inheritDoc}
* Return a name of the underlying storage.
*
* @return string
*/
public function getName()
{
@@ -141,8 +145,6 @@ class SimpleDbStorage implements Storage
/**
* @param string $tableName
*
* @return string
*/
protected function createDomain($domainName)
{
@@ -160,9 +162,8 @@ class SimpleDbStorage implements Storage
}
/**
* @param array $data
*
* @return array
* @param string $key
* @param array $data
*/
protected function makeAttributes($data)
{

View File

@@ -183,7 +183,7 @@ class WindowsAzureTableStorage implements Storage, RangeQueryStorage
$tableNode->appendChild($dom->createTextNode($tableName));
$xml = $dom->saveXML();
$url = $this->baseUrl . '/Tables';
$url = $this->baseUrl . '/Tables';
$response = $this->request('POST', $url, $xml, $headers);
if ($response->getStatusCode() != 201) {

View File

@@ -36,12 +36,10 @@ class UnitOfWork
* @var ClassMetadataFactory
*/
private $cmf;
/**
* @var Storage
*/
private $storageDriver;
/**
* @var IdHandlingStrategy
*/
@@ -55,38 +53,14 @@ class UnitOfWork
*
* @var array
*/
private $identifiers = [];
private $identifiers;
/**
* @var array
*/
private $originalData = [];
/**
* @var array
*/
private $originalData;
private $scheduledInsertions = [];
/**
* @var array
*/
private $scheduledDeletions = [];
/**
* @var array
*/
private $identityMap = [];
/**
* @var \Doctrine\KeyValueStore\Id\IdConverterStrategy
*/
private $idConverter;
/**
* @param ClassMetadataFactory $cmf
* @param Storage $storageDriver
* @param Configuration|null $config
*/
public function __construct(ClassMetadataFactory $cmf, Storage $storageDriver, Configuration $config = null)
{
$this->cmf = $cmf;
@@ -97,22 +71,11 @@ class UnitOfWork
new Id\SingleIdHandler();
}
/**
* @param string $className
*
* @return \Doctrine\Common\Persistence\Mapping\ClassMetadata
*/
public function getClassMetadata($className)
{
return $this->cmf->getMetadataFor($className);
}
/**
* @param string $className
* @param mixed $id
*
* @return null|string|array
*/
private function tryGetById($className, $id)
{
$idHash = $this->idHandler->hash($id);
@@ -122,14 +85,6 @@ class UnitOfWork
return;
}
/**
* @param string $className
* @param string|array $key
*
* @throws NotFoundException
*
* @return mixed
*/
public function reconstititute($className, $key)
{
$class = $this->cmf->getMetadataFor($className);
@@ -329,9 +284,6 @@ class UnitOfWork
$this->scheduledDeletions = [];
}
/**
* Clear the unit of work.
*/
public function clear()
{
$this->scheduledInsertions = [];

View File

@@ -2,7 +2,7 @@
<phpunit bootstrap="tests/bootstrap.php" colors="true">
<testsuites>
<testsuite name="Doctrine KeyValueStore">
<directory suffix="Test.php">tests/Doctrine</directory>
<directory suffix="Test.php">tests/Doctrine/Tests/KeyValueStore</directory>
</testsuite>
</testsuites>

View File

@@ -1,123 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore;
use Doctrine\Common\Cache\Cache;
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\KeyValueStore\Id\IdConverterStrategy;
use PHPUnit_Framework_TestCase;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Configuration
*/
class ConfigurationTest extends PHPUnit_Framework_TestCase
{
/**
* @var Configuration
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new Configuration;
}
/**
* @covers ::getMappingDriverImpl
* @expectedException \Doctrine\KeyValueStore\KeyValueStoreException
*/
public function testGetMappingDriverImpl()
{
$this->assertInstanceOf(
MappingDriver::class,
$this->object->getMappingDriverImpl()
);
}
/**
* @covers ::getMappingDriverImpl
* @covers ::setMappingDriverImpl
* @depends testGetMappingDriverImpl
*/
public function testSetMappingDriverImpl()
{
$mappingDriver = $this->getMock(MappingDriver::class);
$setterOutput = $this->object->setMappingDriverImpl($mappingDriver);
$this->assertInstanceOf(Configuration::class, $setterOutput);
$this->assertInstanceOf(MappingDriver::class, $this->object->getMappingDriverImpl());
}
/**
* @covers ::getMetadataCache
*/
public function testGetMetadataCache()
{
$this->assertInstanceOf(
Cache::class,
$this->object->getMetadataCache()
);
}
/**
* @covers ::setMetadataCache
* @depends testGetMetadataCache
*/
public function testSetMetadataCache()
{
$cache = $this->getMock(Cache::class);
$setterOutput = $this->object->setMetadataCache($cache);
$this->assertInstanceOf(Configuration::class, $setterOutput);
$this->assertSame($cache, $this->object->getMetadataCache());
}
/**
* @covers ::getIdConverterStrategy
*/
public function testGetIdConverterStrategy()
{
$this->assertInstanceOf(
IdConverterStrategy::class,
$this->object->getIdConverterStrategy()
);
}
/**
* @covers ::setIdConverterStrategy
* @depends testGetIdConverterStrategy
*/
public function testSetIdConverterStrategy()
{
$idConverterStrategy = $this->getMock(IdConverterStrategy::class);
$setterOutput = $this->object->setIdConverterStrategy($idConverterStrategy);
$this->assertInstanceOf(Configuration::class, $setterOutput);
$this->assertSame($idConverterStrategy, $this->object->getIdConverterStrategy());
}
}

View File

@@ -1,175 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore;
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\KeyValueStore\Storage\Storage;
use PHPUnit_Framework_TestCase;
use ReflectionClass;
/**
* @coversDefaultClass Doctrine\KeyValueStore\EntityManager
*/
class EntityManagerTest extends PHPUnit_Framework_TestCase
{
/**
* @var Storage
*/
private $storage;
/**
* @var EntityManager
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->storage = $this->getMock(Storage::class);
$configuration = $this->getMock(Configuration::class);
$configuration
->method('getMappingDriverImpl')
->willReturn($this->getMock(MappingDriver::class));
$this->object = new EntityManager($this->storage, $configuration);
}
/**
* @covers ::find
*
* @todo Implement testFind().
*/
public function testFind()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::createRangeQuery
*
* @todo Implement testCreateRangeQuery().
*/
public function testCreateRangeQuery()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::persist
*
* @todo Implement testPersist().
*/
public function testPersist()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::remove
*
* @todo Implement testRemove().
*/
public function testRemove()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::flush
*
* @todo Implement testFlush().
*/
public function testFlush()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::unwrap
*/
public function testUnwrap()
{
$this->assertSame(
$this->storage,
$this->object->unwrap()
);
}
/**
* @covers ::getUnitOfWork
*/
public function testGetUnitOfWork()
{
$this->assertInstanceOf(
UnitOfWork::class,
$this->object->getUnitOfWork()
);
}
/**
* @covers ::clear
*/
public function testClear()
{
$this->object->clear();
$clearedKeys = [
'scheduledInsertions',
'scheduledDeletions',
'identifiers',
'originalData',
'identityMap',
];
$unitOfWork = $this->object->getUnitOfWork();
$reflectionClass = new ReflectionClass($unitOfWork);
foreach ($clearedKeys as $clearedKey) {
$property = $reflectionClass->getProperty($clearedKey);
$property->setAccessible(true);
$value = $property->getValue($unitOfWork);
$this->assertInternalType('array', $value);
$this->assertEmpty($value);
}
}
/**
* @covers ::getClassMetadata
*
* @todo Implement testGetClassMetadata().
*/
public function testGetClassMetadata()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
}

View File

@@ -1,148 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Id;
use Doctrine\KeyValueStore\Mapping\ClassMetadata;
use InvalidArgumentException;
use PHPUnit_Framework_TestCase;
use stdClass;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Id\CompositeIdHandler
*/
class CompositeIdHandlerTest extends PHPUnit_Framework_TestCase
{
/**
* @var CompositeIdHandler
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new CompositeIdHandler;
}
/**
* @covers ::normalizeId
*/
public function testNormalizeId()
{
$classMetadata = $this
->getMockBuilder(ClassMetadata::class)
->disableOriginalConstructor()
->getMock();
$classMetadata->isCompositeKey = false;
$classMetadata->identifier = ['id'];
$key = 'test';
$normalizedId = $this->object->normalizeId($classMetadata, $key);
$this->assertSame(['id' => $key], $normalizedId);
$key = ['id' => 'bar'];
$normalizedId = $this->object->normalizeId($classMetadata, $key);
$this->assertSame($key, $normalizedId);
}
/**
* @covers ::normalizeId
*/
public function testWrongNormalizeId()
{
$classMetadata = $this
->getMockBuilder(ClassMetadata::class)
->disableOriginalConstructor()
->getMock();
$classMetadata->isCompositeKey = true;
$classMetadata->identifier = ['id'];
$this->setExpectedException(InvalidArgumentException::class);
$this->object->normalizeId($classMetadata, 'test');
$classMetadata->isCompositeKey = false;
$classMetadata->identifier = ['id'];
$key = ['foo' => 'bar'];
$this->setExpectedException(InvalidArgumentException::class);
$this->object->normalizeId($classMetadata, $key);
}
/**
* @covers ::getIdentifier
*/
public function testGetIdentifier()
{
$data = rand();
$metadata = $this
->getMockBuilder(ClassMetadata::class)
->disableOriginalConstructor()
->getMock();
$object = new stdClass;
$metadata->identifier = ['id'];
$metadata
->expects($this->once())
->method('getIdentifierValues')
->with($this->equalTo($object))
->willReturn($data);
$identifier = $this->object->getIdentifier($metadata, $object);
$this->assertSame($data, $identifier);
}
/**
* @covers ::hash
* @dataProvider keysProvider
*/
public function testHash($key, $expected)
{
$this->assertSame(
$expected,
$this->object->hash($key)
);
}
/**
* @return array
*/
public function keysProvider()
{
$stdClass = new stdClass;
$stdClass->foo = 'bar';
$stdClass->bar = 'foo';
return [
[['foo', 'bar'], 'foo__##__bar'],
[$stdClass, 'bar__##__foo'],
['bar', 'bar'],
];
}
}

View File

@@ -1,69 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Id;
use PHPUnit_Framework_TestCase;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Id\NullIdConverter
*/
class NullIdConverterTest extends PHPUnit_Framework_TestCase
{
/**
* @var NullIdConverter
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new NullIdConverter;
}
/**
* @covers ::serialize
*/
public function testSerialize()
{
$data = rand();
$this->assertSame(
$data,
$this->object->serialize(rand(), $data)
);
}
/**
* @covers ::unserialize
*/
public function testUnserialize()
{
$data = rand();
$this->assertSame(
$data,
$this->object->unserialize(rand(), $data)
);
}
}

View File

@@ -1,109 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Id;
use Doctrine\KeyValueStore\Mapping\ClassMetadata;
use PHPUnit_Framework_TestCase;
use stdClass;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Id\SingleIdHandler
*/
class SingleIdHandlerTest extends PHPUnit_Framework_TestCase
{
/**
* @var SingleIdHandler
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new SingleIdHandler;
}
/**
* @covers ::normalizeId
*/
public function testNormalizeId()
{
$metadata = $this
->getMockBuilder(ClassMetadata::class)
->disableOriginalConstructor()
->getMock();
$key = rand();
$normalizedId = $this->object->normalizeId($metadata, $key);
$this->assertSame($key, $normalizedId);
$metadata->identifier = ['id'];
$key = [
'id' => rand(),
];
$normalizedId = $this->object->normalizeId($metadata, $key);
$this->assertSame($key['id'], $normalizedId);
}
/**
* @covers ::getIdentifier
*/
public function testGetIdentifier()
{
$data = rand();
$metadata = $this
->getMockBuilder(ClassMetadata::class)
->disableOriginalConstructor()
->getMock();
$object = new stdClass;
$metadata->identifier = ['id'];
$metadata
->expects($this->once())
->method('getIdentifierValues')
->with($this->equalTo($object))
->willReturn([
'id' => $data,
]);
$identifier = $this->object->getIdentifier($metadata, $object);
$this->assertSame($data, $identifier);
}
/**
* @covers ::hash
*/
public function testHash()
{
$key = rand();
$this->assertSame(
$key,
$this->object->hash($key)
);
}
}

View File

@@ -1,115 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Mapping;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Persistence\Mapping\ClassMetadata as CommonClassMetadata;
use PHPUnit_Framework_TestCase;
use ReflectionClass;
use stdClass;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Mapping\AnnotationDriver
*/
class AnnotationDriverTest extends PHPUnit_Framework_TestCase
{
/**
* @var AnnotationReader
*/
private $annotationReader;
/**
* @var AnnotationDriver
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->annotationReader = $this->getMock(AnnotationReader::class);
$this->object = new AnnotationDriver($this->annotationReader);
}
/**
* @covers ::loadMetadataForClass
*/
public function testLoadMetadataForClass()
{
$storageName = sha1(rand());
$reflectionClass = $this
->getMockBuilder(ReflectionClass::class)
->disableOriginalConstructor()
->getMock();
$classAnnotation = $this->getMock(stdClass::class);
$classAnnotation->storageName = $storageName;
$metadata = $this->getMock(CommonClassMetadata::class);
$metadata
->method('getReflectionClass')
->willReturn($reflectionClass);
$this->annotationReader
->method('getClassAnnotation')
->willReturn($classAnnotation);
$reflectionClass
->method('getProperties')
->willReturn([]);
$this->object->loadMetadataForClass(sha1(rand()), $metadata);
}
/**
* @covers ::loadMetadataForClass
* @expectedException InvalidArgumentException
*/
public function testWrongLoadMetadataForClass()
{
$metadata = $this->getMock(CommonClassMetadata::class);
$metadata->name = 'stdClass';
$this->object->loadMetadataForClass(sha1(rand()), $metadata);
}
/**
* @covers ::getAllClassNames
*/
public function testGetAllClassNames()
{
$allClassNames = $this->object->getAllClassNames();
$this->assertInternalType('array', $allClassNames);
}
/**
* @covers ::isTransient
*/
public function testIsTransient()
{
$transient = $this->object->isTransient('stdClass');
$this->assertFalse($transient);
}
}

View File

@@ -1,320 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Mapping;
use PHPUnit_Framework_Assert;
use PHPUnit_Framework_TestCase;
use ReflectionClass;
use stdClass;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Mapping\ClassMetadata
*/
class ClassMetadataTest extends PHPUnit_Framework_TestCase
{
/**
* @var ClassMetadata
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$class = rand(0, 1) ? stdClass::class : new stdClass;
$this->object = new ClassMetadata($class);
}
/**
* @covers ::skipTransientField
*/
public function testSkipTransientField()
{
$field = 'foo';
$this->object->skipTransientField($field);
$this->assertArrayNotHasKey($field, $this->object->fields);
$this->assertArrayHasKey($field, $this->object->transientFields);
}
/**
* @covers ::mapField
* @depends testSkipTransientField
*/
public function testMapField()
{
$field = [
'fieldName' => 'foo',
];
$this->object->mapField($field);
$this->assertArraySubset(['foo' => $field], $this->object->fields);
$transientField = [
'fieldName' => 'bar',
];
$this->object->skipTransientField('bar');
$this->object->mapField($transientField);
$this->assertArrayNotHasKey('bar', $this->object->fields);
}
/**
* @covers ::mapIdentifier
* @depends testMapField
*/
public function testMapIdentifier()
{
$this->object->mapIdentifier('id');
$this->assertFalse($this->object->isCompositeKey);
$this->assertContains('id', $this->object->identifier);
$this->assertArraySubset([
'id' => ['fieldName' => 'id', 'id' => true],
], $this->object->fields);
$this->object->mapIdentifier('pk');
$this->assertTrue($this->object->isCompositeKey);
$this->assertContains('id', $this->object->identifier);
$this->assertContains('pk', $this->object->identifier);
$this->assertArraySubset([
'id' => ['fieldName' => 'id', 'id' => true],
'pk' => ['fieldName' => 'pk', 'id' => true],
], $this->object->fields);
}
/**
* @covers ::newInstance
*/
public function testNewInstance()
{
$prototype = PHPUnit_Framework_Assert::readAttribute($this->object, 'prototype');
$this->assertNull($prototype);
$instance = $this->object->newInstance();
$prototype = PHPUnit_Framework_Assert::readAttribute($this->object, 'prototype');
$this->assertNotNull($prototype);
$this->assertInstanceOf('stdClass', $prototype);
$this->assertInstanceOf('stdClass', $instance);
$this->assertNotSame($prototype, $instance);
}
/**
* @covers ::__sleep
*/
public function testSleep()
{
$attributes = $this->object->__sleep();
foreach ($attributes as $attribute) {
$this->assertClassHasAttribute($attribute, ClassMetadata::class);
}
$this->assertInternalType('string', serialize($this->object));
}
/**
* @covers ::getIdentifierValues
*/
public function testGetIdentifierValues()
{
$identifierValues = $this->object->getIdentifierValues(new stdClass);
$this->assertInternalType('array', $identifierValues);
$this->assertEmpty($identifierValues);
$object = new stdClass;
$object->id = rand();
$this->object->mapIdentifier('id');
$identifierValues = $this->object->getIdentifierValues($object);
$this->assertInternalType('array', $identifierValues);
$this->assertNotEmpty($identifierValues);
}
/**
* @covers ::getName
*/
public function testGetName()
{
$this->markTestIncomplete();
}
/**
* @covers ::getIdentifier
*/
public function testGetIdentifier()
{
$identifier = $this->object->getIdentifier();
$this->assertInternalType('array', $identifier);
foreach ($identifier as $key => $value) {
$this->assertInternalType('integer', $key);
$this->assertInternalType('string', $value);
}
}
/**
* @covers ::getReflectionClass
*/
public function testGetReflectionClass()
{
$reflectionClass = $this->object->getReflectionClass();
$this->assertInstanceOf(ReflectionClass::class, $reflectionClass);
$this->assertSame('stdClass', $reflectionClass->name);
}
/**
* @covers ::isIdentifier
*/
public function testIsIdentifier()
{
$this->object->mapIdentifier('id');
$this->assertTrue($this->object->isIdentifier('id'));
$this->assertFalse($this->object->isIdentifier('test'));
}
/**
* @covers ::hasField
*/
public function testHasField()
{
$this->object->mapField(['fieldName' => 'foo']);
$this->assertTrue($this->object->hasField('foo'));
$this->assertFalse($this->object->hasField('bar'));
}
/**
* @covers ::hasAssociation
*/
public function testHasAssociation()
{
$this->assertFalse($this->object->hasAssociation(sha1(rand())));
}
/**
* @covers ::isSingleValuedAssociation
*/
public function testIsSingleValuedAssociation()
{
$this->assertFalse($this->object->isSingleValuedAssociation(sha1(rand())));
}
/**
* @covers ::isCollectionValuedAssociation
*/
public function testIsCollectionValuedAssociation()
{
$this->assertFalse($this->object->isCollectionValuedAssociation(sha1(rand())));
}
/**
* @covers ::getFieldNames
*/
public function testGetFieldNames()
{
$this->object->mapField(['fieldName' => 'foo']);
$fieldNames = $this->object->getFieldNames();
$this->assertInternalType('array', $fieldNames);
foreach ($fieldNames as $key => $value) {
$this->assertInternalType('integer', $key);
$this->assertInternalType('string', $value);
}
$this->assertSame(['foo'], $fieldNames);
}
/**
* @covers ::getIdentifierFieldNames
*/
public function testGetIdentifierFieldNames()
{
$identifierFieldNames = $this->object->getIdentifierFieldNames();
$this->assertInternalType('array', $identifierFieldNames);
foreach ($identifierFieldNames as $key => $value) {
$this->assertInternalType('integer', $key);
$this->assertInternalType('string', $value);
}
}
/**
* @covers ::getAssociationNames
*/
public function testGetAssociationNames()
{
$this->markTestIncomplete();
}
/**
* @covers ::getTypeOfField
*/
public function testGetTypeOfField()
{
$this->markTestIncomplete();
}
/**
* @covers ::getAssociationTargetClass
*/
public function testGetAssociationTargetClass()
{
$this->markTestIncomplete();
}
/**
* @covers ::isAssociationInverseSide
*/
public function testIsAssociationInverseSide()
{
$this->assertFalse($this->object->isAssociationInverseSide(sha1(rand())));
}
/**
* @covers ::getAssociationMappedByTargetField
*/
public function testGetAssociationMappedByTargetField()
{
$this->markTestIncomplete();
}
}

View File

@@ -1,54 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Mapping;
use PHPUnit_Framework_TestCase;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Mapping\XmlDriver
*/
class XmlDriverTest extends PHPUnit_Framework_TestCase
{
/**
* @var XmlDriver
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new XmlDriver(__DIR__ . '/Fixtures/xml');
}
/**
* @covers ::loadMetadataForClass
*
* @todo Implement testLoadMetadataForClass().
*/
public function testLoadMetadataForClass()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
}

View File

@@ -1,54 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Mapping;
use PHPUnit_Framework_TestCase;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Mapping\YamlDriver
*/
class YamlDriverTest extends PHPUnit_Framework_TestCase
{
/**
* @var YamlDriver
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new YamlDriver(__DIR__ . '/Fixtures/yaml');
}
/**
* @covers ::loadMetadataForClass
*
* @todo Implement testLoadMetadataForClass().
*/
public function testLoadMetadataForClass()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
}

View File

@@ -1,260 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Query;
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\KeyValueStore\EntityManager;
use Doctrine\KeyValueStore\Storage\DoctrineCacheStorage;
use PHPUnit_Framework_TestCase;
use ReflectionClass;
use RuntimeException;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Query\RangeQuery
*/
class RangeQueryTest extends PHPUnit_Framework_TestCase
{
/**
* @var EntityManager
*/
private $entityManager;
/**
* @var string
*/
private $className;
/**
* @var string
*/
private $partitionKey;
/**
* @var RangeQuery
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->entityManager = $this
->getMockBuilder(EntityManager::class)
->disableOriginalConstructor()
->getMock();
$this->className = sha1(rand());
$this->partitionKey = sha1(rand());
$this->object = new RangeQuery(
$this->entityManager,
$this->className,
$this->partitionKey
);
}
/**
* @covers ::setLimit
* @covers ::getLimit
*/
public function testLimit()
{
$limit = rand();
$setterOutput = $this->object->setLimit($limit);
$this->assertInstanceOf(RangeQuery::class, $setterOutput);
$this->assertSame($limit, $this->object->getLimit());
}
/**
* @covers ::getClassName
*/
public function testGetClassName()
{
$this->assertSame(
$this->className,
$this->object->getClassName()
);
}
/**
* @covers ::getPartitionKey
*/
public function testGetPartitionKey()
{
$this->assertSame(
$this->partitionKey,
$this->object->getPartitionKey()
);
}
/**
* @covers ::getConditions
*/
public function testGetConditions()
{
$reflectionClass = new ReflectionClass($this->object);
$constants = $reflectionClass->getConstants();
$conditions = $this->object->getConditions();
$this->assertInternalType('array', $conditions);
foreach ($conditions as $condition) {
$this->assertArrayHasKey($condition[0], $constants);
}
}
/**
* @covers ::rangeEquals
* @depends testGetConditions
*/
public function testRangeEquals()
{
$value = 'test';
$output = $this->object->rangeEquals($value);
$this->assertInstanceOf(RangeQuery::class, $output);
$conditions = $this->object->getConditions();
$this->assertArraySubset(
[[RangeQuery::CONDITION_EQ, $value]],
$conditions
);
}
/**
* @covers ::rangeNotEquals
* @depends testGetConditions
*/
public function testRangeNotEquals()
{
$value = 'test';
$output = $this->object->rangeNotEquals($value);
$this->assertInstanceOf(RangeQuery::class, $output);
$conditions = $this->object->getConditions();
$this->assertArraySubset(
[[RangeQuery::CONDITION_NEQ, $value]],
$conditions
);
}
/**
* @covers ::rangeLessThan
* @depends testGetConditions
*/
public function testRangeLessThan()
{
$value = 'test';
$output = $this->object->rangeLessThan($value);
$this->assertInstanceOf(RangeQuery::class, $output);
$conditions = $this->object->getConditions();
$this->assertArraySubset(
[[RangeQuery::CONDITION_LT, $value]],
$conditions
);
}
/**
* @covers ::rangeLessThanEquals
* @depends testGetConditions
*/
public function testRangeLessThanEquals()
{
$value = 'test';
$output = $this->object->rangeLessThanEquals($value);
$this->assertInstanceOf(RangeQuery::class, $output);
$conditions = $this->object->getConditions();
$this->assertArraySubset(
[[RangeQuery::CONDITION_LE, $value]],
$conditions
);
}
/**
* @covers ::rangeGreaterThan
* @depends testGetConditions
*/
public function testRangeGreaterThan()
{
$value = 'test';
$output = $this->object->rangeGreaterThan($value);
$this->assertInstanceOf(RangeQuery::class, $output);
$conditions = $this->object->getConditions();
$this->assertArraySubset(
[[RangeQuery::CONDITION_GT, $value]],
$conditions
);
}
/**
* @covers ::rangeGreaterThanEquals
* @depends testGetConditions
*/
public function testRangeGreaterThanEquals()
{
$value = 'test';
$output = $this->object->rangeGreaterThanEquals($value);
$this->assertInstanceOf(RangeQuery::class, $output);
$conditions = $this->object->getConditions();
$this->assertArraySubset(
[[RangeQuery::CONDITION_GE, $value]],
$conditions
);
}
/**
* @covers ::execute
*
* @todo Implement testExecute().
*/
public function testExecute()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::execute
*/
public function testWrongExecute()
{
$this->entityManager
->method('unwrap')
->willReturn(new DoctrineCacheStorage(new ArrayCache));
$this->setExpectedException(RuntimeException::class);
$this->object->execute();
}
}

View File

@@ -1,151 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Storage;
use PHPUnit_Framework_TestCase;
use WindowsAzure\Common\ServicesBuilder;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Storage\AzureSdkTableStorage
*/
class AzureSdkTableStorageTest extends PHPUnit_Framework_TestCase
{
/**
* @var AzureSdkTableStorage
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
if (empty($GLOBALS['DOCTRINE_KEYVALUE_AZURE_NAME']) || empty($GLOBALS['DOCTRINE_KEYVALUE_AZURE_KEY'])) {
$this->markTestSkipped('Missing Azure credentials.');
}
$connectionString = sprintf(
'DefaultEndpointsProtocol=http;AccountName=%s;AccountKey=%s',
$GLOBALS['DOCTRINE_KEYVALUE_AZURE_NAME'],
$GLOBALS['DOCTRINE_KEYVALUE_AZURE_KEY']
);
$tableProxy = ServicesBuilder::getInstance()->createTableService($connectionString);
$this->storage = new AzureSdkTableStorage($tableProxy);
}
/**
* @covers ::supportsPartialUpdates
*
* @todo Implement testSupportsPartialUpdates().
*/
public function testSupportsPartialUpdates()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::supportsCompositePrimaryKeys
*
* @todo Implement testSupportsCompositePrimaryKeys().
*/
public function testSupportsCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::requiresCompositePrimaryKeys
*
* @todo Implement testRequiresCompositePrimaryKeys().
*/
public function testRequiresCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::insert
*
* @todo Implement testInsert().
*/
public function testInsert()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::update
*
* @todo Implement testUpdate().
*/
public function testUpdate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::delete
*
* @todo Implement testDelete().
*/
public function testDelete()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::find
*
* @todo Implement testFind().
*/
public function testFind()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::getName
*/
public function testGetName()
{
$this->assertEquals('azure_table_sdk', $this->object->getName());
}
/**
* @covers ::executeRangeQuery
*
* @todo Implement testExecuteRangeQuery().
*/
public function testExecuteRangeQuery()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
}

View File

@@ -1,129 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Storage;
use PHPUnit_Framework_TestCase;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Storage\CassandraStorage
* @requires extension cassandra
*/
class CassandraStorageTest extends PHPUnit_Framework_TestCase
{
/**
* @var CassandraStorage
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new CassandraStorage;
}
/**
* @covers ::supportsPartialUpdates
*
* @todo Implement testSupportsPartialUpdates().
*/
public function testSupportsPartialUpdates()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::supportsCompositePrimaryKeys
*
* @todo Implement testSupportsCompositePrimaryKeys().
*/
public function testSupportsCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::requiresCompositePrimaryKeys
*
* @todo Implement testRequiresCompositePrimaryKeys().
*/
public function testRequiresCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::insert
*
* @todo Implement testInsert().
*/
public function testInsert()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::update
*
* @todo Implement testUpdate().
*/
public function testUpdate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::delete
*
* @todo Implement testDelete().
*/
public function testDelete()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::find
*
* @todo Implement testFind().
*/
public function testFind()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::getName
*/
public function testGetName()
{
$this->assertEquals('cassandra', $this->object->getName());
}
}

View File

@@ -1,140 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Storage;
use Doctrine\CouchDB\CouchDBClient;
use Doctrine\CouchDB\HTTP\StreamClient;
use PHPUnit_Framework_TestCase;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Storage\CouchDbStorage
*/
class CouchDbStorageTest extends PHPUnit_Framework_TestCase
{
/**
* @var CouchDbStorage
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$client = $this
->getMockBuilder(StreamClient::class)
->disableOriginalConstructor()
->getMock();
$this->couchdb = $this
->getMockBuilder(CouchDBClient::class)
->setConstructorArgs([$client, 'test'])
->getMock();
$this->object = new CouchDbStorage($this->couchdb);
}
/**
* @covers ::supportsPartialUpdates
*
* @todo Implement testSupportsPartialUpdates().
*/
public function testSupportsPartialUpdates()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::supportsCompositePrimaryKeys
*
* @todo Implement testSupportsCompositePrimaryKeys().
*/
public function testSupportsCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::requiresCompositePrimaryKeys
*
* @todo Implement testRequiresCompositePrimaryKeys().
*/
public function testRequiresCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::insert
*
* @todo Implement testInsert().
*/
public function testInsert()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::update
*
* @todo Implement testUpdate().
*/
public function testUpdate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::delete
*
* @todo Implement testDelete().
*/
public function testDelete()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::find
*
* @todo Implement testFind().
*/
public function testFind()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::getName
*/
public function testGetName()
{
$this->assertEquals('couchdb', $this->object->getName());
}
}

View File

@@ -1,129 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Storage;
use PHPUnit_Framework_TestCase;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Storage\CouchbaseStorage
* @requires extension couchbase
*/
class CouchbaseStorageTest extends PHPUnit_Framework_TestCase
{
/**
* @var CouchbaseStorage
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new CouchbaseStorage;
}
/**
* @covers ::supportsPartialUpdates
*
* @todo Implement testSupportsPartialUpdates().
*/
public function testSupportsPartialUpdates()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::supportsCompositePrimaryKeys
*
* @todo Implement testSupportsCompositePrimaryKeys().
*/
public function testSupportsCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::requiresCompositePrimaryKeys
*
* @todo Implement testRequiresCompositePrimaryKeys().
*/
public function testRequiresCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::insert
*
* @todo Implement testInsert().
*/
public function testInsert()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::update
*
* @todo Implement testUpdate().
*/
public function testUpdate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::delete
*
* @todo Implement testDelete().
*/
public function testDelete()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::find
*
* @todo Implement testFind().
*/
public function testFind()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::getName
*/
public function testGetName()
{
$this->assertEquals('couchbase', $this->object->getName());
}
}

View File

@@ -1,129 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Storage;
use Doctrine\DBAL\Connection;
use PHPUnit_Framework_TestCase;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Storage\DBALStorage
*/
class DBALStorageTest extends PHPUnit_Framework_TestCase
{
/**
* @var DBALStorage
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new DBALStorage($this->getMock(Connection::class));
}
/**
* @covers ::supportsPartialUpdates
*
* @todo Implement testSupportsPartialUpdates().
*/
public function testSupportsPartialUpdates()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::supportsCompositePrimaryKeys
*
* @todo Implement testSupportsCompositePrimaryKeys().
*/
public function testSupportsCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::requiresCompositePrimaryKeys
*
* @todo Implement testRequiresCompositePrimaryKeys().
*/
public function testRequiresCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::insert
*
* @todo Implement testInsert().
*/
public function testInsert()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::update
*
* @todo Implement testUpdate().
*/
public function testUpdate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::delete
*
* @todo Implement testDelete().
*/
public function testDelete()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::find
*
* @todo Implement testFind().
*/
public function testFind()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::getName
*/
public function testGetName()
{
$this->assertEquals('dbal', $this->object->getName());
}
}

View File

@@ -1,129 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Storage;
use Doctrine\Common\Cache\ArrayCache;
use PHPUnit_Framework_TestCase;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Storage\DoctrineCacheStorage
*/
class DoctrineCacheStorageTest extends PHPUnit_Framework_TestCase
{
/**
* @var DoctrineCacheStorage
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new DoctrineCacheStorage(new ArrayCache);
}
/**
* @covers ::supportsPartialUpdates
*
* @todo Implement testSupportsPartialUpdates().
*/
public function testSupportsPartialUpdates()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::supportsCompositePrimaryKeys
*
* @todo Implement testSupportsCompositePrimaryKeys().
*/
public function testSupportsCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::requiresCompositePrimaryKeys
*
* @todo Implement testRequiresCompositePrimaryKeys().
*/
public function testRequiresCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::insert
*
* @todo Implement testInsert().
*/
public function testInsert()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::update
*
* @todo Implement testUpdate().
*/
public function testUpdate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::delete
*
* @todo Implement testDelete().
*/
public function testDelete()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::find
*
* @todo Implement testFind().
*/
public function testFind()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::getName
*/
public function testGetName()
{
$this->assertEquals('doctrine_cache', $this->object->getName());
}
}

View File

@@ -1,134 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Storage;
use Aws\DynamoDb\DynamoDbClient;
use PHPUnit_Framework_TestCase;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Storage\DynamoDbStorage
*/
class DynamoDbStorageTest extends PHPUnit_Framework_TestCase
{
/**
* @var DynamoDbStorage
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$dynamoDbClient = $this
->getMockBuilder(DynamoDbClient::class)
->disableOriginalConstructor()
->getMock();
$this->object = new DynamoDbStorage($dynamoDbClient);
}
/**
* @covers ::supportsPartialUpdates
*
* @todo Implement testSupportsPartialUpdates().
*/
public function testSupportsPartialUpdates()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::supportsCompositePrimaryKeys
*
* @todo Implement testSupportsCompositePrimaryKeys().
*/
public function testSupportsCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::requiresCompositePrimaryKeys
*
* @todo Implement testRequiresCompositePrimaryKeys().
*/
public function testRequiresCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::insert
*
* @todo Implement testInsert().
*/
public function testInsert()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::update
*
* @todo Implement testUpdate().
*/
public function testUpdate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::delete
*
* @todo Implement testDelete().
*/
public function testDelete()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::find
*
* @todo Implement testFind().
*/
public function testFind()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::getName
*/
public function testGetName()
{
$this->assertEquals('dynamodb', $this->object->getName());
}
}

View File

@@ -1,140 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Storage;
use PHPUnit_Framework_TestCase;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Storage\MongoDbStorage
* @requires extension mongo
*/
class MongoDbStorageTest extends PHPUnit_Framework_TestCase
{
/**
* @var MongoDbStorage
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new MongoDbStorage;
}
/**
* @covers ::initialize
*
* @todo Implement testInitialize().
*/
public function testInitialize()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::supportsPartialUpdates
*
* @todo Implement testSupportsPartialUpdates().
*/
public function testSupportsPartialUpdates()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::supportsCompositePrimaryKeys
*
* @todo Implement testSupportsCompositePrimaryKeys().
*/
public function testSupportsCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::requiresCompositePrimaryKeys
*
* @todo Implement testRequiresCompositePrimaryKeys().
*/
public function testRequiresCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::insert
*
* @todo Implement testInsert().
*/
public function testInsert()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::update
*
* @todo Implement testUpdate().
*/
public function testUpdate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::delete
*
* @todo Implement testDelete().
*/
public function testDelete()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::find
*
* @todo Implement testFind().
*/
public function testFind()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::getName
*/
public function testGetName()
{
$this->assertEquals('mongodb', $this->object->getName());
}
}

View File

@@ -1,140 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Storage;
use PHPUnit_Framework_TestCase;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Storage\RedisStorage
* @requires extension redis
*/
class RedisStorageTest extends PHPUnit_Framework_TestCase
{
/**
* @var RedisStorage
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new RedisStorage;
}
/**
* @covers ::supportsPartialUpdates
*
* @todo Implement testSupportsPartialUpdates().
*/
public function testSupportsPartialUpdates()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::supportsCompositePrimaryKeys
*
* @todo Implement testSupportsCompositePrimaryKeys().
*/
public function testSupportsCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::requiresCompositePrimaryKeys
*
* @todo Implement testRequiresCompositePrimaryKeys().
*/
public function testRequiresCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::insert
*
* @todo Implement testInsert().
*/
public function testInsert()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::update
*
* @todo Implement testUpdate().
*/
public function testUpdate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::delete
*
* @todo Implement testDelete().
*/
public function testDelete()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::find
*
* @todo Implement testFind().
*/
public function testFind()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::getName
*/
public function testGetName()
{
$this->assertEquals('redis', $this->object->getName());
}
/**
* @covers ::getKeyName
*
* @todo Implement testGetKeyName().
*/
public function testGetKeyName()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
}

View File

@@ -1,318 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Storage;
use PHPUnit_Framework_TestCase;
use Riak\Bucket;
use Riak\Client;
use Riak\Object;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Storage\RiakStorage
*/
class RiakStorageTest extends PHPUnit_Framework_TestCase
{
/**
* @var Client
*/
private $client;
/**
* @var RiakStorage
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->client = $this
->getMockBuilder(Client::class)
->disableOriginalConstructor()
->getMock();
$this->object = new RiakStorage($this->client);
}
/**
* @covers ::supportsPartialUpdates
*/
public function testSupportsPartialUpdates()
{
$this->assertFalse($this->object->supportsPartialUpdates());
}
/**
* @covers ::supportsCompositePrimaryKeys
*/
public function testSupportsCompositePrimaryKeys()
{
$this->assertFalse($this->object->supportsCompositePrimaryKeys());
}
/**
* @covers ::requiresCompositePrimaryKeys
*/
public function testRequiresCompositePrimaryKeys()
{
$this->assertFalse($this->object->requiresCompositePrimaryKeys());
}
/**
* @covers ::insert
*/
public function testInsert()
{
$bucket = $this
->getMockBuilder(Bucket::class)
->disableOriginalConstructor()
->getMock();
$this->client
->expects($this->once())
->method('bucket')
->willReturn($bucket);
$objectMock = $this
->getMockBuilder(Object::class)
->disableOriginalConstructor()
->getMock();
$objectMock
->expects($this->once())
->method('store');
$bucket
->expects($this->once())
->method('newObject')
->will($this->returnCallback(function ($key, $data) use ($objectMock) {
$this->assertEquals('foobar', $key);
$this->assertEquals(['title' => 'Riak test'], $data);
return $objectMock;
}));
$this->object->insert('riak-test', 'foobar', ['title' => 'Riak test']);
}
/**
* @covers ::update
*/
public function testUpdate()
{
$objectMock = $this
->getMockBuilder(Object::class)
->disableOriginalConstructor()
->getMock();
$bucket = $this
->getMockBuilder(Bucket::class)
->disableOriginalConstructor()
->getMock();
$this->client
->expects($this->once())
->method('bucket')
->willReturn($bucket);
$bucket
->expects($this->once())
->method('get')
->willReturn($objectMock);
$objectMock
->expects($this->once())
->method('setData')
->will($this->returnCallback(function ($data) {
$this->assertEquals(['title' => 'Riak cookbook'], $data);
}));
$objectMock
->expects($this->once())
->method('store');
$this->object->update('riak-test', 'foobar', ['title' => 'Riak cookbook']);
}
/**
* @covers ::delete
*/
public function testDelete()
{
$objectMock = $this
->getMockBuilder(Object::class)
->disableOriginalConstructor()
->getMock();
$bucket = $this
->getMockBuilder(Bucket::class)
->disableOriginalConstructor()
->getMock();
$this->client
->expects($this->once())
->method('bucket')
->willReturn($bucket);
$bucket
->expects($this->once())
->method('get')
->with('foobar')
->willReturn($objectMock);
$objectMock
->expects($this->once())
->method('exists')
->willReturn(true);
$objectMock
->expects($this->once())
->method('delete');
$this->object->delete('riak-test', 'foobar');
}
/**
* @covers ::delete
*/
public function testDeleteWithNotExistKey()
{
$objectMock = $this
->getMockBuilder(Object::class)
->disableOriginalConstructor()
->getMock();
$bucket = $this
->getMockBuilder(Bucket::class)
->disableOriginalConstructor()
->getMock();
$this->client
->expects($this->once())
->method('bucket')
->willReturn($bucket);
$bucket
->expects($this->once())
->method('get')
->with('foobar')
->willReturn($objectMock);
$objectMock
->expects($this->once())
->method('exists')
->willReturn(false);
$objectMock
->expects($this->never())
->method('delete');
$this->object->delete('riak-test', 'foobar');
}
/**
* @covers ::find
*/
public function testFind()
{
$objectMock = $this
->getMockBuilder(Object::class)
->disableOriginalConstructor()
->getMock();
$bucket = $this
->getMockBuilder(Bucket::class)
->disableOriginalConstructor()
->getMock();
$this->client
->expects($this->once())
->method('bucket')
->willReturn($bucket);
$bucket
->expects($this->once())
->method('get')
->with('foobar')
->willReturn($objectMock);
$objectMock
->expects($this->once())
->method('exists')
->willReturn(true);
$objectMock
->expects($this->once())
->method('getData')
->willReturn(['title' => 'Riak Test']);
$this->assertEquals(['title' => 'Riak Test'], $this->object->find('riaktest', 'foobar'));
}
/**
* @covers ::find
* @expectedException Doctrine\KeyValueStore\NotFoundException
*/
public function testFindWithNotExistKey()
{
$objectMock = $this
->getMockBuilder(Object::class)
->disableOriginalConstructor()
->getMock();
$bucket = $this
->getMockBuilder(Bucket::class)
->disableOriginalConstructor()
->getMock();
$this->client
->expects($this->once())
->method('bucket')
->willReturn($bucket);
$bucket
->expects($this->once())
->method('get')
->with('foobar')
->willReturn($objectMock);
$objectMock
->expects($this->once())
->method('exists')
->willReturn(false);
$objectMock
->expects($this->never())
->method('getData');
$this->object->find('riak-test', 'foobar');
}
/**
* @covers ::getName
*/
public function testGetName()
{
$this->assertEquals('riak', $this->object->getName());
}
}

View File

@@ -1,134 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore\Storage;
use Aws\SimpleDb\SimpleDbClient;
use PHPUnit_Framework_TestCase;
/**
* @coversDefaultClass Doctrine\KeyValueStore\Storage\SimpleDbStorage
*/
class SimpleDbStorageTest extends PHPUnit_Framework_TestCase
{
/**
* @var SimpleDbStorage
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$simpleDbClient = $this
->getMockBuilder(SimpleDbClient::class)
->disableOriginalConstructor()
->getMock();
$this->object = new SimpleDbStorage($simpleDbClient);
}
/**
* @covers ::supportsPartialUpdates
*
* @todo Implement testSupportsPartialUpdates().
*/
public function testSupportsPartialUpdates()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::supportsCompositePrimaryKeys
*
* @todo Implement testSupportsCompositePrimaryKeys().
*/
public function testSupportsCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::requiresCompositePrimaryKeys
*
* @todo Implement testRequiresCompositePrimaryKeys().
*/
public function testRequiresCompositePrimaryKeys()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::insert
*
* @todo Implement testInsert().
*/
public function testInsert()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::update
*
* @todo Implement testUpdate().
*/
public function testUpdate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::delete
*
* @todo Implement testDelete().
*/
public function testDelete()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::find
*
* @todo Implement testFind().
*/
public function testFind()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::getName
*/
public function testGetName()
{
$this->assertEquals('simpledb', $this->object->getName());
}
}

View File

@@ -1,148 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\KeyValueStore;
use Doctrine\KeyValueStore\Mapping\ClassMetadataFactory;
use Doctrine\KeyValueStore\Storage\Storage;
use PHPUnit_Framework_TestCase;
use ReflectionClass;
/**
* @coversDefaultClass Doctrine\KeyValueStore\UnitOfWork
*/
class UnitOfWorkTest extends PHPUnit_Framework_TestCase
{
/**
* @var UnitOfWork
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$classMetadataFactory = $this
->getMockBuilder(ClassMetadataFactory::class)
->disableOriginalConstructor()
->getMock();
$storage = $this->getMock(Storage::class);
$configuration = $this->getMock(Configuration::class);
$this->object = new UnitOfWork($classMetadataFactory, $storage, $configuration);
}
/**
* @covers ::getClassMetadata
*
* @todo Implement testGetClassMetadata().
*/
public function testGetClassMetadata()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::reconstititute
*
* @todo Implement testReconstititute().
*/
public function testReconstititute()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::createEntity
*
* @todo Implement testCreateEntity().
*/
public function testCreateEntity()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::scheduleForInsert
*
* @todo Implement testScheduleForInsert().
*/
public function testScheduleForInsert()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::scheduleForDelete
*
* @todo Implement testScheduleForDelete().
*/
public function testScheduleForDelete()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::commit
*
* @todo Implement testCommit().
*/
public function testCommit()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete();
}
/**
* @covers ::clear
*/
public function testClear()
{
$clearedKeys = [
'scheduledInsertions',
'scheduledDeletions',
'identifiers',
'originalData',
'identityMap',
];
$this->object->clear();
$reflectionClass = new ReflectionClass($this->object);
$defaultProperties = $reflectionClass->getDefaultProperties();
foreach ($clearedKeys as $clearedKey) {
$property = $reflectionClass->getProperty($clearedKey);
$property->setAccessible(true);
$this->assertSame(
$defaultProperties[$clearedKey],
$property->getValue($this->object)
);
}
}
}

View File

@@ -22,9 +22,6 @@ namespace Doctrine\Tests\KeyValueStore;
use Doctrine\KeyValueStore\Configuration;
/**
* @group legacy
*/
class ConfigurationTest extends \PHPUnit_Framework_TestCase
{
public function testNoMappingDriver()

View File

@@ -23,9 +23,6 @@ namespace Doctrine\Tests\KeyValueStore\Functional;
use Doctrine\KeyValueStore\Mapping\Annotations as KVS;
use Doctrine\Tests\KeyValueStoreTestCase;
/**
* @group legacy
*/
abstract class BasicCrudTestCase extends KeyValueStoreTestCase
{
private $manager;

View File

@@ -23,9 +23,6 @@ namespace Doctrine\Tests\KeyValueStore\Functional;
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\KeyValueStore\Storage\DoctrineCacheStorage;
/**
* @group legacy
*/
class CompositeBasicCrudTest extends BasicCrudTestCase
{
private $cache;

View File

@@ -25,9 +25,6 @@ use Doctrine\KeyValueStore\Mapping\Annotations as KVS;
use Doctrine\KeyValueStore\Storage\DoctrineCacheStorage;
use Doctrine\Tests\KeyValueStoreTestCase;
/**
* @group legacy
*/
class InheritanceTest extends KeyValueStoreTestCase
{
private $manager;

View File

@@ -23,9 +23,6 @@ namespace Doctrine\Tests\KeyValueStore\Functional;
use Doctrine\KeyValueStore\Mapping\Annotations as KVS;
use Doctrine\Tests\KeyValueStoreTestCase;
/**
* @group legacy
*/
class PersistTest extends KeyValueStoreTestCase
{
/**

View File

@@ -23,9 +23,6 @@ namespace Doctrine\Tests\KeyValueStore\Functional;
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\KeyValueStore\Storage\DoctrineCacheStorage;
/**
* @group legacy
*/
class SingleBasicCrudTest extends BasicCrudTestCase
{
private $cache;

View File

@@ -25,9 +25,6 @@ use Doctrine\KeyValueStore\Storage\AzureSdkTableStorage;
use Doctrine\Tests\KeyValueStoreTestCase;
use WindowsAzure\Common\ServicesBuilder;
/**
* @group legacy
*/
class AzureSdkTableTest extends KeyValueStoreTestCase
{
private $storage;

View File

@@ -24,7 +24,6 @@ use Cassandra;
use Doctrine\KeyValueStore\Storage\CassandraStorage;
/**
* @group legacy
* @requires extension cassandra
*/
class CassandraTest extends \PHPUnit_Framework_TestCase

View File

@@ -26,9 +26,6 @@ use Doctrine\KeyValueStore\Storage\WindowsAzureTable\SharedKeyLiteAuthorization;
use Doctrine\KeyValueStore\Storage\WindowsAzureTableStorage;
use Doctrine\Tests\KeyValueStoreTestCase;
/**
* @group legacy
*/
class WindowsAzureTableTest extends KeyValueStoreTestCase
{
private $storage;

View File

@@ -25,7 +25,6 @@ use ReflectionClass;
/**
* @coversDefaultClass \Doctrine\KeyValueStore\Mapping\ClassMetadata
* @group legacy
*/
class ClassMetadataTest extends \PHPUnit_Framework_TestCase
{

View File

@@ -20,9 +20,6 @@
namespace Doctrine\Tests\KeyValueStore\Storage;
/**
* @group legacy
*/
abstract class AbstractStorageTestCase extends \PHPUnit_Framework_TestCase
{
/**

View File

@@ -28,7 +28,6 @@ use Doctrine\KeyValueStore\Storage\CouchDbStorage;
* @author Emanuele Minotto <minottoemanuele@gmail.com>
*
* @covers \Doctrine\KeyValueStore\Storage\CouchDbStorage
* @group legacy
*/
class CouchDbStorageTest extends \PHPUnit_Framework_TestCase
{

View File

@@ -27,7 +27,6 @@ use Doctrine\KeyValueStore\Storage\CouchbaseStorage;
*
* @author Simon Schick <simonsimcity@gmail.com>
*
* @group legacy
* @requires extension couchbase
*/
class CouchbaseStorageTest extends \PHPUnit_Framework_TestCase

View File

@@ -27,7 +27,6 @@ use Doctrine\KeyValueStore\Storage\MongoDbStorage;
*
* @author Markus Bachmann <markus.bachmann@bachi.biz>
*
* @group legacy
* @requires extension mongo
*/
class MongoDbStorageTest extends \PHPUnit_Framework_TestCase

View File

@@ -25,7 +25,6 @@ use Doctrine\KeyValueStore\Storage\RedisStorage;
/**
* @author Marcel Araujo <admin@marcelaraujo.me>
*
* @group legacy
* @requires extension redis
*/
class RedisStorageTest extends \PHPUnit_Framework_TestCase

View File

@@ -24,8 +24,6 @@ use Doctrine\KeyValueStore\Storage\RiakStorage;
/**
* @author Markus Bachmann <markus.bachmann@bachi.biz>
*
* @group legacy
*/
class RiakStorageTest extends \PHPUnit_Framework_TestCase
{

View File

@@ -22,9 +22,6 @@ namespace Doctrine\Tests\KeyValueStore\Storage\WindowsAzureTable;
use Doctrine\KeyValueStore\Storage\WindowsAzureTable\SharedKeyLiteAuthorization;
/**
* @group legacy
*/
class SharedKeyLiteTest extends \PHPUnit_Framework_TestCase
{
private $auth;

View File

@@ -23,9 +23,6 @@ namespace Doctrine\Tests\KeyValueStore\Storage;
use Doctrine\KeyValueStore\Http\Response;
use Doctrine\KeyValueStore\Storage\WindowsAzureTableStorage;
/**
* @group legacy
*/
class WindowsAzureTableStorageTest extends AbstractStorageTestCase
{
private $client;

View File

@@ -26,9 +26,6 @@ use Doctrine\KeyValueStore\EntityManager;
use Doctrine\KeyValueStore\Mapping;
use Doctrine\KeyValueStore\Storage\DoctrineCacheStorage;
/**
* @group legacy
*/
abstract class KeyValueStoreTestCase extends \PHPUnit_Framework_TestCase
{
public function createManager($storage = null, $driver = 'annotation')