Skip to content

Commit

Permalink
added Nette\Tester
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Dec 4, 2012
1 parent b4de8da commit 6c82e77
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 1,186 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/tools
/composer.lock
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
"homepage": "http://davidgrudl.com"
}
],
"require-dev": {
"nette/tester": "@dev"
},
"config": {
"vendor-dir": "tools"
},
"autoload": {
"classmap": ["dibi/"]
}
Expand Down
45 changes: 8 additions & 37 deletions tests/DibiFluent.cloning.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
* Test: Cloning of DibiFluent
*
* @author David Grudl
* @category Dibi
* @subpackage UnitTests
*/



require dirname(__FILE__) . '/initialize.php';
require dirname(__FILE__) . '/bootstrap.php';



dibi::connect($config['sqlite']);
dibi::connect($config['sqlite3']);


$fluent = new DibiFluent(dibi::getConnection());
Expand All @@ -23,50 +21,23 @@ $dolly = clone $fluent;
$dolly->where('y=1');
$dolly->clause('FOO');

$fluent->test();
$dolly->test();
Assert::same( 'SELECT * FROM [table] WHERE x=1', (string) $fluent );
Assert::same( 'SELECT * FROM [table] WHERE x=1 AND y=1 FOO', (string) $dolly );



$fluent = dibi::select('id')->from('table')->where('id = %i',1);
$dolly = clone $fluent;
$dolly->where('cd = %i',5);

$fluent->test();
$dolly->test();
Assert::same( 'SELECT [id] FROM [table] WHERE id = 1', (string) $fluent );
Assert::same( 'SELECT [id] FROM [table] WHERE id = 1 AND cd = 5', (string) $dolly );



$fluent = dibi::select("*")->from("table");
$dolly = clone $fluent;
$dolly->removeClause("select")->select("count(*)");

$fluent->test();
$dolly->test();



__halt_compiler() ?>

------EXPECT------
SELECT *
FROM [table]
WHERE x=1

SELECT *
FROM [table]
WHERE x=1 AND y=1 FOO

SELECT [id]
FROM [table]
WHERE id = 1

SELECT [id]
FROM [table]
WHERE id = 1 AND cd = 5

SELECT *
FROM [table]

SELECT count(*)
FROM [table]
Assert::same( 'SELECT * FROM [table]', (string) $fluent );
Assert::same( 'SELECT count(*) FROM [table]', (string) $dolly );
138 changes: 0 additions & 138 deletions tests/NetteTest/Assert.php

This file was deleted.

43 changes: 0 additions & 43 deletions tests/NetteTest/RunTests.php

This file was deleted.

Loading

0 comments on commit 6c82e77

Please sign in to comment.