Skip to content

Commit a73075e

Browse files
Oleksandr VasylenkoAkenRoberts
authored andcommitted
FX make tests php 5.3 friendly
1 parent 78112f5 commit a73075e

File tree

2 files changed

+38
-17
lines changed

2 files changed

+38
-17
lines changed

tests/Gedmo/Translatable/Fixture/Issue2152/EntityWithTranslatableBoolean.php

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
declare(strict_types=1);
4-
53
namespace Translatable\Fixture\Issue2152;
64

75
use Doctrine\ORM\Mapping as ORM;
@@ -45,34 +43,50 @@ class EntityWithTranslatableBoolean
4543
*/
4644
private $locale;
4745

48-
public function __construct(string $title, string $isOperating = '0')
46+
/**
47+
* @param string $title
48+
* @param string|null $isOperating
49+
*/
50+
public function __construct($title, $isOperating = '0')
4951
{
5052
$this->translateInLocale('en', $title, $isOperating);
5153
}
5254

53-
public function translateInLocale(string $locale, ?string $title, ?string $isOperating): void
55+
public function translateInLocale($locale, $title, $isOperating)
5456
{
5557
$this->title = $title;
5658
$this->isOperating = $isOperating;
5759
$this->locale = $locale;
5860
}
5961

60-
public function getId(): ?int
62+
/**
63+
* @return int|null
64+
*/
65+
public function getId()
6166
{
6267
return $this->id;
6368
}
6469

65-
public function getTitle(): ?string
70+
/**
71+
* @return string|null
72+
*/
73+
public function getTitle()
6674
{
6775
return $this->title;
6876
}
6977

70-
public function isOperating(): ?string
78+
/**
79+
* @return string|null
80+
*/
81+
public function isOperating()
7182
{
7283
return $this->isOperating;
7384
}
7485

75-
public function getLocale(): string
86+
/**
87+
* @return string
88+
*/
89+
public function getLocale()
7690
{
7791
return $this->locale;
7892
}

tests/Gedmo/Translatable/Issue/Issue2152Test.php

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
declare(strict_types=1);
4-
53
namespace Gedmo\Translatable\Issue;
64

75
use Doctrine\Common\EventManager;
@@ -12,15 +10,15 @@
1210

1311
class Issue2152Test extends BaseTestCaseORM
1412
{
15-
private const TRANSLATION = Translation::class;
16-
private const ENTITY = EntityWithTranslatableBoolean::class;
13+
const TRANSLATION = '\Gedmo\Translatable\Entity\Translation';
14+
const ENTITY = '\Translatable\Fixture\Issue2152\EntityWithTranslatableBoolean';
1715

1816
/**
1917
* @var TranslatableListener
2018
*/
2119
private $translatableListener;
2220

23-
protected function setUp(): void
21+
protected function setUp()
2422
{
2523
parent::setUp();
2624

@@ -38,7 +36,7 @@ protected function setUp(): void
3836
/**
3937
* @test
4038
*/
41-
public function shouldFindInheritedClassTranslations(): void
39+
public function shouldFindInheritedClassTranslations()
4240
{
4341
//Arrange
4442
//by default we have English
@@ -82,13 +80,22 @@ public function shouldFindInheritedClassTranslations(): void
8280

8381
protected function getUsedEntityFixtures()
8482
{
85-
return [
83+
return array(
8684
self::TRANSLATION,
8785
self::ENTITY,
88-
];
86+
);
8987
}
9088

91-
private function findUsingQueryBuilder(string $locale): ?EntityWithTranslatableBoolean
89+
/**
90+
* @param string $locale
91+
*
92+
* @return EntityWithTranslatableBoolean|null
93+
*
94+
* @throws \Doctrine\ORM\NoResultException
95+
* @throws \Doctrine\ORM\NonUniqueResultException
96+
* @throws \Doctrine\Persistence\Mapping\MappingException
97+
*/
98+
private function findUsingQueryBuilder($locale)
9299
{
93100
$this->em->clear();
94101
$this->translatableListener->setTranslatableLocale($locale);

0 commit comments

Comments
 (0)