質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
さくらのVPS

さくらのVPSは、さくらインターネット社が提供するVPS(仮想専用サーバー)です。高速なSSDの選択や複数台構成も可能。利用者に応じた柔軟なプランが用意されています。大規模システムにも対応可能なスケーラビリティを備えたホスティングサービスです。

Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

CakePHP

CakePHPは、PHPで書かれたWebアプリケーション開発用のフレームワークです。 Ruby on Railsの考え方を多く取り入れており、Railsの高速性とPHPの機動性を兼ね備えています。 MVCやORMなどを「規約優先の考え方」で利用するため、コードを書く手間を省くことができます。 外部のライブラリに依存しないので、単体での利用が可能です。

PHPUnit

PHPUnitは、PHP向けのユニット・テスト向けフレームワークで、手動では手間のかかるテスト作業を自動化し、繰り返し実行することが可能です。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

Q&A

0回答

1528閲覧

CakePHP2.10.18のテストページ(/test.php)で、テストケースが全く読み込まれない現象の解決方法をお訪ねしたいです。

cat0138

総合スコア33

さくらのVPS

さくらのVPSは、さくらインターネット社が提供するVPS(仮想専用サーバー)です。高速なSSDの選択や複数台構成も可能。利用者に応じた柔軟なプランが用意されています。大規模システムにも対応可能なスケーラビリティを備えたホスティングサービスです。

Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

CakePHP

CakePHPは、PHPで書かれたWebアプリケーション開発用のフレームワークです。 Ruby on Railsの考え方を多く取り入れており、Railsの高速性とPHPの機動性を兼ね備えています。 MVCやORMなどを「規約優先の考え方」で利用するため、コードを書く手間を省くことができます。 外部のライブラリに依存しないので、単体での利用が可能です。

PHPUnit

PHPUnitは、PHP向けのユニット・テスト向けフレームワークで、手動では手間のかかるテスト作業を自動化し、繰り返し実行することが可能です。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

0グッド

0クリップ

投稿2019/12/01 23:51

編集2019/12/03 08:22

現在、VagrantでCakePHP2.10.18の開発環境を構築しています。
テストを動かすために/app/Test/移行にソースを書いているのですが、「/test.php」にアクセスをしてもEmptyの表示になり、テストケースを読み取ることができません。
イメージ説明
同じソースをさくらのVPSにアップし、確認をしてみると正常に確認できているようです。
イメージ説明]

原因はvagrantの環境にあるかと思うのですが、該当する箇所がわからないためご教授いただけますと幸いです。

ちなみに、windowsPCとUbuntu19.04をsynced_folderで同期しており、composerを開発環境内でupdateするとエラーになるため、windowsにPHPとcomposerをインストールしてupdateをしております。
ansibleで環境を構築しており、環境は開発環境(vagrant)と本番環境(さくらのVPS)で同じにしております。

不足している情報はご指摘いただけますと幸いです。
どうぞよろしくお願いいたします。

追記

vagrantファイルのソースを記載いたします。

vagrant

1# -*- mode: ruby -*- 2# vi: set ft=ruby : 3 4Vagrant.configure("2") do |config| 5 6 config.vm.box = "ubuntu/disco64" 7 config.vm.box_version = "20190514.0.1" 8 9 config.vm.hostname = "test.test" 10 config.vm.network "private_network", ip: "192.168.33.10" 11 # 20190819追記(タイムアウトをすることが多いため) 12 # https://www.84kure.com/blog/2016/01/02/vagrant-vagrant-up%E3%81%8C%E3%82%BF%E3%82%A4%E3%83%A0%E3%82%A2%E3%82%A6%E3%83%88%E3%81%AB%E3%81%AA%E3%82%8B%E3%81%A8%E3%81%8D%E3%81%AE%E5%AF%BE%E5%87%A6%E6%B3%95/ 13 config.vm.boot_timeout = 600 14 15 config.vm.synced_folder ".", "/vagrant", type:"virtualbox" 16 config.vm.synced_folder "../ansible_project", "/var/www/html", type:"virtualbox", owner: 'vagrant', group: 'www-data', mount_options: ['dmode=777', 'fmode=666'] 17 config.vm.synced_folder "../ansible_project/app/tmp", "/var/www/html/app/tmp", type:"virtualbox", owner: 'www-data', group: 'www-data', mount_options: ['dmode=777', 'fmode=777'] 18 19 # 2019/06/24 add https://github.com/dotless-de/vagrant-vbguest/issues/333 20 if Vagrant.has_plugin?("vagrant-vbguest") 21 config.vbguest.auto_update = false 22 end 23 24end 25

/app/webroot/test.phpのファイルを記載いたします。
※デフォルトのままかと存じます。
※20191203追記:debug(TESTS);debug(APP_TEST_CASES);の結果を追記しております。

php

