Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Removed unneded static-method and added unit tests for Configuration.php #54

Merged
merged 2 commits into from

1 participant

@mikelohmann
Collaborator

No description provided.

@mikelohmann mikelohmann merged commit 9cb6f40 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
10 lib/Doctrine/Search/Mapping/Driver/AnnotationDriver.php
@@ -54,16 +54,6 @@ class AnnotationDriver extends BaseAnnotationDriver
/**
- * Registers annotation classes to the common registry.
- *
- * This method should be called when bootstrapping your application.
- */
- public static function registerAnnotationClasses()
- {
- AnnotationRegistry::registerFile(__DIR__ . '/../Annotations/DoctrineAnnotations.php');
- }
-
- /**
* {@inheritDoc}
*
* @throws ReflectionException
View
93 tests/Unit/Doctrine/Search/ConfigurationTest.php
@@ -12,7 +12,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
/**
* @var Configuration
*/
- protected $object;
+ protected $configuration;
/**
* Sets up the fixture, for example, opens a network connection.
@@ -20,92 +20,73 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
- $this->object = new Configuration;
+ $this->configuration = new Configuration();
}
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- protected function tearDown()
- {
- }
- /**
- * @todo Implement testGetMetadataDriverImpl().
- */
public function testGetMetadataDriverImpl()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $metadataDriverImpl = $this->configuration->getMetadataDriverImpl();
+ $this->assertInstanceOf('\Doctrine\Search\Mapping\Driver\AnnotationDriver', $metadataDriverImpl);
}
- /**
- * @todo Implement testSetMetadataDriverImpl().
- */
+
public function testSetMetadataDriverImpl()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $mockedMetadataDriverImpl = $this->getMock('\\Doctrine\\Search\\Mapping\\Driver\\Driver'
+ , array(), array(), '', false);
+ $this->configuration->setMetadataDriverImpl($mockedMetadataDriverImpl);
+
+ $metadataDriverImpl = $this->configuration->getMetadataDriverImpl();
+ $this->assertInstanceOf('\Doctrine\Search\Mapping\Driver\Driver', $metadataDriverImpl);
+
}
/**
- * @todo Implement testSetMetadataCacheImpl().
+ * @expectedException PHPUnit_Framework_Error
*/
- public function testSetMetadataCacheImpl()
+ public function testSetMetadataCacheImplWrongParameter()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->configuration->setMetadataCacheImpl(array());
}
- /**
- * @todo Implement testGetMetadataCacheImpl().
- */
- public function testGetMetadataCacheImpl()
+ public function testSetMetadataCacheImpl()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $mockedMetadataCacheImpl = $this->getMock('\Doctrine\Common\Cache\Cache');
+ $this->configuration->setMetadataCacheImpl($mockedMetadataCacheImpl);
+
+ $cacheMetadataImpl = $this->configuration->getMetadataCacheImpl();
+ $this->assertInstanceOf('\Doctrine\Common\Cache\Cache', $cacheMetadataImpl);
}
- /**
- * @todo Implement testNewDefaultAnnotationDriver().
- */
+
public function testNewDefaultAnnotationDriver()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $defaultAnnotationDriver = $this->configuration->newDefaultAnnotationDriver();
+ $this->assertInstanceOf('\Doctrine\Search\Mapping\Driver\AnnotationDriver', $defaultAnnotationDriver);
}
/**
- * @todo Implement testSetClassMetadataFactoryName().
+ * @expectedException PHPUnit_Framework_Error
*/
+ public function testNewDefaultAnnotationDriverWrongParameter()
+ {
+ $this->configuration->newDefaultAnnotationDriver(new \StdClass());
+ }
+
public function testSetClassMetadataFactoryName()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->configuration = new Configuration();
+ $this->configuration->setClassMetadataFactoryName('test');
+ $this->assertEquals('test', $this->configuration->getClassMetadataFactoryName());
}
- /**
- * @todo Implement testGetClassMetadataFactoryName().
- */
+
public function testGetClassMetadataFactoryName()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->configuration = new Configuration();
+ $className = $this->configuration->getClassMetadataFactoryName();
+ $this->assertEquals($className, 'Doctrine\Search\Mapping\ClassMetadataFactory');
}
}
?>
View
3  tests/Unit/Doctrine/Search/Listener/MongoDBSearchListenerTest.php
@@ -58,9 +58,6 @@ private function getDocumentManager()
}
- /**
- * @todo Implement testLoadClassMetadata().
- */
public function testLoadClassMetadata()
{
$dm = $this->getDocumentManager();
View
11 tests/Unit/Doctrine/Search/Mapping/Driver/AnnotationDriverTest.php
@@ -40,17 +40,6 @@ protected function setUp()
$this->annotationDriver = new AnnotationDriver($this->reader);
}
- /**
- * @todo Implement testRegisterAnnotationClasses().
- */
- public function testRegisterAnnotationClasses()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
public function testLoadMetadataForClass()
{
Something went wrong with that request. Please try again.