-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,345 changed files
with
139,928 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version":1,"defects":{"TDD\\Test\\ReceiptTest::testTotal":3,"TDD\\Test\\ReceiptTest::testTax":4,"TDD\\Test\\ReceiptTest::test_total":3,"TDD\\Test\\ReceiptTest::test_total2":4,"TDD\\Test\\ReceiptTest::test_total3":4,"TDD\\Test\\ReceiptTest::test_total4":4,"TDD\\Test\\ReceiptTest::test_total5":3,"TDD\\Test\\InvoiceTest::testTotal":4,"TDD\\Test\\InvoiceTest::testTax":4,"TDD\\Test\\InvoiceTest::test_total2":4,"TDD\\Test\\ReceiptTest::test_total6":5},"times":{"TDD\\Test\\ReceiptTest::testTotal":0.026,"TDD\\Test\\ReceiptTest::testTax":0,"TDD\\Test\\ReceiptTest::test_total":0.019,"TDD\\Test\\ReceiptTest::test_total2":0.005,"TDD\\Test\\ReceiptTest::test_total3":0,"TDD\\Test\\ReceiptTest::test_total4":0.06,"TDD\\Test\\ReceiptTest::test_total5":0,"TDD\\Test\\InvoiceTest::testTotal":0.004,"TDD\\Test\\InvoiceTest::testTax":0,"TDD\\Test\\InvoiceTest::test_total2":0,"TDD\\Test\\ReceiptTest::test_total6":0}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
PHPUnit notes | ||
|
||
|
||
To check phpunit version follow command: vendor/bin/phpunit --version | ||
|
||
|
||
To Run testing code: vendor/bin/phpunit tests | ||
(or) | ||
We can specify by name if we have large application: vendor/bin/phpunit tests/ReceiptTest.php | ||
(or) | ||
Even you can filter more deep, You can call specify method: vendor/bin/phpunit tests --filter=testTax | ||
(or) | ||
Even better you can filter with class more deep, You can call specify method: vendor/bin/phpunit tests --filter=ReceiptTest::testTax | ||
(or) | ||
Instead of running single command like above mentioned, we can setup phpunit.xml here we can mention default files or exclude files for testing and more options | ||
After setup phpunit.xml file you can run command: vendor/bin/phpunit --testsuite=app | ||
we can call specify method with filter command: vendor/bin/phpunit --testsuite=app --filter=testTax | ||
Asserts functions | ||
|
||
assertEquals => this assertEquals has 3 inputs ( first expected value, second actual value, Message displayed in case of failure) | ||
Find more assert functions in https://phpunit.de/manual/current/en/appendixes.assertions.html | ||
|
||
Arrange Act Assert => the basic pattern we use is called Arrange-Act-Assert | ||
|
||
|
||
Arrange => All necessary preconditions and inputs. | ||
Act => On the Object or Method under test. | ||
Assert => That the Expected results have occurred. | ||
|
||
We add two new methods => setUp() & tearDown() That PHPUnit call before every test method. | ||
|
||
|
||
|
||
Test Double |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.5" | ||
}, | ||
"autoload": { | ||
"classmap": [ | ||
"src/" | ||
] | ||
} | ||
|
||
} |
Oops, something went wrong.