- 浏览: 2539136 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
PHP Backend Application(4)Mysql Advanced and Eclipse with PHPUnit
1 MySQL Advanced Operation
FIND_IN_SET is not using index, it is said.
public function getStateIDsByZipCodes($zipCodes)
{
//set up base features
$logger = $this->ioc->getService("logger");
$query = "
SELECT
zipcode,
statesid
FROM
zipcities
WHERE
find_in_set(zipcode, ?)
";
//prepare params
$zipParam = implode(",", $zipCodes);
$logger->debug("getStateIDsByZipCodes params--------------");
$logger->debug("zipParam = " . $zipParam);
$logger->debug("------------------------------------------");
$conn = $this->getStatsDBConn();
$stmt = $conn->prepare($query);
$stmt->bind_param("s", $zipParam);
$stmt->execute();
$result = $stmt->get_result();
//fetch all the rows
$data = $result->fetch_all(MYSQLI_ASSOC);
$this->closeDBConn($conn);
return $data;
}
So I plan to change that to IN
//prepare params
$zipParam = "(".implode(",", $zipCodes).")";
$logger->debug("getStateIDsByZipCodes params--------------");
$logger->debug("zipParam = " . $zipParam);
$logger->debug("------------------------------------------");
$query = "
SELECT
zipcode,
statesid
FROM
zipcities
WHERE
zipcode IN $zipParam
";
2 ECLIPSE and PHPUNIT
Go to “Eclipse Marketplace” and Search for “MakeGood”, accept and install that plugin.
http://kumamidori.github.io/php/2014/11/24/makegood_composer/
https://github.com/piece/makegood/releases
I create a class named tests/bootstrap_test.php
<?php
require __DIR__.'/../vendor/autoload.php';
?>
Change the phpunit.xml as follow
<phpunit bootstrap="tests/bootstrap_test.php">
<testsuites>
<testsuite name="unitsuite">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
Set the MakeGood Configuration as follow:
PHPUnit
Test Folders = /projectname/tests/namespace_directory
Preload Script: /projectname/tests/bootstrap_test.php
XML Configuration File: /projectname/phpunit.xml
That is all I have, I may put more initiation actions in bootstrap_test.php later, but till now, it is good.
Check PHPUNIT Version
> phpunit --version
PHPUnit 5.4.2 by Sebastian Bergmann and contributors.
In the composer.json, if I have the latest version of phpunit, I will get some exceptions as follow:
"require-dev": {
"php": ">=5.3.0",
"phpunit/phpunit": ">=5.4.2",
"phpunit/dbunit": ">=1.2",
"phpunit/php-invoker": "*"
}
Fatal error: Call to undefined method PHPUnit_Util_Configuration::getSeleniumBrowserConfiguration() in /Applications/Eclipse.app/Contents/Eclipse/plugins/com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510/resources/php/vendor/piece/stagehand-testrunner/src/Preparer/PHPUnitPreparer.php on line 128
I think it is related to the version of MakeGood=3.1.1 and PHPUNIT=5.4.4
So I change the configuration to downgrade the version
"require-dev": {
"php": ">=5.3.0",
"phpunit/phpunit": "^4",
"phpunit/dbunit": ">=1.2",
"phpunit/php-invoker": "*"
}
PHPUNIT=4.8.26, it throw new exceptions:
[PHPUnit_Framework_Exception]
Argument #3 (No Value) of PHPUnit_TextUI_ResultPrinter::__construct() must be a value from "never", "auto" or "always"
Then I check the phpunit version list from this URL
https://packagist.org/packages/phpunit/phpunit
I tried the version as follow, it works perfectly.
"require-dev": {
"php": ">=5.3.0",
"phpunit/phpunit": "~4.5.1",
"phpunit/dbunit": ">=1.2",
"phpunit/php-invoker": "*"
}
By the way, I am using Eclipse latest version right now, it is
Eclipse for PHP Developers
Version: Neon Release Candidate 3 (4.6.0RC3)
Build id: 20160602-0837
References:
Exception Handler
http://blog.csdn.net/hguisu/article/details/7464977
http://php.net/manual/en/language.exceptions.php
1 MySQL Advanced Operation
FIND_IN_SET is not using index, it is said.
public function getStateIDsByZipCodes($zipCodes)
{
//set up base features
$logger = $this->ioc->getService("logger");
$query = "
SELECT
zipcode,
statesid
FROM
zipcities
WHERE
find_in_set(zipcode, ?)
";
//prepare params
$zipParam = implode(",", $zipCodes);
$logger->debug("getStateIDsByZipCodes params--------------");
$logger->debug("zipParam = " . $zipParam);
$logger->debug("------------------------------------------");
$conn = $this->getStatsDBConn();
$stmt = $conn->prepare($query);
$stmt->bind_param("s", $zipParam);
$stmt->execute();
$result = $stmt->get_result();
//fetch all the rows
$data = $result->fetch_all(MYSQLI_ASSOC);
$this->closeDBConn($conn);
return $data;
}
So I plan to change that to IN
//prepare params
$zipParam = "(".implode(",", $zipCodes).")";
$logger->debug("getStateIDsByZipCodes params--------------");
$logger->debug("zipParam = " . $zipParam);
$logger->debug("------------------------------------------");
$query = "
SELECT
zipcode,
statesid
FROM
zipcities
WHERE
zipcode IN $zipParam
";
2 ECLIPSE and PHPUNIT
Go to “Eclipse Marketplace” and Search for “MakeGood”, accept and install that plugin.
http://kumamidori.github.io/php/2014/11/24/makegood_composer/
https://github.com/piece/makegood/releases
I create a class named tests/bootstrap_test.php
<?php
require __DIR__.'/../vendor/autoload.php';
?>
Change the phpunit.xml as follow
<phpunit bootstrap="tests/bootstrap_test.php">
<testsuites>
<testsuite name="unitsuite">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
Set the MakeGood Configuration as follow:
PHPUnit
Test Folders = /projectname/tests/namespace_directory
Preload Script: /projectname/tests/bootstrap_test.php
XML Configuration File: /projectname/phpunit.xml
That is all I have, I may put more initiation actions in bootstrap_test.php later, but till now, it is good.
Check PHPUNIT Version
> phpunit --version
PHPUnit 5.4.2 by Sebastian Bergmann and contributors.
In the composer.json, if I have the latest version of phpunit, I will get some exceptions as follow:
"require-dev": {
"php": ">=5.3.0",
"phpunit/phpunit": ">=5.4.2",
"phpunit/dbunit": ">=1.2",
"phpunit/php-invoker": "*"
}
Fatal error: Call to undefined method PHPUnit_Util_Configuration::getSeleniumBrowserConfiguration() in /Applications/Eclipse.app/Contents/Eclipse/plugins/com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510/resources/php/vendor/piece/stagehand-testrunner/src/Preparer/PHPUnitPreparer.php on line 128
I think it is related to the version of MakeGood=3.1.1 and PHPUNIT=5.4.4
So I change the configuration to downgrade the version
"require-dev": {
"php": ">=5.3.0",
"phpunit/phpunit": "^4",
"phpunit/dbunit": ">=1.2",
"phpunit/php-invoker": "*"
}
PHPUNIT=4.8.26, it throw new exceptions:
[PHPUnit_Framework_Exception]
Argument #3 (No Value) of PHPUnit_TextUI_ResultPrinter::__construct() must be a value from "never", "auto" or "always"
Then I check the phpunit version list from this URL
https://packagist.org/packages/phpunit/phpunit
I tried the version as follow, it works perfectly.
"require-dev": {
"php": ">=5.3.0",
"phpunit/phpunit": "~4.5.1",
"phpunit/dbunit": ">=1.2",
"phpunit/php-invoker": "*"
}
By the way, I am using Eclipse latest version right now, it is
Eclipse for PHP Developers
Version: Neon Release Candidate 3 (4.6.0RC3)
Build id: 20160602-0837
References:
Exception Handler
http://blog.csdn.net/hguisu/article/details/7464977
http://php.net/manual/en/language.exceptions.php
发表评论
-
Stop Update Here
2020-04-28 09:00 310I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 465NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 361Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 362Docker Swarm 2020(1)Simply Inst ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 328Traefik 2020(1)Introduction and ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 419Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 428Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 364Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 444VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 376Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 462NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 413Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 330Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 242GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 443GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 320GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 306Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 310Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 284Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(1)Running with Component
2020-02-19 01:17 302Serverless with NodeJS and Tenc ...
相关推荐
This book will get you started with the latest benchmarking, profiling and monitoring tools for PHP, MySQL and JavaScript using Docker-based technologies. From optimizing PHP 7 code to learning ...
php mysql html form generator using this script you can generate html form for your website and it gives out php script and mysql db schema for you to use with out any coding knowledge
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
在本教程中,我们将深入探讨如何在Linux环境中源码安装MySQL、MySQL主从复制、Nginx、Nginx负载均衡、Redis... ./configure --prefix=/usr/local/php --with-config-file-path=/etc --with-config-file-scan-dir=/etc/...
Full-Stack Vue.js 2 and Laravel 5 Bring the frontend and backend together with Vue, Vuex, and Laravel 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网...
The book will then focus on writing extendable RxPHP code by developing a code testing tool and also cover Using RxPHP on both the server and client side of the application. With a concluding chapter...
You start with developing a backend web application followed by a frontend interface, and later on deploy it to the cloud platform. This book takes a holistic approach to server-side programming ...
在项目"Backend_Application-main"中,我们可以期待找到与上述知识点相关的源代码、配置文件和资源。通过阅读和分析这些内容,可以深入理解一个基于Java的后端应用是如何设计和实现的。开发者可能还使用了Maven或...
Anyone working with applications that use a MySQL database backend will benefit greatly from the advice and techniques in this book. Although a working knowledge of both SQL and MySQL is assumed, the...
along with Kotlin to build a robust backend in a microservice architecture with a REST based collaboration, and leverage Project Reactor in your application. You’ll then learn how to integrate Spring...
building real-world, productive and fun applications like text editor, drum machine, game of chess, media player, drawing application and many more. Each subsequent project builds on the skills ...
### Nginx+Apache+MySQL+PHP+Memcached+Squid 搭建门户网站 #### 一、前言与架构概述 随着互联网技术的发展,如何构建一个高效、稳定且能够应对高并发访问的Web服务器成为了许多企业和开发者关注的重点。本文将...
You will also implement various native plugins and integrate them with Ionic and Ionic Cloud services to use them optimally in your application. By this time, you will be able to create a full-...
This book provides more practical insights rather than just theoretical concepts and includes basic to advanced examples – from hello world to a real-time seat booking app and Helpdesk application ...
3. **数据库服务**:作为一个 PaaS 平台,1backend 很可能提供了数据库服务,如 MySQL、PostgreSQL 或 NoSQL 数据库,以便用户可以轻松地存储和访问数据。 4. **身份验证与授权**:安全是任何服务的重要组成部分,1...