TestGenerator::getBaseSettings()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 12
nc 1
nop 0
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
4
namespace SmartWeb\ModuleTesting\Generator\Test;
5
6
use SmartWeb\ModuleTesting\Codeception\SetupInterface;
7
use function class_basename;
8
9
/**
10
 * Class TestGenerator
11
 *
12
 * @package SmartWeb\ModuleTesting\Generator\Test
13
 */
14
class TestGenerator extends BaseTestGenerator
15
{
16
    
17
    /**
18
     * TestGenerator constructor.
19
     *
20
     * @param SetupInterface $setup
21
     * @param string         $suite
22
     * @param string         $name
23
     * @param array          $settings
24
     *
25
     * @throws \Exception
26
     */
27
    public function __construct(SetupInterface $setup, string $suite, string $name, array $settings = [])
28
    {
29
        parent::__construct(CodeceptionTestType::test(), $setup, $suite, $name, $settings);
30
    }
31
    
32
    /**
33
     * @inheritDoc
34
     */
35
    protected function getBaseSettings() : array
36
    {
37
        $suiteSettings = $this->getSuiteSettings($this->suite);
38
        $moduleSettings = $this->getSettingsForModule();
39
        
40
        $baseSettings = [
41
            'namespace'      => $suiteSettings['namespace'],
42
            'baseClass'      => $this->getBaseClass(),
43
            'baseClassShort' => class_basename($this->getBaseClass()),
44
            'name'           => class_basename($this->name),
45
            'group'          => 'exampleGroup',
46
        ];
47
        
48
        $actor = ($suiteSettings['actor'] ?? $moduleSettings['actor']) ?? 'Tester';
49
        $baseSettings['actorClass'] = $this->suite . '\\' . $actor;
50
        
51
        return $baseSettings;
52
    }
53
    
54
}
55