1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Mathielen\ImportEngineBundle\Tests\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use Mathielen\ImportEngineBundle\DependencyInjection\MathielenImportEngineExtension; |
6
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
7
|
|
|
use Symfony\Component\Validator\Constraints\Email; |
8
|
|
|
use Symfony\Component\Validator\Constraints\NotBlank; |
9
|
|
|
use Symfony\Component\Validator\Constraints\Url; |
10
|
|
|
|
11
|
|
|
abstract class AbstractTest extends \PHPUnit_Framework_TestCase |
12
|
|
|
{ |
13
|
|
|
protected $extension; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @var ContainerBuilder |
17
|
|
|
*/ |
18
|
|
|
protected $container; |
19
|
|
|
|
20
|
|
|
protected function setUp() |
21
|
|
|
{ |
22
|
|
|
$this->extension = new MathielenImportEngineExtension(); |
23
|
|
|
|
24
|
|
|
$this->container = new ContainerBuilder(); |
25
|
|
|
$this->container->registerExtension($this->extension); |
26
|
|
|
$this->container->set('event_dispatcher', $this->createMock('Symfony\Component\EventDispatcher\EventDispatcherInterface')); |
27
|
|
|
$this->container->set('logger', $this->createMock('Psr\Log\LoggerInterface')); |
28
|
|
|
$this->container->set('import_service', new MyImportService()); //target service |
29
|
|
|
$this->container->set('jms_serializer', $this->createMock('JMS\Serializer\SerializerInterface')); |
30
|
|
|
$this->container->set('validator', $this->createMock('Symfony\Component\Validator\Validator\ValidatorInterface')); |
31
|
|
|
$this->container->set('doctrine.orm.entity_manager', $this->createMock('Doctrine\ORM\EntityManagerInterface')); |
32
|
|
|
$this->container->set('logger', $this->createMock('Psr\Log\LoggerInterface')); |
33
|
|
|
$this->container->set('some.converter.serviceid', new MyDummyService()); |
34
|
|
|
$this->container->set('some.other.converter.serviceid', new MyDummyService()); |
35
|
|
|
$this->container->set('email', new Email()); |
36
|
|
|
$this->container->set('url', new Url()); |
37
|
|
|
$this->container->set('notempty', new NotBlank()); |
38
|
|
|
} |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
class MyImportService |
42
|
|
|
{ |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
class MyDummyService |
46
|
|
|
{ |
47
|
|
|
} |
48
|
|
|
|