2016-09-14 [長年日記]

_ [CakePHP]assertTemplate()を複数

PHPUnitのテストで、assertTemplate()を1テストに複数書く方法がわからない。 以下のようにやると2つ目が必ず「indexがrenderされてるぞ、ボケ」になってfail.

public function testMyAction(){
  $this->get("action/100");
  $this->assertTemplate('index');

  $this->get("action/999);
  $this->assertTemplate('notfound');
}

なんか途中にreset()みたいなの挟めないか。 誰か教えて下さい。

追記: $this->tearDown(); を挟めばよかった。 http://docs.w3cub.com/cakephp~3.2/class-cake.testsuite.integrationtestcase/#_assertTemplate に Clears the state used for requests. とある。


検索キーワード:

記事

カテゴリ

Amazon | Android | apache | Arduino | bash | bluetooth | Books | CakePHP | CakePHP3 | CakePHP4 | Chrome | Chromebook | CodeIgniter | CSS | Docker | Eclipse | Emacs | etc | Firefox | Flask | Gadget | git | Gnome | Google | Heroku | HTML | hugo | Internet | iPhone | IS01 | IS03 | Java | JavaScript | json | Kotlin | Laravel | LINE | magento | mysql | nginx | nodejs | Oops | PC | Perl | php | Python | Qt | Ruby | ruby | Shell | ssh | tdiary | twitter | ubuntu | unix | VirtualBox | Web | Windows | windows | WindowsMobile | WX5 | YAML | zsh | ここか | そば | つくる | つり | できごと | アクアリウム | ギター | セキュリティ | プリンタ | ベース | ボクシング | ポエム | マネー | メシ | ラズパイ | 仕事 | 作家 | 壮絶 | 妄想 | 忘れる | 料理 | | 暑い | 痛い | 社会 | 自転車 | | 車輪 | | 野球 | 銭湯 | 音楽 |

全部 : / 今日 :

近頃

links

profile

もっとヒゲ伸ばしたい。