-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Добавлен метод addFindPartReferences, некоторые тесты
Добавлен метод addFindPartReferences , написаны тесты для Query и QueryBuilder, подключен travis для сборки.
- Loading branch information
Showing
8 changed files
with
98 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
language: php | ||
|
||
matrix: | ||
include: | ||
- php: 7.2 | ||
- php: 7.3 | ||
- php: 7.4 | ||
|
||
before_script: | ||
- composer install | ||
|
||
script: | ||
- ./vendor/bin/phpunit --bootstrap vendor/autoload.php Tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
|
||
namespace shude\Laximo\Tests\Query; | ||
|
||
|
||
use PHPUnit\Framework\TestCase; | ||
use shude\Laximo\Query\Query; | ||
use shude\Laximo\Query\QueryBuilder; | ||
|
||
final class QueryBuilderTest extends TestCase | ||
{ | ||
public function testBuildCorrectQueryStringWithOneQuery() | ||
{ | ||
$query = $this->createMock(Query::class); | ||
$query->method('getQueryString')->willReturn('Some command'); | ||
|
||
$builder = new QueryBuilder(); | ||
$builder->addQuery($query); | ||
|
||
$this->assertEquals('Some command',$builder->buildQueryString()); | ||
} | ||
|
||
public function testBuildCorrectQueryStringWithMultiQueries() | ||
{ | ||
$query = $this->createMock(Query::class); | ||
$query->method('getQueryString')->will( | ||
$this->onConsecutiveCalls('First', 'Second') | ||
); | ||
|
||
$builder = new QueryBuilder(); | ||
$builder->addQuery($query); | ||
$builder->addQuery($query); | ||
|
||
$this->assertEquals("First\nSecond",$builder->buildQueryString()); | ||
} | ||
|
||
public function testClearWorksCorrectly() | ||
{ | ||
$query = $this->createMock(Query::class); | ||
$query->method('getQueryString')->willReturn('Some command'); | ||
|
||
$builder = new QueryBuilder(); | ||
$builder->addQuery($query); | ||
$builder->clear(); | ||
|
||
$this->assertEmpty($builder->buildQueryString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
|
||
namespace shude\Laximo\Tests\Query; | ||
|
||
|
||
use PHPUnit\Framework\TestCase; | ||
use shude\Laximo\Query\Query; | ||
|
||
final class QueryTest extends TestCase | ||
{ | ||
public function testBuildCorrectQueryString() | ||
{ | ||
$query = new Query('test_command',['param1'=>'value1', 'param2' => 'value2']); | ||
|
||
$this->assertEquals('test_command:param1=value1|param2=value2', $query->getQueryString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,8 @@ | |
"exclude-from-classmap": [ | ||
"/Tests/" | ||
] | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^8" | ||
} | ||
} |