|
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() |
|
|
|
|
|
|
17
|
|
|
->andReturns('the_schema'); |
|
18
|
|
|
$parsedSchema = new ParsedSchema($configuration, 'path', ['table1', 'table2']); |
|
|
|
|
|
|
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', []); |
|
|
|
|
|
|
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
|
|
|
|
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.