Closed hgsgtk closed 5 years ago
<?php declare(strict_types=1);
require_once __DIR__ . '/vendor/autoload.php';
(2 === 1 + 1) or die("LINE: " . __LINE__);
(3.0 === 1.5 + 1.5) or die("LINE: " . __LINE__);
$date = date('Y-m-d', 4502304000);
("2112-09-13" === $date) or die("LINE: " . __LINE__);
$a = [1, 2, 3];
(1 == array_shift($a)) or die("LINE: " . __LINE__);
echo "ok" . PHP_EOL;
<?php declare(strict_types=1);
require_once __DIR__ . '/vendor/autoload.php';
assert(2 === 1 + 1);
assert(3 === 1.5 + 1.5);
assert('2112-09-13' === date('Y-m-d', 4503168000));
$a = [1, 2, 3];
assert(1 === array_shift($a));
Software Framework
ライブラリでは呼び出し側がプログラム全体の制御構造を指定できないが、フレームワークでは可能である。この制御の反転がソフトウェアフレームワークの特徴である
https://github.com/hgsgtk/php-snippets/tree/master/simpleTestFramework
アサーションを実現するアイデアを学んだ
learn testing script by phperkaigi 2018 talk https://www.youtube.com/watch?v=o0YY0JnAOwU https://github.com/zonuexe/phperkaigi-test