Permalink
Browse files

Fix testsuite

  • Loading branch information...
1 parent 45a233e commit f8cc89f0d24fda431e2cb3f047243335c8234e27 @Baachi Baachi committed Mar 27, 2013
@@ -99,7 +99,7 @@ public function newDefaultAnnotationDriver(array $paths = array())
/**
* Set the class metadata factory class name.
*
- * @param string $cmf
+ * @param string $cmfName
*/
public function setClassMetadataFactoryName($cmfName)
{
@@ -87,7 +87,7 @@ public function getConfiguration()
*/
public function getClassMetadata($className)
{
- return $this->metadataFactory->getMetadataFor((string)$className);
+ return $this->metadataFactory->getMetadataFor($className);
}
/**
@@ -10,6 +10,8 @@
*/
class BlogPost
{
+ const CLASSNAME = __CLASS__;
+
public $id;
/**
@@ -24,7 +24,6 @@ public function test__sleep()
//removed className, because it is set by constructor and used on __wakeup
$fields = array(
'boost',
- 'fieldMappings',
'index',
'numberOfReplicas',
'numberOfShards',
@@ -41,6 +40,8 @@ public function test__sleep()
$this->classMetadata->$field = 1;
}
+ $this->classMetadata->fieldMappings = array();
+
$serializedClass = serialize($this->classMetadata);
$unserializedClass = unserialize($serializedClass);
@@ -2,13 +2,12 @@
namespace Doctrine\Tests\Search;
use Doctrine\Search\SearchManager;
-use Doctrine\Search\Http\Client\BuzzClient;
use Doctrine\Search\Configuration;
-use Buzz\Browser;
-/**
- * Test class for SearchManager.
- * Generated by PHPUnit on 2011-12-11 at 15:43:17.
- */
+use Doctrine\Search\Mapping\ClassMetadata;
+
+use Doctrine\Tests\Search\Documents\BlogPost;
+
+
class SearchManagerTest extends \PHPUnit_Framework_TestCase
{
/**
@@ -61,43 +60,16 @@ public function testGetConfiguration()
$this->assertInstanceOf('Doctrine\\Search\\Configuration', $this->sm->getConfiguration());
}
- /**
- *
- * @expectedException PHPUnit_Framework_Error
- */
- public function testSetObjectManagerWrongParameter()
- {
- $this->sm->setObjectManager(array());
- }
-
-
- public function testSetObjectManager()
+ public function testGetClassMetadata()
{
- $om = $this->getMock('Doctrine\\Common\\Persistence\\ObjectManager');
- $this->sm->setObjectManager($om);
+ $classMetadata = new ClassMetadata(BlogPost::CLASSNAME);
- $omGet = $this->sm->getObjectManager();
-
- $this->assertEquals($om, $omGet);
- }
-
- public function testLoadClassMetadata()
- {
$this->metadataFactory->expects($this->once())
->method('getMetadataFor')
- ->will($this->returnValue(new \Doctrine\Search\Mapping\ClassMetadata('Doctrine\Tests\Search\Documents\BlogPost')));
+ ->with('Some\Class')
+ ->will($this->returnValue($classMetadata));
- $metaData = $this->sm->loadClassMetadata('Doctrine\Tests\Search\Documents\BlogPost');
- $this->assertInstanceOf('Doctrine\Common\Persistence\Mapping\ClassMetadata', $metaData);
- }
-
- /**
- *
- * @expectedException PHPUnit_Framework_Error
- */
- public function testLoadClassMetadataWrongParameter()
- {
- $this->sm->loadClassMetadata(new \stdClass());
+ $this->assertEquals($classMetadata, $this->sm->getClassMetadata('Some\Class'));
}
public function testGetClassMetadataFactory()

0 comments on commit f8cc89f

Please sign in to comment.