Skip to content

Commit 18d03cb

Browse files
authored
Merge pull request laravel-doctrine#633 from TomHAnderson/feature/test-case
Feature/test case
2 parents e08ddff + 9876f90 commit 18d03cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+244
-100
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace LaravelDoctrineTest\ORM\Assets\Serializers;
4+
5+
use LaravelDoctrine\ORM\Serializers\Arrayable;
6+
7+
class ArrayableEntity
8+
{
9+
use Arrayable;
10+
11+
protected $id = 'IDVALUE';
12+
13+
protected $name = 'NAMEVALUE';
14+
15+
protected $list = ['item1', 'item2'];
16+
17+
public function getId()
18+
{
19+
return $this->id;
20+
}
21+
22+
public function getName()
23+
{
24+
return $this->name;
25+
}
26+
27+
public function getList()
28+
{
29+
return $this->list;
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace LaravelDoctrineTest\ORM\Assets\Serializers;
4+
5+
use LaravelDoctrine\ORM\Serializers\Jsonable;
6+
7+
class JsonableEntity
8+
{
9+
use Jsonable;
10+
11+
protected $id = 'IDVALUE';
12+
13+
protected $name = 'NAMEVALUE';
14+
15+
protected $numeric = "1";
16+
17+
public function getId()
18+
{
19+
return $this->id;
20+
}
21+
22+
public function getName()
23+
{
24+
return $this->name;
25+
}
26+
27+
public function getNumeric()
28+
{
29+
return $this->numeric;
30+
}
31+
}

tests/Feature/Auth/DoctrineUserProviderTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
use LaravelDoctrine\ORM\Auth\DoctrineUserProvider;
99
use LaravelDoctrineTest\ORM\Assets\Auth\AuthenticableMock;
1010
use LaravelDoctrineTest\ORM\Assets\Auth\AuthenticableWithNonEmptyConstructorMock;
11+
use LaravelDoctrineTest\ORM\TestCase;
1112
use Mockery as m;
1213
use Mockery\Mock;
13-
use PHPUnit\Framework\TestCase;
1414

1515
class DoctrineUserProviderTest extends TestCase
1616
{
@@ -55,6 +55,8 @@ protected function setUp(): void
5555
$this->em,
5656
AuthenticableWithNonEmptyConstructorMock::class
5757
);
58+
59+
parent::setUp();
5860
}
5961

6062
public function test_can_retrieve_by_id()
@@ -189,5 +191,7 @@ protected function mockGetRepository($class = AuthenticableMock::class)
189191
protected function tearDown(): void
190192
{
191193
m::close();
194+
195+
parent::tearDown();
192196
}
193197
}

tests/Feature/Auth/Passwords/DoctrineTokenRepositoryTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
use Illuminate\Contracts\Hashing\Hasher;
1010
use LaravelDoctrine\ORM\Auth\Passwords\DoctrineTokenRepository;
1111
use LaravelDoctrineTest\ORM\Assets\Auth\Passwords\UserMock;
12+
use LaravelDoctrineTest\ORM\TestCase;
1213
use Mockery as m;
1314
use Mockery\Mock;
14-
use PHPUnit\Framework\TestCase;
1515

1616
class DoctrineTokenRepositoryTest extends TestCase
1717
{
@@ -66,6 +66,8 @@ protected function setUp(): void
6666
'hashkey',
6767
60
6868
);
69+
70+
parent::setUp();
6971
}
7072

7173
public function test_can_create_a_token()
@@ -274,5 +276,7 @@ public function test_can_delete_expired()
274276
protected function tearDown(): void
275277
{
276278
m::close();
279+
280+
parent::tearDown();
277281
}
278282
}

tests/Feature/Configuration/Cache/AbstractCacheProviderTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace LaravelDoctrineTest\ORM\Feature\Configuration\Cache;
44

5+
use LaravelDoctrineTest\ORM\TestCase;
56
use Mockery;
6-
use PHPUnit\Framework\TestCase;
77

88
abstract class AbstractCacheProviderTest extends TestCase
99
{
@@ -19,5 +19,7 @@ public function test_can_resolve()
1919
public function tearDown(): void
2020
{
2121
Mockery::close();
22+
23+
parent::tearDown();
2224
}
2325
}

tests/Feature/Configuration/Cache/CacheManagerTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
use LaravelDoctrine\ORM\Configuration\Cache\CacheManager;
1010
use LaravelDoctrine\ORM\Configuration\Cache\FileCacheProvider;
1111
use LaravelDoctrine\ORM\Exceptions\DriverNotFound;
12+
use LaravelDoctrineTest\ORM\TestCase;
1213
use Mockery as m;
13-
use PHPUnit\Framework\TestCase;
1414
use Symfony\Component\Cache\Adapter\ArrayAdapter;
1515