1 2<?php 3/** 4 * Web Access Frontend for TestSuite 5 * 6 * CakePHP(tm) Tests <https://book.cakephp.org/2.0/en/development/testing.html> 7 * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) 8 * 9 * Licensed under The MIT License 10 * For full copyright and license information, please see the LICENSE.txt 11 * Redistributions of files must retain the above copyright notice 12 * 13 * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) 14 * @link https://book.cakephp.org/2.0/en/development/testing.html 15 * @package app.webroot 16 * @since CakePHP(tm) v 1.2.0.4433 17 * @license https://opensource.org/licenses/mit-license.php MIT License 18 */ 19 20set_time_limit(0); 21ini_set('display_errors', 1); 22 23/** 24 * Use the DS to separate the directories in other defines 25 */ 26if (!defined('DS')) { 27 define('DS', DIRECTORY_SEPARATOR); 28} 29 30/** 31 * These defines should only be edited if you have CakePHP installed in 32 * a directory layout other than the way it is distributed. 33 * When using custom settings be sure to use the DS and do not add a trailing DS. 34 */ 35 36/** 37 * The full path to the directory which holds "app", WITHOUT a trailing DS. 38 */ 39if (!defined('ROOT')) { 40 define('ROOT', dirname(dirname(dirname(__FILE__)))); 41} 42 43/** 44 * The actual directory name for the "app". 45 */ 46if (!defined('APP_DIR')) { 47 define('APP_DIR', basename(dirname(dirname(__FILE__)))); 48} 49 50/** 51 * Config Directory 52 */ 53if (!defined('CONFIG')) { 54 define('CONFIG', ROOT . DS . APP_DIR . DS . 'Config' . DS); 55} 56 57/** 58 * The absolute path to the "Cake" directory, WITHOUT a trailing DS. 59 * 60 * For ease of development CakePHP uses PHP's include_path. If you 61 * need to cannot modify your include_path, you can set this path. 62 * 63 * Leaving this constant undefined will result in it being defined in Cake/bootstrap.php 64 * 65 * The following line differs from its sibling 66 * /lib/Cake/Console/Templates/skel/webroot/test.php 67 */ 68//define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib'); 69 70/** 71 * This auto-detects CakePHP as a composer installed library. 72 * You may remove this if you are not planning to use composer (not recommended, though). 73 */ 74$vendorPath = ROOT . DS . APP_DIR . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib'; 75$dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php'; 76if (!defined('CAKE_CORE_INCLUDE_PATH') && file_exists($vendorPath . DS . $dispatcher)) { 77 define('CAKE_CORE_INCLUDE_PATH', $vendorPath); 78} 79 80/** 81 * Editing below this line should not be necessary. 82 * Change at your own risk. 83 */ 84if (!defined('WEBROOT_DIR')) { 85 define('WEBROOT_DIR', basename(dirname(__FILE__))); 86} 87if (!defined('WWW_ROOT')) { 88 define('WWW_ROOT', dirname(__FILE__) . DS); 89} 90 91if (!defined('CAKE_CORE_INCLUDE_PATH')) { 92 if (function_exists('ini_set')) { 93 ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path')); 94 } 95 if (!include 'Cake' . DS . 'bootstrap.php') { 96 $failed = true; 97 } 98} else { 99 if (!include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php') { 100 $failed = true; 101 } 102} 103if (!empty($failed)) { 104 trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/test.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR); 105} 106 107if (Configure::read('debug') < 1) { 108 throw new NotFoundException(__d('cake_dev', 'Debug setting does not allow access to this URL.')); 109} 110 111require_once CAKE . 'TestSuite' . DS . 'CakeTestSuiteDispatcher.php'; 112 113CakeTestSuiteDispatcher::run(); 114 115debug(TESTS); 116//結果:'/var/www/html/app/Test' 117 118debug(APP_TEST_CASES) 119//結果:'/var/www/html/app/Test/Case' 120

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

m.ts10806

2019/12/01 23:58

実際のコードもご提示された方が良いかと思います。
cat0138

2019/12/02 05:42

すみません、取り急ぎvagrantのソースを記載いたしました。 他にも編集すべき箇所がございましたら、ご指摘いただけますと幸いです。 どうぞよろしくお願いいたします。
m.ts10806

2019/12/02 05:46

えっとPHP側のコードも関係しそうに思うのですが、以下がでしょうか。
cat0138

2019/12/02 08:27

失礼いたしました。 /app/webroot/test.phpのコードを追記しております。 どうぞよろしくお願いいたします。
nojimage

2019/12/03 03:48

test.php の最後に debug(TESTS);debug(APP_TEST_CASES); として、TESTSとAPP_TEST_CASESの値を出力したらどんな値が出力されますか?
cat0138

2019/12/03 08:23 編集

ありがとうございます。 早速試してみたところ、 開発環境でもさくらVPSの環境でも同様で、 debug(TESTS)では、 '/var/www/html/app/Test' debug(APP_TEST_CASES)では、 '/var/www/html/app/Test/Case' となりました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問