summaryrefslogtreecommitdiff
path: root/tests/unit/Testing/Data/Analysis/TDbStatementAnalysisTest.php
diff options
context:
space:
mode:
authorgodzilla80@gmx.net <>2010-02-13 19:04:45 +0000
committergodzilla80@gmx.net <>2010-02-13 19:04:45 +0000
commit966fd66f217911d079c4bd6a87b09f4a0c5c4736 (patch)
tree26d4cda965ed5a6ddf2aeb805fcef42877584fd3 /tests/unit/Testing/Data/Analysis/TDbStatementAnalysisTest.php
parent879cced5e01d43378065c938483b55a35ff10834 (diff)
NEW: Add Beta of master/slave senario solution
- add package System.Testing.Data.Analysis - add package System.Testing.Data.Distributed - add sub package System.Testing.Data.Distributed.MasterSlave - add unittest for System.Testing.Data.Analysis
Diffstat (limited to 'tests/unit/Testing/Data/Analysis/TDbStatementAnalysisTest.php')
-rw-r--r--tests/unit/Testing/Data/Analysis/TDbStatementAnalysisTest.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/unit/Testing/Data/Analysis/TDbStatementAnalysisTest.php b/tests/unit/Testing/Data/Analysis/TDbStatementAnalysisTest.php
new file mode 100644
index 00000000..70437816
--- /dev/null
+++ b/tests/unit/Testing/Data/Analysis/TDbStatementAnalysisTest.php
@@ -0,0 +1,62 @@
+<?php
+require_once dirname(__FILE__).'/../../../phpunit.php';
+
+Prado::using('System.Testing.Data.Analysis.TDbStatementAnalysis');
+
+/**
+ * @package System.Testing.Data.Analysis
+ */
+class TDbStatementAnalysisTest extends PHPUnit_Framework_TestCase
+{
+ private $analyser;
+
+ public function setUp()
+ {
+ $this->analyser = new TDbStatementAnalysis();
+ }
+
+ public function tearDown()
+ {
+ $this->analyser = null;
+ }
+
+ public function testStaticClassificationAnalysis()
+ {
+ $parameter = new TDbStatementAnalysisParameter();
+ self::assertEquals(TDbStatementClassification::UNKNOWN, TDbStatementAnalysis::doClassificationAnalysis($parameter));
+
+ $parameter = new TDbStatementAnalysisParameter('SELECT 1');
+ self::assertEquals(TDbStatementClassification::UNKNOWN, TDbStatementAnalysis::doClassificationAnalysis($parameter));
+
+ $parameter = new TDbStatementAnalysisParameter('SELECT 1', TDbStatementClassification::SQL);
+ self::assertEquals(TDbStatementClassification::SQL, TDbStatementAnalysis::doClassificationAnalysis($parameter));
+ }
+
+ public function testDriverName()
+ {
+ self::assertNull($this->analyser->getDriverName());
+
+ $this->analyser->setDriverName('mysql');
+ self::assertEquals('mysql', $this->analyser->getDriverName());
+
+ $this->analyser->setDriverName('mssql');
+ self::assertEquals('mssql', $this->analyser->getDriverName());
+
+ $this->analyser->setDriverName(null);
+ self::assertNull($this->analyser->getDriverName());
+ }
+
+ public function testClassificationAnalysis()
+ {
+ $parameter = new TDbStatementAnalysisParameter();
+ self::assertEquals(TDbStatementClassification::UNKNOWN, $this->analyser->getClassificationAnalysis($parameter));
+
+ $parameter = new TDbStatementAnalysisParameter('SELECT 1');
+ self::assertEquals(TDbStatementClassification::UNKNOWN, $this->analyser->getClassificationAnalysis($parameter));
+
+ $parameter = new TDbStatementAnalysisParameter('SELECT 1', TDbStatementClassification::SQL);
+ self::assertEquals(TDbStatementClassification::SQL, $this->analyser->getClassificationAnalysis($parameter));
+ }
+
+}
+?> \ No newline at end of file