Example #1
0
 /**
  * ページデータをコピーする
  * 
  * @param int $id ページID
  * @param int $newParentId 新しい親コンテンツID
  * @param string $newTitle 新しいタイトル
  * @param int $newAuthorId 新しい作成者ID
  * @param int $newSiteId 新しいサイトID
  * @param string $message テストが失敗した時に表示されるメッセージ
  * @dataProvider copyDataProvider
  */
 public function testCopy($id, $newParentId, $newTitle, $newAuthorId, $newSiteId, $message = null)
 {
     $this->_loginAdmin();
     $result = $this->Page->copy($id, $newParentId, $newTitle, $newAuthorId, $newSiteId);
     // コピーしたファイル存在チェック
     $path = APP . 'View' . DS . 'Pages' . $result['Content']['url'] . '.php';
     $this->assertFileExists($path, $message);
     @unlink($path);
     // DBに書き込まれているかチェック
     $exists = $this->Page->exists($result['Page']['id']);
     $this->assertTrue($exists);
 }
Example #2
0
 /**
  * ページデータをコピーする
  * 
  * @param int $id ページID
  * @param array $data コピーしたいデータ
  * @param array $expected 期待値
  * @param string $message テストが失敗した時に表示されるメッセージ
  * @dataProvider copyDataProvider
  */
 public function testCopy($id, $data, $expected, $message = null)
 {
     $data = array('Page' => $data);
     $result = $this->Page->copy($id, $data);
     // コピーしたファイル存在チェック
     $path = getViewPath() . 'Pages' . $result['Page']['url'] . '.php';
     $this->assertFileExists($path, $message);
     @unlink($path);
     // DBに書き込まれているかチェック
     $exists = $this->Page->exists($result['Page']['id']);
     $this->assertTrue($exists);
 }