-
Notifications
You must be signed in to change notification settings - Fork 1
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
Gusakov Nikita
committed
Apr 21, 2014
1 parent
d4f6937
commit 4d2c661
Showing
6 changed files
with
98 additions
and
5 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,16 @@ | ||
language: php | ||
|
||
before_script: | ||
- composer install --dev --prefer-source | ||
|
||
script: vendor/bin/phpunit | ||
|
||
php: | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- hhvm | ||
|
||
matrix: | ||
allow_failures: | ||
- php: hhvm |
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,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
syntaxCheck="false" | ||
bootstrap="vendor/autoload.php" | ||
> | ||
<testsuites> | ||
<testsuite name="Flame Test Suite"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
<directory>src</directory> | ||
</whitelist> | ||
</filter> | ||
<logging> | ||
<log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/> | ||
</logging> | ||
</phpunit> |
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,47 @@ | ||
<?php | ||
|
||
namespace Flame\Test; | ||
|
||
use Flame\Connection; | ||
|
||
class ConnectionTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var Connection | ||
*/ | ||
private $connection; | ||
|
||
protected function setUp() | ||
{ | ||
$this->connection = new Connection('sqlite::memory:'); | ||
$this->connection->query('CREATE TABLE users (id INT PRIMARY KEY, username CHAR(50), sex BOOL)'); | ||
} | ||
|
||
public function testFluent() | ||
{ | ||
$this->assertSame($this->connection, $this->connection->beginTransaction()); | ||
$this->connection->query("INSERT INTO users(username) VALUES('John Doe')"); | ||
$this->assertSame($this->connection, $this->connection->rollback()); | ||
$this->assertEmpty($this->connection->query('SELECT * FROM users')->fetchAll()); | ||
} | ||
|
||
public function testParser() | ||
{ | ||
$stmt = $this->connection->prepare('SELECT * FROM users WHERE id IN(:default, s:string, i:int, f:float, b:bool, n:null, l:lob)'); | ||
|
||
$this->assertSame('SELECT * FROM users WHERE id IN(?, ?, ?, ?, ?, ?, ?)', $stmt->queryString); | ||
$this->assertSame( | ||
array('default', 'string', 'int', 'float', 'bool', 'null', 'lob'), | ||
$this->getObjectAttribute($stmt, 'placeholders') | ||
); | ||
$this->assertSame(array( | ||
'default' => \PDO::PARAM_STR, | ||
'string' => \PDO::PARAM_STR, | ||
'int' => \PDO::PARAM_INT, | ||
'float' => \PDO::PARAM_STR, | ||
'bool' => \PDO::PARAM_BOOL, | ||
'null' => \PDO::PARAM_NULL, | ||
'lob' => \PDO::PARAM_LOB | ||
), $this->getObjectAttribute($stmt, 'types')); | ||
} | ||
} |