Skip to content

Commit e52067b

Browse files
committed
fix unit tests
1 parent c281945 commit e52067b

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

Diff for: phpunit.xml

+4
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@
1414
<directory suffix="Test.php">./tests/</directory>
1515
</testsuite>
1616
</testsuites>
17+
<php>
18+
<env name="DB_CONNECTION" value="testing"/>
19+
<env name="APP_KEY" value="base64:2fl+Ktvkfl+Fuz4Qp/A75G2RTiWVA/ZoKZvp6fiiM10="/>
20+
</php>
1721
</phpunit>

Diff for: tests/Database/TranslationServiceTest.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace tests\Database;
2+
namespace Tests\Database;
33

44
use Mockery as m;
55
use Tectonic\LaravelLocalisation\Database\TranslationService;
@@ -11,7 +11,6 @@ class TranslationServiceTest extends TestCase
1111
{
1212
public function testFind()
1313
{
14-
self::expectNotToPerformAssertions();
1514
$repository = m::spy(TranslationRepository::class);
1615
$service = new TranslationService($repository);
1716

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

2322
public function testFindAll()
2423
{
25-
self::expectNotToPerformAssertions();
2624
$repository = m::spy(TranslationRepository::class);
2725
$service = new TranslationService($repository);
2826

@@ -44,11 +42,9 @@ public function testTranslationCreation()
4442
$this->assertEquals($translation, $service->create($model, 'en', 'name', 'colours'));
4543
}
4644

47-
/**
48-
* @expectedException Tectonic\LaravelLocalisation\Database\TranslationNotFound
49-
*/
5045
public function testTranslationUpdateWithNullTranslation()
5146
{
47+
$this->expectException(\Tectonic\LaravelLocalisation\Database\TranslationNotFound::class);
5248
$repository = m::mock(TranslationRepository::class);
5349
$repository->shouldReceive('getByCriteria')->once()->andReturn(null);
5450
$service = new TranslationService($repository);

Diff for: tests/Stubs/Model.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace tests\Stubs;
2+
namespace Tests\Stubs;
33

44
use Tectonic\Localisation\Contracts\Translatable;
55
use Tectonic\Localisation\Translator\Translations;
@@ -19,4 +19,8 @@ public function getTranslatableFields()
1919
{
2020
return ['name'];
2121
}
22+
23+
public function touch()
24+
{
25+
}
2226
}

Diff for: tests/TestCase.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
<?php
22
namespace Tests;
33

4+
use Illuminate\Foundation\Testing\RefreshDatabase;
5+
use Illuminate\Foundation\Testing\TestCase as IlluminatedTestCase;
46
use Mockery as m;
7+
use Orchestra\Testbench\Concerns\CreatesApplication;
58

6-
class TestCase extends \PHPUnit\Framework\TestCase
9+
class TestCase extends IlluminatedTestCase
710
{
11+
use RefreshDatabase;
812
use Testable;
13+
use CreatesApplication;
914

1015
public function setUp(): void
1116
{
17+
parent::setUp();
1218
m::close();
13-
1419
$this->init();
1520
}
1621
}

0 commit comments

Comments
 (0)