1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
4
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
5
|
|
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
6
|
|
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
7
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
8
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace MpaCustomDoctrineHydratorTest\Factory; |
12
|
|
|
|
13
|
|
|
use DoctrineModule\Stdlib\Hydrator\DoctrineObject; |
14
|
|
|
use MpaCustomDoctrineHydratorTest\Assets\Entity\Birthday; |
15
|
|
|
use MpaCustomDoctrineHydratorTest\Util\ServiceManagerFactory; |
16
|
|
|
use PHPUnit\Framework\TestCase; |
17
|
|
|
|
18
|
|
|
class EntityAttacherFactoryTest extends TestCase |
19
|
|
|
{ |
20
|
|
|
protected $serviceManager; |
21
|
|
|
|
22
|
|
|
protected function setUp() |
23
|
|
|
{ |
24
|
|
|
\Locale::setDefault('fr-CH'); |
25
|
|
|
$this->serviceManager = ServiceManagerFactory::getServiceManager(); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function testCustomHydratorIsADoctrineObjectInstance() |
29
|
|
|
{ |
30
|
|
|
$customHydrator = $this->serviceManager |
31
|
|
|
->get('hydrator') |
32
|
|
|
->setEntity(Birthday::class); |
33
|
|
|
|
34
|
|
|
$this->assertInstanceOf(DoctrineObject::class, $customHydrator); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function testCustomHydratorHasDateStrategiesAttached() |
38
|
|
|
{ |
39
|
|
|
$customHydrator = $this->serviceManager |
40
|
|
|
->get('hydrator') |
41
|
|
|
->setEntity(Birthday::class); |
42
|
|
|
|
43
|
|
|
$this->assertTrue($customHydrator->hasStrategy('date')); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|