protected function newConnection(URL $url) { return newinstance(Connection::class, [$url], ['response' => '', 'sent' => null, 'in' => null, 'out' => null, '__construct' => function ($url) { parent::__construct($url); $this->_connect($url); // FIXME: Required for unittest }, '_connect' => function (URL $url) { $this->in = new StringReader(new MemoryInputStream($this->response)); $this->out = new StringWriter(new MemoryOutputStream()); }, '_disconnect' => function () { $this->sent = $this->out->getStream()->getBytes(); $this->in = null; $this->out = null; }, 'setResponseBytes' => function ($s) { $this->in = new StringReader(new MemoryInputStream($s)); $this->response = $s; }, 'readSentBytes' => function () { // Case of DISCONNECT if (null !== $this->sent) { $sent = $this->sent; $this->sent = null; return $sent; } return $this->out->getStream()->getBytes(); }, 'clearSentBytes' => function () { $this->_connect(new URL()); $this->sent = null; }]); }
/** * Creates a new test * * @param string $name * @param string $input A path or a file */ public function __construct($name, $input) { parent::__construct($name); if (is_file($input)) { $this->input = [new FileElement($input)]; } else { $this->input = new FilteredIOCollectionIterator(new FileCollection($input), new NameEqualsFilter('uber.json'), true); } }
/** * Constructor * */ public function __construct($name, $url = null, $user = null, $pass = null) { parent::__construct($name); if (null !== $url) { $this->url = new URL($url); $this->url->setUser($user); $this->url->setPassword($pass); } }
/** * Set up this test case. Creates connection. * * @param string $name * @param string $url */ public function __construct($name, $url = null) { parent::__construct($name); $class = $this->getClass(); if ($class->hasAnnotation('webtest', 'url')) { $this->conn = $this->getConnection($class->getAnnotation('webtest', 'url')); } else { $this->conn = $this->getConnection($url); } }
/** * Set up this test case. Creates connection. * */ public function __construct($name, $url = null) { parent::__construct($name); $this->conn = $this->getConnection($url); }
/** * Constructor * @param string $name * @param string $target The directory in which the spec files exist */ public function __construct($name, $target = null) { parent::__construct($name); $this->target = $target; }
/** * Fill conn and dialectClass members */ public function __construct($name) { parent::__construct($name); $this->conn[self::MYSQL] = new MySQLConnection(new \rdbms\DSN('mysql://localhost:3306/')); $this->conn[self::SYBASE] = new SybaseConnection(new \rdbms\DSN('sybase://localhost:1999/')); }
public function __construct($name, $host = null) { parent::__construct($name); $this->host = $host; }
/** * Constructor * * @param string $name * @param string $folder Folder with `test_parsing` inside */ public function __construct($name, $folder = '.') { parent::__construct($name); $this->parsing = new Folder($folder, 'test_parsing'); $this->transform = new Folder($folder, 'test_transform'); }