public function getConnection() { if ($this->conn === null) { $dsn = 'mysql:dbname=' . $_SERVER['PM_UNIT_DB_NAME'] . ';host=' . $_SERVER['PM_UNIT_DB_HOST']; if (self::$pdo == null) { self::$pdo = new PDO($dsn, $_SERVER['PM_UNIT_DB_USER'], $_SERVER['PM_UNIT_DB_PASS']); } $this->conn = $this->createDefaultDBConnection(self::$pdo, $_SERVER['PM_UNIT_DB_NAME']); } return $this->conn; }
private function getContentNode() { if (self::$_contentNode == null) { // Create a new content node in the company home $this->fileName = "1myDoc_" . time() . ".txt"; self::$_contentNode = $this->getCompanyHome()->createChild("cm_content", "cm_contains", "app_" . $this->fileName); self::$_contentNode->cm_name = $this->fileName; // Add titled aspect for UI self::$_contentNode->addAspect("cm_titled"); self::$_contentNode->cm_title = "This is my new document."; self::$_contentNode->cm_description = "This describes what is in the document."; // Save new content $this->getSession()->save(); } return self::$_contentNode; }
} catch (Exception $e) { return $e; } return $res; } } $obj = new Content(); //$t = new lime_test( 5, new lime_output_color() ); $t = new lime_test(12, new lime_output_color()); $t->diag('class Content'); $t->isa_ok($obj, 'Content', 'class Content created'); $t->todo('review all combinations of is_utf8 '); $t->todo('review is_utf8 should be in another class'); //Initialize the global domain (It is optional) $testDomain = new ymlDomain(); $test = new ContentTest('content.yml', $t, $testDomain); //check if an row exists, $test->load('loadContent'); $test->runSingle(); //check if an row exists, $test->load('deleteContent'); $test->runAll(); $test->load('addContentAcentos'); $test->runSingle(); //add the same row twice, the first time goes good, but the second the class throw an error $test->load('addContent1'); $test->runSingle(); $test->load('addContentTwice'); $test->runSingle(); $test->load('loadContent'); $test->runSingle();
protected function setUp() { $this->message = $this->createCommentary(); parent::setUp(); }