Skip to content

Commit 4319495

Browse files
committed
Set Factory to final
1 parent e175282 commit 4319495

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

src/Utils/Factory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Art4\JsonApiClient\Exception\FactoryException;
66

7-
class Factory implements FactoryInterface
7+
final class Factory implements FactoryInterface
88
{
99
/**
1010
* @var array

tests/Fixtures/Factory.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Art4\JsonApiClient\Tests\Fixtures;
44

5-
use Art4\JsonApiClient\Utils\Factory as OrigFactory;
5+
use Art4\JsonApiClient\Utils\FactoryInterface;
66

7-
class Factory extends OrigFactory
7+
final class Factory implements FactoryInterface
88
{
99
public $testcase;
1010

@@ -17,11 +17,8 @@ class Factory extends OrigFactory
1717
*/
1818
public function make($name, array $args = [])
1919
{
20-
if ( isset($this->classes[$name]) )
21-
{
22-
return $this->testcase
23-
->getMockBuilder($this->classes[$name] . 'Interface') // Mock only the interfaces
24-
->getMock();
25-
}
20+
return $this->testcase
21+
->getMockBuilder('Art4\JsonApiClient\\' . $name . 'Interface') // Mock only the interfaces
22+
->getMock();
2623
}
2724
}

tests/unit/Utils/ManagerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ public function testCreateReturnsSelf()
2222
*/
2323
public function testCreateWithConstructorReturnsSelf()
2424
{
25-
$factory = $this->getMockBuilder('Art4\JsonApiClient\Utils\Factory')
25+
$factory = $this->getMockBuilder('Art4\JsonApiClient\Utils\FactoryInterface')
2626
->getMock();
2727

2828
$manager = new Manager($factory);
2929

3030
$this->assertInstanceOf('Art4\JsonApiClient\Utils\ManagerInterface', $manager);
3131
$this->assertInstanceOf('Art4\JsonApiClient\Utils\FactoryManagerInterface', $manager);
3232

33-
$this->assertSame($factory, $manager->getFactory());
33+
$this->assertInstanceOf('Art4\JsonApiClient\Utils\FactoryInterface', $manager->getFactory());
3434
}
3535

3636
/**
3737
* @test
3838
*/
3939
public function testSetFactoryReturnsSelf()
4040
{
41-
$factory = $this->getMockBuilder('Art4\JsonApiClient\Utils\Factory')
41+
$factory = $this->getMockBuilder('Art4\JsonApiClient\Utils\FactoryInterface')
4242
->getMock();
4343

4444
$manager = new Manager;
@@ -51,7 +51,7 @@ public function testSetFactoryReturnsSelf()
5151
*/
5252
public function testGetFactoryReturnsFactoryInterface()
5353
{
54-
$factory = $this->getMockBuilder('Art4\JsonApiClient\Utils\Factory')
54+
$factory = $this->getMockBuilder('Art4\JsonApiClient\Utils\FactoryInterface')
5555
->getMock();
5656

5757
$manager = (new Manager)->setFactory($factory);

0 commit comments

Comments
 (0)