1616
class CacheManagerTest extends TestCase
@@ -39,6 +39,8 @@ protected function setUp(): void
3939
$this->manager = new CacheManager(
4040
$this->app
4141
);
42+
43+
parent::setUp();
4244
}
4345

4446
public function test_driver_returns_the_default_driver()
@@ -98,5 +100,7 @@ public function test_can_replace_an_existing_driver()
98100
protected function tearDown(): void
99101
{
100102
m::close();
103+
104+
parent::tearDown();
101105
}
102106
}

tests/Feature/Configuration/Cache/IlluminateCacheProviderTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
use Illuminate\Contracts\Cache\Factory;
77
use Illuminate\Contracts\Cache\Repository;
88
use LaravelDoctrine\ORM\Configuration\Cache\IlluminateCacheProvider;
9+
use LaravelDoctrineTest\ORM\TestCase;
910
use Mockery as m;
10-
use PHPUnit\Framework\TestCase;
1111

1212
class IlluminateCacheProviderTest extends TestCase
1313
{
@@ -32,6 +32,8 @@ protected function setUp(): void
3232
->andReturn($this->repository);
3333

3434
$this->driver = new IlluminateCacheProvider($manager);
35+
36+
parent::setUp();
3537
}
3638

3739
public function test_driver_returns_provided_namespace(): void
@@ -61,5 +63,7 @@ public function test_driver_has_no_namespace_by_default(): void
6163
public function tearDown(): void
6264
{
6365
m::close();
66+
67+
parent::tearDown();
6468
}
6569
}

tests/Feature/Configuration/Cache/PhpFileCacheProviderTest.php

-9
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,3 @@ public function getExpectedInstance()
3232
return PhpFilesAdapter::class;
3333
}
3434
}
35-
36-
if(!function_exists('storage_path')) {
37-
function storage_path($path = null)
38-
{
39-
$storage = __DIR__ . DIRECTORY_SEPARATOR . '../../Stubs/storage';
40-
41-
return is_null($path) ? $storage : $storage . DIRECTORY_SEPARATOR . $path;
42-
}
43-
}

tests/Feature/Configuration/Connections/ConnectionManagerTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
use LaravelDoctrine\ORM\Configuration\Connections\MysqlConnection;
99
use LaravelDoctrine\ORM\Configuration\Connections\SqliteConnection;
1010
use LaravelDoctrine\ORM\Exceptions\DriverNotFound;
11+
use LaravelDoctrineTest\ORM\TestCase;
1112
use Mockery as m;
12-
use PHPUnit\Framework\TestCase;
1313

1414
class ConnectionManagerTest extends TestCase
1515
{
@@ -39,6 +39,8 @@ protected function setUp(): void
3939
$this->manager = new ConnectionManager(
4040
$this->app
4141
);
42+
43+
parent::setUp();
4244
}
4345

4446
public function test_driver_returns_the_default_driver()
@@ -99,5 +101,7 @@ public function test_can_replace_an_existing_driver()
99101
protected function tearDown(): void
100102
{
101103
m::close();
104+
105+
parent::tearDown();
102106
}
103107
}

tests/Feature/Configuration/Connections/MysqlConnectionTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
use Illuminate\Contracts\Config\Repository;
66
use LaravelDoctrine\ORM\Configuration\Connections\MysqlConnection;
7+
use LaravelDoctrineTest\ORM\TestCase;
78
use Mockery as m;
89
use Mockery\Mock;
9-
use PHPUnit\Framework\TestCase;
1010

1111
class MysqlConnectionTest extends TestCase
1212
{
@@ -25,6 +25,8 @@ protected function setUp(): void
2525
$this->config = m::mock(Repository::class);
2626

2727
$this->connection = new MysqlConnection($this->config);
28+
29+
parent::setUp();
2830
}
2931

3032
public function test_can_resolve()
@@ -69,5 +71,7 @@ public function test_can_resolve()
6971
protected function tearDown(): void
7072
{
7173
m::close();
74+
75+
parent::tearDown();
7276
}
7377
}

tests/Feature/Configuration/Connections/OracleConnectionTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
use Illuminate\Contracts\Config\Repository;
66
use LaravelDoctrine\ORM\Configuration\Connections\OracleConnection;
7+
use LaravelDoctrineTest\ORM\TestCase;
78
use Mockery as m;
89
use Mockery\Mock;
9-
use PHPUnit\Framework\TestCase;
1010

1111
class OracleConnectionTest extends TestCase
1212
{
@@ -25,6 +25,8 @@ protected function setUp(): void
2525
$this->config = m::mock(Repository::class);
2626

2727
$this->connection = new OracleConnection($this->config);
28+
29+
parent::setUp();
2830
}
2931

