Skip to content
This repository has been archived by the owner on Aug 28, 2018. It is now read-only.

Tests are now executing correctly. #42

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"require-dev": {
"doctrine/mongodb-odm": "*@beta",
"doctrine/mongodb": "*@beta",
"doctrine/mongodb": "~1.1",
"doctrine/mongodb-odm-bundle": "3.*@beta",
"mockery/mockery": "dev-master"
},
Expand Down
14 changes: 7 additions & 7 deletions tests/Khepin/Tests/MongoFixtureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ public function testPurge()
$loader->purgeDatabase('mongodb');

$cars = $this->doctrine->getManager()->getRepository('Khepin\Fixture\Document\Car')->findAll();
$this->assertEquals($cars->count(), 0);
$this->assertEquals(0, count($cars));
$drivers = $this->doctrine->getManager()->getRepository('Khepin\Fixture\Document\Driver')->findAll();
$this->assertEquals($drivers->count(), 0);
$this->assertEquals(0, count($drivers));
}

public function testContext()
Expand Down Expand Up @@ -143,8 +143,8 @@ public function testEmbedOne()

$repo = $this->doctrine->getManager()->getRepository('Khepin\Fixture\Document\Article');
$articles = $repo->findAll();
$this->assertEquals($articles->count(), 1);
$article = $articles->getNext();
$this->assertEquals(1, count($articles));
$article = $articles[0];
$this->assertInstanceOf('Khepin\Fixture\Document\Article', $article);
$author = $article->getAuthor();
$this->assertInstanceOf('Khepin\Fixture\Document\Author', $author);
Expand All @@ -159,12 +159,12 @@ public function testEmbedMany()

$repo = $this->doctrine->getManager()->getRepository('Khepin\Fixture\Document\Article');
$articles = $repo->findAll();
$this->assertEquals($articles->count(), 1);
$article = $articles->getNext();
$this->assertEquals(1, count($articles));
$article = $articles[0];
$this->assertInstanceOf('Khepin\Fixture\Document\Article', $article);
$tags = $article->getTags();
$this->assertEquals('YAML', $tags[0]->getName());
$this->assertEquals($tags->count(), 2);
$this->assertEquals(2, count($tags));
}

}
11 changes: 10 additions & 1 deletion tests/Khepin/Utils/BaseTestCaseOrm.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
namespace Khepin\Utils;

use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Repository\DefaultRepositoryFactory;
use \Mockery as m;
use Doctrine\ORM\Tools\SchemaTool;
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Doctrine\ORM\Mapping\DefaultQuoteStrategy;
use Doctrine\ORM\Repository\DefaultRepositoryFactory;

class BaseTestCaseOrm extends \PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -54,6 +54,15 @@ private function getMockAnnotatedConfig()
->will($this->returnValue('Doctrine\\ORM\\EntityRepository'))
;

$repositoryFactory = new DefaultRepositoryFactory();

$config
->expects($this->any())
->method('getRepositoryFactory')
->will($this->returnValue($repositoryFactory))
;


$quoteStrategy = new DefaultQuoteStrategy();

$config
Expand Down