public function testDbTableAbstractFactory__canCreateIfConfigExist()
 {
     $createStatementStr = 'CREATE TEMPORARY TABLE IF NOT EXISTS test_res_tablle (id INT)';
     $createStatement = $this->adapter->query($createStatementStr);
     $createStatement->execute();
     $container = (include 'config/container.php');
     $requestedName = 'testDbTable';
     $result = $this->object->canCreate($container, $requestedName);
     $this->assertSame(true, $result);
 }
 public function testTableGatewayAbstractFactory__canCreateIfTableExist()
 {
     $createStatementStr = 'CREATE TABLE IF NOT EXISTS tbl_name_which_exist (id INT)';
     $createStatement = $this->adapter->query($createStatementStr);
     $createStatement->execute();
     $requestedName = 'tbl_name_which_exist';
     $result = $this->object->canCreate($this->container, $requestedName);
     $this->assertSame(true, $result);
     $createStatementStr = 'DROP TABLE IF EXISTS tbl_name_which_exist';
     $createStatement = $this->adapter->query($createStatementStr);
     $createStatement->execute();
 }
 public function testTableGatewayAbstractFactory__invokeIfTableAbsent()
 {
     $createStatementStr = 'CREATE TABLE IF NOT EXISTS tbl_name_which_exist (id INT)';
     $createStatement = $this->adapter->query($createStatementStr);
     $createStatement->execute();
     $requestedName = 'tbl_name_which_exist';
     if ($this->object->canCreate($this->container, $requestedName)) {
         $result = $this->object->__invoke($this->container, $requestedName);
     }
     $this->assertSame('Zend\\Db\\TableGateway\\TableGateway', get_class($result));
     $createStatementStr = 'DROP TABLE IF EXISTS tbl_name_which_exist';
     $createStatement = $this->adapter->query($createStatementStr);
     $createStatement->execute();
 }
Exemplo n.º 4
0
 public function test__canCreateIfConfigAbsent()
 {
     $requestedName = 'the_name_which_has_not_config';
     $result = $this->object->canCreate($this->container, $requestedName);
     $this->assertSame(false, $result);
 }