技術事業群-研發五處-帳號研發部-帳研B組Eric_Tu
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
工作技巧 === code riview 時可以善用git diff git diff HEAD ... XHELL 設定 http://www.cnblogs.com/greenerycn/archive/2010/05/01/xshell_tips.html https://kknews.cc/zh-tw/tech/lv4yg.html https://webtatic.com/packages/php56/ https://jonathansblog.co.uk/install-xdebug-in-centos7-with-php7 https://phpunit.de/manual/current/zh_cn/code-coverage-analysis.html linux shell: 安裝XDEBUG的時候遇到PHP的一些環境衝突 ``` sudo yum install php-xdebug ... Resolving Dependencies --> Running transaction check ---> Package php-pecl-xdebug.x86_64 0:2.2.7-1.el7 will be installed --> Processing Dependency: php(zend-abi) = 20100525-64 for package: php-pecl-xdebug-2.2.7-1.el7.x86_64 --> Processing Dependency: php(api) = 20100412-64 for package: php-pecl-xdebug-2.2.7-1.el7.x86_64 --> Processing Dependency: /usr/bin/pecl for package: php-pecl-xdebug-2.2.7-1.el7.x86_64 --> Processing Dependency: /usr/bin/pecl for package: php-pecl-xdebug-2.2.7-1.el7.x86_64 --> Running transaction check ---> Package php-common.x86_64 0:5.4.16-42.el7 will be installed ---> Package php-pear.noarch 1:1.9.4-21.el7 will be installed --> Processing Conflict: php56w-common-5.6.30-1.w7.x86_64 conflicts php-common < 5.6 --> Finished Dependency Resolution Error: php56w-common conflicts with php-common-5.4.16-42.el7.x86_64 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest ``` 首先先查看安裝過的檔案 想查看安裝過的檔案 可以下以下的指令: ``` rpm -qa|grep php yum list |grep php ``` ``` [eric_tu@localhost eric_tu]$ rpm -qa|grep php php56w-pdo-5.6.30-1.w7.x86_64 php56w-gd-5.6.30-1.w7.x86_64 php56w-mysql-5.6.30-1.w7.x86_64 php56w-mbstring-5.6.30-1.w7.x86_64 php56w-common-5.6.30-1.w7.x86_64 php56w-mcrypt-5.6.30-1.w7.x86_64 php56w-intl-5.6.30-1.w7.x86_64 php56w-5.6.30-1.w7.x86_64 php56w-xml-5.6.30-1.w7.x86_64 php56w-fpm-5.6.30-1.w7.x86_64 php56w-process-5.6.30-1.w7.x86_64 php56w-soap-5.6.30-1.w7.x86_64 php56w-cli-5.6.30-1.w7.x86_64 php56w-devel-5.6.30-1.w7.x86_64 php56w-opcache-5.6.30-1.w7.x86_64 ``` #### 安裝過程,環境有衝突。 ``` Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.vpshosting.com.hk * epel: ftp.cuhk.edu.hk * extras: mirror.vpshosting.com.hk * updates: mirror.vpshosting.com.hk * webtatic: sp.repo.webtatic.com Resolving Dependencies --> Running transaction check ---> Package php-pecl-xdebug.x86_64 0:2.2.7-1.el7 will be installed --> Processing Dependency: php(zend-abi) = 20100525-64 for package: php-pecl-xdebug-2.2.7-1.el7.x86_64 --> Processing Dependency: php(api) = 20100412-64 for package: php-pecl-xdebug-2.2.7-1.el7.x86_64 --> Processing Dependency: /usr/bin/pecl for package: php-pecl-xdebug-2.2.7-1.el7.x86_64 --> Processing Dependency: /usr/bin/pecl for package: php-pecl-xdebug-2.2.7-1.el7.x86_64 --> Running transaction check ---> Package php-common.x86_64 0:5.4.16-42.el7 will be installed ---> Package php-pear.noarch 1:1.9.4-21.el7 will be installed --> Processing Conflict: php56w-common-5.6.30-1.w7.x86_64 conflicts php-common < 5.6 --> Finished Dependency Resolution Error: php56w-common conflicts with php-common-5.4.16-42.el7.x86_64 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest ``` #### 解決 找到的方法大部分都是覆蓋掉PHP版本, 剛剛印出的rpm裡的套件名都帶php56, 所以用 php56w xdebug 去找找看。 找到這個網站,上面有所有相依的套件再去查xdebug相關的。 https://webtatic.com/packages/php56/ 找到 php56w-pecl-xdebug 。 裝下去! ``` sudo yum install php56w-pecl-xdebug ... ``` 確認看看... ``` [eric_tu@localhost eric_tu]$ rpm -qa|grep php php56w-pdo-5.6.30-1.w7.x86_64 php56w-gd-5.6.30-1.w7.x86_64 php56w-mysql-5.6.30-1.w7.x86_64 php56w-mbstring-5.6.30-1.w7.x86_64 php56w-common-5.6.30-1.w7.x86_64 php56w-mcrypt-5.6.30-1.w7.x86_64 php56w-intl-5.6.30-1.w7.x86_64 php56w-5.6.30-1.w7.x86_64 php56w-xml-5.6.30-1.w7.x86_64 php56w-fpm-5.6.30-1.w7.x86_64 php56w-process-5.6.30-1.w7.x86_64 php56w-soap-5.6.30-1.w7.x86_64 php56w-pecl-xdebug-2.5.3-1.w7.x86_64 php56w-cli-5.6.30-1.w7.x86_64 php56w-devel-5.6.30-1.w7.x86_64 php56w-opcache-5.6.30-1.w7.x86_64 php56w-pear-1.10.1-1.w7.noarch ``` 到symfony底下運行,打開phpunit -h 找到用法,可以開始看覆蓋率報告囉! ``` vendor/bin/phpunit -h vendor/bin/phpunit --coverage-html ./web/report.html links report.html/index.html http://test123/report.html/Controller/DefaultController.php.html ``` ``` [eric_tu@localhost eric_tu]$ rpm -qa|grep php php56w-pdo-5.6.30-1.w7.x86_64 php56w-gd-5.6.30-1.w7.x86_64 php56w-mysql-5.6.30-1.w7.x86_64 php56w-mbstring-5.6.30-1.w7.x86_64 php56w-common-5.6.30-1.w7.x86_64 php56w-mcrypt-5.6.30-1.w7.x86_64 php56w-intl-5.6.30-1.w7.x86_64 php56w-5.6.30-1.w7.x86_64 php56w-xml-5.6.30-1.w7.x86_64 php56w-fpm-5.6.30-1.w7.x86_64 php56w-process-5.6.30-1.w7.x86_64 php56w-soap-5.6.30-1.w7.x86_64 php56w-cli-5.6.30-1.w7.x86_64 php56w-devel-5.6.30-1.w7.x86_64 php56w-opcache-5.6.30-1.w7.x86_64 ``` https://webtatic.com/packages/php56/ https://webtatic.com/packages/php56/ https://webtatic.com/packages/php56/ https://webtatic.com/packages/php56/ https://stackoverflow.com/questions/34818749/405-method-not-allowed-in-symfony-3 --- http://linux.vbird.org/linux_basic/0520rpm_and_srpm.php [root@study ~]# rpm -qa <==已安裝軟體 [root@study ~]# rpm -q[licdR] 已安裝的軟體名稱 <==已安裝軟體 [root@study ~]# rpm -qf 存在於系統上面的某個檔名 <==已安裝軟體 [root@study ~]# rpm -qp[licdR] 未安裝的某個檔案名稱 <==查閱RPM檔案 選項與參數: 查詢已安裝軟體的資訊: -q :僅查詢,後面接的軟體名稱是否有安裝; -qa :列出所有的,已經安裝在本機 Linux 系統上面的所有軟體名稱; -qi :列出該軟體的詳細資訊 (information),包含開發商、版本與說明等; -ql :列出該軟體所有的檔案與目錄所在完整檔名 (list); -qc :列出該軟體的所有設定檔 (找出在 /etc/ 底下的檔名而已) -qd :列出該軟體的所有說明檔 (找出與 man 有關的檔案而已) -qR :列出與該軟體有關的相依軟體所含的檔案 (Required 的意思) -qf :由後面接的檔案名稱,找出該檔案屬於哪一個已安裝的軟體; -q --scripts:列出是否含有安裝後需要執行的腳本檔,可用以 debug 喔! 查詢某個 RPM 檔案內含有的資訊: -qp[icdlR]:注意 -qp 後面接的所有參數以上面的說明一致。但用途僅在於找出 某個 RPM 檔案內的資訊,而非已安裝的軟體資訊!注意! 因為在delete 測試的時候 不管有沒有那筆ID 成功或是失敗的response 有一個不會被run到 所以應該 在測試端寫兩種測試 一種新增厚找到ID刪掉ID 另一種是刪掉不存在ID ``` 331 /** 332 * Get a request and delete the message 333 * @Route("api/delete/{id}", name="deleteAPI") 334 */ 335 public function deleteActionAPI(Request $request, $id) 336 { 337 $em = $this->getDoctrine()->getManager(); 338 $messages = $em->getRepository('AppBundle:Message'); 339 340 if ($message = $messages->find($id)) { 341 $encodersArray = [ 342 new XmlEncoder(), 343 new JsonEncoder() 344 ]; 345 $normalizersArray = [new objectNormalizer()]; 346 $encoders = $encodersArray;; 347 $normalizers = $normalizersArray; 348 $serializer = new Serializer($normalizers, $encoders); 349 $json = $serializer->serialize($message, 'json'); 350 351 $em->remove($message); 352 $em->flush(); 353 354 return JsonResponse::create(json_decode($json, true), 200); 355 } else { 356 return JsonResponse::create("ID NOT FOUND", 404 ); 357 } 358 ``` phpunit 實戰教學 https://jaceju-books.gitbooks.io/phpunit-in-action/content/index.html --- ## AJAX ``` curl -X PUT "http://test123/api/edit/111" GG ``` up vote 4 down vote For others who wind up here like I did, you can use AJAX to do a PUT with parameters, but they are send as the body, not as query strings. --- https://phpunit.de/manual/current/zh_cn/test-doubles.html http://symfony.com/doc/current/testing/database.html 跑測試之後寫到測試資料庫 不影響現有資料 使用MOCK 來取得 並模擬返回值。 entity http://symfony.com/doc/current/testing/doctrine.html yield http://php.net/manual/zh/language.generators.syntax.php

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully