Skip to content

Commit ffeeff5

Browse files
committed
Implement base component interface
1 parent d6fd04c commit ffeeff5

11 files changed

+46
-9
lines changed

sources/Lib/Base/Component.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Kolyunya\Codeception\Lib\Base;
4+
5+
use Kolyunya\Codeception\Lib\Base\ComponentInterface;
6+
7+
abstract class Component implements ComponentInterface
8+
{
9+
/**
10+
* {@inheritDoc}
11+
*/
12+
public static function getClassName()
13+
{
14+
$className = get_called_class();
15+
16+
return $className;
17+
}
18+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Kolyunya\Codeception\Lib\Base;
4+
5+
interface ComponentInterface
6+
{
7+
/**
8+
* Returns fully qualified name of the component class.
9+
*
10+
* @return string Fully qualified name of the component class.
11+
*/
12+
public static function getClassName();
13+
}

sources/Lib/MarkupValidator/DefaultMarkupProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
use Codeception\Lib\ModuleContainer;
77
use Codeception\Module\PhpBrowser;
88
use Codeception\Module\WebDriver;
9+
use Kolyunya\Codeception\Lib\Base\Component;
910
use Kolyunya\Codeception\Lib\MarkupValidator\MarkupProviderInterface;
1011

1112
/**
1213
* Default markup provider which attemps to get markup from
1314
* `PhpBrowser` and `WebDriver` modules.
1415
*/
15-
class DefaultMarkupProvider implements MarkupProviderInterface
16+
class DefaultMarkupProvider extends Component implements MarkupProviderInterface
1617
{
1718
/**
1819
* Module container.

sources/Lib/MarkupValidator/DefaultMarkupReporter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
use Exception;
66
use Codeception\Util\Shared\Asserts;
7+
use Kolyunya\Codeception\Lib\Base\Component;
78
use Kolyunya\Codeception\Lib\MarkupValidator\MarkupReporterInterface;
89
use Kolyunya\Codeception\Lib\MarkupValidator\MarkupValidatorMessageInterface;
910

1011
/**
1112
* Default markup validation message reporter.
1213
*/
13-
class DefaultMarkupReporter implements MarkupReporterInterface
14+
class DefaultMarkupReporter extends Component implements MarkupReporterInterface
1415
{
1516
const IGNORE_WARNINGS_CONFIG_KEY = 'ignoreWarnings';
1617

sources/Lib/MarkupValidator/MarkupProviderInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
namespace Kolyunya\Codeception\Lib\MarkupValidator;
44

55
use Codeception\Lib\ModuleContainer;
6+
use Kolyunya\Codeception\Lib\Base\ComponentInterface;
67

78
/**
89
* An interface of a markup provider.
910
*/
10-
interface MarkupProviderInterface
11+
interface MarkupProviderInterface extends ComponentInterface
1112
{
1213
/**
1314
* Constructs a markup provider. Injects a module container and configuration parameters.

sources/Lib/MarkupValidator/MarkupReporterInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
namespace Kolyunya\Codeception\Lib\MarkupValidator;
44

5+
use Kolyunya\Codeception\Lib\Base\ComponentInterface;
56
use Kolyunya\Codeception\Lib\MarkupValidator\MarkupValidatorMessageInterface;
67

78
/**
89
* An interface of a markup reported.
910
*/
10-
interface MarkupReporterInterface
11+
interface MarkupReporterInterface extends ComponentInterface
1112
{
1213
/**
1314
* Constructs a markup reported. Injects configuration parameters.

sources/Lib/MarkupValidator/MarkupValidatorInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
namespace Kolyunya\Codeception\Lib\MarkupValidator;
44

5+
use Kolyunya\Codeception\Lib\Base\ComponentInterface;
56
use Kolyunya\Codeception\Lib\MarkupValidator\MarkupValidatorMessageInterface;
67

78
/**
89
* An interface of a markup validator.
910
*/
10-
interface MarkupValidatorInterface
11+
interface MarkupValidatorInterface extends ComponentInterface
1112
{
1213
/**
1314
* Constructs a markup provider. Injects configuration parameters.

sources/Lib/MarkupValidator/W3CMarkupValidator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
use Exception;
66
use GuzzleHttp\Client;
7+
use Kolyunya\Codeception\Lib\Base\Component;
78
use Kolyunya\Codeception\Lib\MarkupValidator\MarkupValidatorInterface;
89
use Kolyunya\Codeception\Lib\MarkupValidator\W3CMarkupValidatorMessage;
910

10-
class W3CMarkupValidator implements MarkupValidatorInterface
11+
class W3CMarkupValidator extends Component implements MarkupValidatorInterface
1112
{
1213
const BASE_URI_CONFIG_KEY = 'baseUri';
1314

tests/Lib/MarkupValidator/DefaultMarkupProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function setUp()
3535
;
3636

3737
$this->markupProvider = $this
38-
->getMockBuilder('Kolyunya\Codeception\Lib\MarkupValidator\DefaultMarkupProvider')
38+
->getMockBuilder(DefaultMarkupProvider::getClassName())
3939
->setConstructorArgs(array(
4040
$this->moduleContainer,
4141
))

tests/Lib/MarkupValidator/DefaultMarkupReporterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class DefaultMarkupReporterTest extends TestCase
2222
public function setUp()
2323
{
2424
$this->markupReporter = $this
25-
->getMockBuilder('Kolyunya\Codeception\Lib\MarkupValidator\DefaultMarkupReporter')
25+
->getMockBuilder(DefaultMarkupReporter::getClassName())
2626
->setConstructorArgs(array(
2727
array(
2828
'ignoreWarnings' => false,

0 commit comments

Comments
 (0)