Skip to content

Commit 835deb5

Browse files
committed
Working but failing tests due to PDO
1 parent cfe2ec3 commit 835deb5

File tree

8 files changed

+27
-17
lines changed

8 files changed

+27
-17
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.idea*
22
vendor/*
33
composer.lock
4-
composer.lock
4+
.phpunit.result.cache

composer.json

+12-6
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,22 @@
77
"email": "[email protected]"
88
}
99
],
10+
"repositories": [
11+
{
12+
"type": "path",
13+
"url": "../localisation"
14+
}
15+
],
1016
"require": {
11-
"php": ">=7.0.0",
12-
"illuminate/support": "5.*",
13-
"illuminate/database": "5.*",
14-
"tectonic/localisation": "^2.0.3"
17+
"php": ">=7.2",
18+
"illuminate/support": "^6.1",
19+
"illuminate/database": "^6.1",
20+
"tectonic/localisation": "dev-feature/laravel-lts-6"
1521
},
1622
"require-dev": {
17-
"mockery/mockery": "dev-master@dev",
23+
"mockery/mockery": "^1.4",
1824
"orchestra/testbench": "3.*",
19-
"phpunit/phpunit": "~5.7"
25+
"phpunit/phpunit": "^8.0"
2026
},
2127
"autoload": {
2228
"psr-4": {

phpunit.xml

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
convertWarningsToExceptions="true"
99
processIsolation="false"
1010
stopOnFailure="false"
11-
syntaxCheck="false"
1211
>
1312
<testsuites>
1413
<testsuite name="all">

src/Database/TranslationService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function findForUpdate(Translatable $model, $language, $field)
158158
'field' => $field
159159
]);
160160

161-
if (count($translations)) {
161+
if (!empty($translations)) {
162162
return $translations[0];
163163
}
164164

src/Translator/Transformers/PaginationTransformer.php

+8-5
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ public function isAppropriateFor($object)
2424
/**
2525
* Once a transformer for an object has been found, it then must do whatever work is necessary on that object.
2626
*
27-
* @param object $paginator
27+
* @param object $paginator
28+
* @param null $language
2829
* @return mixed
2930
*/
30-
public function transform($paginator)
31+
public function transform($paginator, $language = null)
3132
{
3233
$transformer = App::make(CollectionTransformer::class);
3334

@@ -40,12 +41,14 @@ public function transform($paginator)
4041
/**
4142
* Same as transform but should only translate objects one-level deep.
4243
*
43-
* @param object $paginator
44+
* @param object $paginator
45+
* @param null $language
46+
* @param array $fields
4447
* @return mixed
4548
*/
46-
public function shallow($paginator)
49+
public function shallow($paginator, $language = null, $fields = [])
4750
{
48-
return $this->transform($paginator);
51+
return $this->transform($paginator, $language);
4952
}
5053

5154
/**

tests/AcceptanceTestCase.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class AcceptanceTestCase extends TestCase
99
{
1010
use Testable;
1111

12-
public function setUp()
12+
public function setUp(): void
1313
{
1414
parent::setUp();
1515

tests/Database/TranslationServiceTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class TranslationServiceTest extends TestCase
1111
{
1212
public function testFind()
1313
{
14+
self::expectNotToPerformAssertions();
1415
$repository = m::spy(TranslationRepository::class);
1516
$service = new TranslationService($repository);
1617

@@ -21,6 +22,7 @@ public function testFind()
2122

2223
public function testFindAll()
2324
{
25+
self::expectNotToPerformAssertions();
2426
$repository = m::spy(TranslationRepository::class);
2527
$service = new TranslationService($repository);
2628

tests/TestCase.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
use Mockery as m;
55

6-
class TestCase extends \PHPUnit_Framework_TestCase
6+
class TestCase extends \PHPUnit\Framework\TestCase
77
{
88
use Testable;
99

10-
public function setUp()
10+
public function setUp(): void
1111
{
1212
m::close();
1313

0 commit comments

Comments
 (0)