3032
public function test_can_resolve()
@@ -57,5 +59,7 @@ public function test_can_resolve()
5759
protected function tearDown(): void
5860
{
5961
m::close();
62+
63+
parent::tearDown();
6064
}
6165
}

tests/Feature/Configuration/Connections/PgsqlConnectionTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
use Illuminate\Contracts\Config\Repository;
66
use LaravelDoctrine\ORM\Configuration\Connections\PgsqlConnection;
7+
use LaravelDoctrineTest\ORM\TestCase;
78
use Mockery as m;
89
use Mockery\Mock;
9-
use PHPUnit\Framework\TestCase;
1010

1111
class PgsqlConnectionTest extends TestCase
1212
{
@@ -25,6 +25,8 @@ protected function setUp(): void
2525
$this->config = m::mock(Repository::class);
2626

2727
$this->connection = new PgsqlConnection($this->config);
28+
29+
parent::setUp();
2830
}
2931

3032
public function test_can_resolve()
@@ -69,5 +71,7 @@ public function test_can_resolve()
6971
protected function tearDown(): void
7072
{
7173
m::close();
74+
75+
parent::tearDown();
7276
}
7377
}

tests/Feature/Configuration/Connections/PrimaryReadReplicaConnectionTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
use Doctrine\DBAL\Connections\PrimaryReadReplicaConnection as PrimaryReadReplicaDoctrineWrapper;
66
use Illuminate\Contracts\Config\Repository;
77
use LaravelDoctrine\ORM\Configuration\Connections\PrimaryReadReplicaConnection;
8+
use LaravelDoctrineTest\ORM\TestCase;
89
use Mockery as m;
9-
use PHPUnit\Framework\TestCase;
1010

1111
/**
1212
* Basic unit tests for primary read-replica connection
@@ -18,6 +18,8 @@ protected function setUp(): void
1818
if (!class_exists(PrimaryReadReplicaDoctrineWrapper::class)) {
1919
$this->markTestSkipped('Skipped for doctrine/dbal < 2.11');
2020
}
21+
22+
parent::setUp();
2123
}
2224

2325
/**

tests/Feature/Configuration/Connections/SqliteConnectionTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
use Illuminate\Contracts\Config\Repository;
66
use LaravelDoctrine\ORM\Configuration\Connections\SqliteConnection;
7+
use LaravelDoctrineTest\ORM\TestCase;
78
use Mockery as m;
89
use Mockery\Mock;
9-
use PHPUnit\Framework\TestCase;
1010

1111
class SqliteConnectionTest extends TestCase
1212
{
@@ -25,6 +25,8 @@ protected function setUp(): void
2525
$this->config = m::mock(Repository::class);
2626

2727
$this->connection = new SqliteConnection($this->config);
28+
29+
parent::setUp();
2830
}
2931

3032
public function test_can_resolve()
@@ -80,5 +82,7 @@ public function test_can_resolve_with_full_in__memory_database()
8082
protected function tearDown(): void
8183
{
8284
m::close();
85+
86+
parent::tearDown();
8387
}
8488
}

tests/Feature/Configuration/Connections/SqlsrvConnectionTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
use Illuminate\Contracts\Config\Repository;
66
use LaravelDoctrine\ORM\Configuration\Connections\SqlsrvConnection;
7+
use LaravelDoctrineTest\ORM\TestCase;
78
use Mockery as m;
89
use Mockery\Mock;
9-
use PHPUnit\Framework\TestCase;
1010

1111
class SqlsrvConnectionTest extends TestCase
1212
{
@@ -25,6 +25,8 @@ protected function setUp(): void
2525
$this->config = m::mock(Repository::class);
2626

2727
$this->connection = new SqlsrvConnection($this->config);
28+
29+
parent::setUp();
2830
}
2931

3032
public function test_can_resolve()
@@ -57,5 +59,7 @@ public function test_can_resolve()
5759
protected function tearDown(): void
5860
{
5961
m::close();
62+
63+
parent::tearDown();
6064
}
6165
}

tests/Feature/Configuration/CustomTypeManagerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use LaravelDoctrine\ORM\Configuration\CustomTypeManager;
77
use LaravelDoctrineTest\ORM\Assets\Configuration\TypeMock;
88
use LaravelDoctrineTest\ORM\Assets\Configuration\TypeMock2;
9-
use PHPUnit\Framework\TestCase;
9+
use LaravelDoctrineTest\ORM\TestCase;
1010

1111
class CustomTypeManagerTest extends TestCase
1212
{

0 commit comments

Comments
 (0)