Passed
Pull Request — master (#3)
by Harry
02:24
created

ParsedSchemaTest::testConstructor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 12
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
namespace Graze\Sprout\Test\Unit\Parser;
4
5
use Graze\Sprout\Config\SchemaConfigInterface;
6
use Graze\Sprout\Parser\ParsedSchema;
7
use Graze\Sprout\Test\TestCase;
8
use Mockery;
9
10
class ParsedSchemaTest extends TestCase
11
{
12
    public function testConstructor()
13
    {
14
        $configuration = Mockery::mock(SchemaConfigInterface::class);
15
        $configuration->allows()
16
                      ->getSchema()
0 ignored issues
show
Bug introduced by
The method getSchema() does not exist on Mockery\Expectation. ( Ignorable by Annotation )

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

16
                      ->/** @scrutinizer ignore-call */ getSchema()

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug introduced by
The method getSchema() does not exist on Mockery\ExpectationInterface. It seems like you code against a sub-type of Mockery\ExpectationInterface such as Mockery\CompositeExpectation. ( Ignorable by Annotation )

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

16
                      ->/** @scrutinizer ignore-call */ getSchema()
Loading history...
17
                      ->andReturns('the_schema');
18
        $parsedSchema = new ParsedSchema($configuration, 'path', ['table1', 'table2']);
0 ignored issues
show
Bug introduced by
$configuration of type Mockery\MockInterface is incompatible with the type Graze\Sprout\Config\SchemaConfigInterface expected by parameter $schemaConfig of Graze\Sprout\Parser\ParsedSchema::__construct(). ( Ignorable by Annotation )

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

18
        $parsedSchema = new ParsedSchema(/** @scrutinizer ignore-type */ $configuration, 'path', ['table1', 'table2']);
Loading history...
19
20
        $this->assertSame($configuration, $parsedSchema->getSchemaConfig());
21
        $this->assertEquals('the_schema', $parsedSchema->getSchemaName());
22
        $this->assertEquals('path', $parsedSchema->getPath());
23
        $this->assertEquals(['table1', 'table2'], $parsedSchema->getTables());
24
    }
25
26
    public function testTheTablesCanBeChanged()
27
    {
28
        $configuration = Mockery::mock(SchemaConfigInterface::class);
29
        $parsedSchema = new ParsedSchema($configuration, 'path', []);
0 ignored issues
show
Bug introduced by
$configuration of type Mockery\MockInterface is incompatible with the type Graze\Sprout\Config\SchemaConfigInterface expected by parameter $schemaConfig of Graze\Sprout\Parser\ParsedSchema::__construct(). ( Ignorable by Annotation )

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

29
        $parsedSchema = new ParsedSchema(/** @scrutinizer ignore-type */ $configuration, 'path', []);
Loading history...
30
31
        $this->assertSame($configuration, $parsedSchema->getSchemaConfig());
32
        $this->assertEquals([], $parsedSchema->getTables());
33
34
        $this->assertSame($parsedSchema, $parsedSchema->setTables(['table1', 'table2', 'table3']));
35
        $this->assertEquals(['table1', 'table2', 'table3'], $parsedSchema->getTables());
36
    }
37
}
38