Skip to content

Commit b4337e5

Browse files
committed
add functional database tests
1 parent e80b8d6 commit b4337e5

File tree

9 files changed

+68
-272
lines changed

9 files changed

+68
-272
lines changed

Locator/FileLocator.php

Lines changed: 0 additions & 138 deletions
This file was deleted.

Manager/StatementManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ public function findStatementsBy(StatementsFilter $filter)
7777
*/
7878
public function save(Statement $statement, $flush = true)
7979
{
80-
$this->repository->save($statement, $flush);
80+
return $this->repository->save($statement, $flush);
8181
}
8282
}

Repository/StatementRepositoryInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
*/
2121
interface StatementRepositoryInterface
2222
{
23+
/**
24+
* @return Statement[] The statements
25+
*/
26+
public function findAll();
27+
2328
/**
2429
* @param array $criteria
2530
*
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the xAPI package.
5+
*
6+
* (c) Christian Flothmann <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Xabbuh\XApi\Storage\Doctrine\Tests\Functional;
13+
14+
use Doctrine\Common\Persistence\ObjectManager;
15+
use Xabbuh\XApi\Storage\Api\Test\Functional\StatementManagerTest as BaseStatementManagerTest;
16+
use Xabbuh\XApi\Storage\Doctrine\Manager\StatementManager;
17+
use Xabbuh\XApi\Storage\Doctrine\Repository\StatementRepositoryInterface;
18+
19+
/**
20+
* @author Christian Flothmann <[email protected]>
21+
*/
22+
abstract class StatementManagerTest extends BaseStatementManagerTest
23+
{
24+
/**
25+
* @var ObjectManager
26+
*/
27+
protected $objectManager;
28+
29+
/**
30+
* @var StatementRepositoryInterface
31+
*/
32+
protected $repository;
33+
34+
protected function setUp()
35+
{
36+
$this->objectManager = $this->createObjectManager();
37+
$this->repository = $this->createRepository();
38+
39+
parent::setUp();
40+
}
41+
42+
protected function createStatementManager()
43+
{
44+
return new StatementManager($this->repository);
45+
}
46+
47+
protected function createRepository()
48+
{
49+
return $this->objectManager->getRepository($this->getStatementClassName());
50+
}
51+
52+
/**
53+
* @return ObjectManager
54+
*/
55+
abstract protected function createObjectManager();
56+
57+
/**
58+
* @return string
59+
*/
60+
abstract protected function getStatementClassName();
61+
}

Tests/Locator/FileLocatorTest.php

Lines changed: 0 additions & 132 deletions
This file was deleted.

Tests/Locator/fixtures/a/Bar.xml

Whitespace-only changes.

Tests/Locator/fixtures/a/Foo.xml

Whitespace-only changes.

Tests/Locator/fixtures/b/Baz.xml

Whitespace-only changes.

Tests/Manager/StatementManagerTest.php renamed to Tests/Unit/Manager/StatementManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Xabbuh\XApi\Storage\Doctrine\Tests\Manager;
12+
namespace Xabbuh\XApi\Storage\Doctrine\Tests\Unit\Manager;
1313

1414
use Xabbuh\XApi\DataFixtures\StatementFixtures;
1515
use Xabbuh\XApi\DataFixtures\VerbFixtures;

0 commit comments

Comments
 (0)