@hgsgtk
Kazuki Higashiguchi
job is … Software Engineer
lang is ... PHP, Go ...etc
belongs to ... BASE BANK株式会
社
(BASE株式会社の100%子会社)
at #phpstudy talked about …
CakePHP4.x / terraform /
ECS / Unit Testing
7
Slide 8
Slide 8 text
=
8
BASE BANK
Mission
「銀行をかんたんにし、全ての人が挑戦できる世の中に」
即座に資金調達ができる金融サービス「YELL BANK(エールバンク)」
https://thebase.in/yellbank
Slide 9
Slide 9 text
=
1. What is Unit testing?
2. Learn useful functions of PHPUnit
3. Clarify the intent of the test
4. Tear down completely
9
N=0; N++;
Unit Testing
~ One of Testing ways ~
12
WHAT
● Unit = アプリケーションのテスト可能な
最小の部品単位
● クラス・メソッドに対するテスト
● 主にプログラマによって作成される
WHY
● バグを見つける
● テスト対象のドキュメンテーション
● 設計の欠陥を明らかにする
...etc
Slide 13
Slide 13 text
Testing
Framework
ユニットテストの方法
13
● PHPUnit
○ https://phpunit.de/
○ PHPUnit is a programmer-oriented testing
framework for PHP.
○ xUnit architecture
● composer require --dev phpunit/phpunit
^7
Slide 14
Slide 14 text
=
● xUnit Architecture
○ https://en.wikipedia.org/wiki/XUnit
○ https://www.martinfowler.com/bliki/Xunit.html
○ All xUnit frameworks share the following basic component architecture
● basic components
○ Test Runner
○ Test Case
○ Test Fixtures
○ Test Suites
○ Test Execution (setup / teardown)
○ Test Result Formatter
○ Assertions
14
xUnit architecture