1 | <?php |
||||
2 | /** |
||||
3 | * This file is part of graze/sprout. |
||||
4 | * |
||||
5 | * Copyright © 2018 Nature Delivered Ltd. <https://www.graze.com> |
||||
6 | * |
||||
7 | * For the full copyright and license information, please view the LICENSE |
||||
8 | * file that was distributed with this source code. |
||||
9 | * |
||||
10 | * @license https://github.com/graze/sprout/blob/master/LICENSE.md |
||||
11 | * @link https://github.com/graze/sprout |
||||
12 | */ |
||||
13 | |||||
14 | namespace Graze\Sprout\Test\Unit\Parser; |
||||
15 | |||||
16 | use Graze\Sprout\Config\SchemaConfigInterface; |
||||
17 | use Graze\Sprout\Parser\ParsedSchema; |
||||
18 | use Graze\Sprout\Test\TestCase; |
||||
19 | use Mockery; |
||||
20 | |||||
21 | class ParsedSchemaTest extends TestCase |
||||
22 | { |
||||
23 | public function testConstructor() |
||||
24 | { |
||||
25 | $configuration = Mockery::mock(SchemaConfigInterface::class); |
||||
26 | $configuration->allows() |
||||
27 | ->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
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. ![]() |
|||||
28 | ->andReturns('the_schema'); |
||||
29 | $parsedSchema = new ParsedSchema($configuration, 'path', ['table1', 'table2']); |
||||
0 ignored issues
–
show
$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
![]() |
|||||
30 | |||||
31 | $this->assertSame($configuration, $parsedSchema->getSchemaConfig()); |
||||
32 | $this->assertEquals('the_schema', $parsedSchema->getSchemaName()); |
||||
33 | $this->assertEquals('path', $parsedSchema->getPath()); |
||||
34 | $this->assertEquals(['table1', 'table2'], $parsedSchema->getTables()); |
||||
35 | } |
||||
36 | |||||
37 | public function testTheTablesCanBeChanged() |
||||
38 | { |
||||
39 | $configuration = Mockery::mock(SchemaConfigInterface::class); |
||||
40 | $parsedSchema = new ParsedSchema($configuration, 'path', []); |
||||
0 ignored issues
–
show
$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
![]() |
|||||
41 | |||||
42 | $this->assertSame($configuration, $parsedSchema->getSchemaConfig()); |
||||
43 | $this->assertEquals([], $parsedSchema->getTables()); |
||||
44 | |||||
45 | $this->assertSame($parsedSchema, $parsedSchema->setTables(['table1', 'table2', 'table3'])); |
||||
46 | $this->assertEquals(['table1', 'table2', 'table3'], $parsedSchema->getTables()); |
||||
47 | } |
||||
48 | } |
||||
49 |