Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d50c95d
commit b528f17
Showing
4 changed files
with
140 additions
and
3 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
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,136 @@ | ||
<?php | ||
|
||
namespace Compolomus\LSQLQueryBuilder\Tests; | ||
|
||
use Compolomus\LSQLQueryBuilder\Builder; | ||
use Compolomus\LSQLQueryBuilder\BuilderFactory; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class BuilderTest extends TestCase | ||
{ | ||
|
||
public function test__construct(): void | ||
{ | ||
try { | ||
$builder = new Builder(); | ||
$this->assertInternalType('object', $builder); | ||
$this->assertInstanceOf(Builder::class, $builder); | ||
} catch (\Exception $e) { | ||
$this->assertContains('Must be initialized ', $e->getMessage()); | ||
} | ||
} | ||
|
||
public function testTable(): void | ||
{ | ||
$builder = new Builder(); | ||
$this->assertEquals('', $builder->table()); | ||
} | ||
|
||
public function testEscapeField(): void | ||
{ | ||
$builder = new Builder(); | ||
$testString = 'Dummy'; | ||
$testArray = ['Dummy', 'Dummy']; | ||
$this->assertEquals($builder->escapeField($testString), '`Dummy`'); | ||
$this->assertEquals($builder->escapeField($testArray), ['`Dummy`', '`Dummy`']); | ||
} | ||
|
||
public function testSetTable(): void | ||
{ | ||
$builder = new Builder('Dummy'); | ||
$this->assertEquals('`Dummy`', $builder->table()); | ||
} | ||
|
||
public function testFactory(): void | ||
{ | ||
$builder = (new BuilderFactory)('Dummy'); | ||
$this->assertInstanceOf(Builder::class, $builder); | ||
$this->assertEquals('`Dummy`', $builder->table()); | ||
} | ||
|
||
// public function testConcat() | ||
// { | ||
// | ||
// } | ||
// | ||
// public function testInsert() | ||
// { | ||
// | ||
// } | ||
// | ||
// public function test__isset() | ||
// { | ||
// | ||
// } | ||
// | ||
|
||
// | ||
// public function test__call() | ||
// { | ||
// | ||
// } | ||
// | ||
// public function testMap() | ||
// { | ||
// | ||
// } | ||
// | ||
// public function test__unset() | ||
// { | ||
// | ||
// } | ||
// | ||
// public function test__set() | ||
// { | ||
// | ||
// } | ||
// | ||
// public function testDelete() | ||
// { | ||
// | ||
// } | ||
// | ||
// public function testPlaceholders() | ||
// { | ||
// | ||
// } | ||
// | ||
// public function testConcatOrder() | ||
// { | ||
// | ||
// } | ||
// | ||
|
||
// | ||
// public function testAddPlaceholders() | ||
// { | ||
// | ||
// } | ||
// | ||
|
||
// | ||
// public function testUpdate() | ||
// { | ||
// | ||
// } | ||
// | ||
// public function testSelect() | ||
// { | ||
// | ||
// } | ||
// | ||
// public function test__get() | ||
// { | ||
// | ||
// } | ||
// | ||
// public function testConcatWhere() | ||
// { | ||
// | ||
// } | ||
// | ||
// public function testUid() | ||
// { | ||
// | ||
// } | ||
} |