Passed
Pull Request — master (#26)
by Dominik
01:09
created

ACFComposerTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
c 0
b 0
f 0
dl 0
loc 22
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testRegisterFieldGroup() 0 16 1
1
<?php
2
/**
3
 * Class ConstructionPlanTest
4
 *
5
 * @package Wp_Starter_Plugin
6
 */
7
8
namespace ACFComposer\Tests;
9
10
/**
11
 * Construction plan test case.
12
 */
13
require_once dirname(__DIR__) . '/lib/ACFComposer/ACFComposer.php';
14
15
use Mockery;
16
use Brain\Monkey\Functions;
0 ignored issues
show
Bug introduced by
The type Brain\Monkey\Functions was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use ACFComposer\ACFComposer;
18
19
class ACFComposerTest extends TestCase
20
{
21
  /**
22
   * @runInSeparateProcess
23
   * @preserveGlobalState disabled
24
   */
25
    public function testRegisterFieldGroup() : void
26
    {
27
        $config = 'this is a config';
28
        $fieldGroup = 'this is a field group';
29
        $returnValue = 'this is a return value';
30
        Mockery::mock('alias:ACFComposer\ResolveConfig')
31
            ->shouldReceive('forFieldGroup')
32
            ->with($config)
33
            ->once()
34
            ->andReturn($fieldGroup);
35
        Functions\expect('acf_add_local_field_group')
0 ignored issues
show
Bug introduced by
The function expect was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
        /** @scrutinizer ignore-call */ 
36
        Functions\expect('acf_add_local_field_group')
Loading history...
36
            ->with($fieldGroup)
37
            ->once()
38
            ->andReturn($returnValue);
39
        $output = ACFComposer::registerFieldGroup($config);
0 ignored issues
show
Bug introduced by
$config of type string is incompatible with the type array expected by parameter $config of ACFComposer\ACFComposer::registerFieldGroup(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

39
        $output = ACFComposer::registerFieldGroup(/** @scrutinizer ignore-type */ $config);
Loading history...
40
        $this->assertEquals($returnValue, $output);
41
    }
42
}
43