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

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

新規登録して質問してみよう
ただいま回答率
85.48%
PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

PHPUnit

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

Phalcon

Phalconは、C言語で作られたPHPフレームワークです。 C言語で書かれているため、PHP Moduleとして動作するので、 他のフレームワークに比べて高速というのが特徴です。

MAMP

Mac 上で WordPress などの動的ページのサイトが作れるように環境を構築するフリーソフト

Q&A

解決済

1回答

2906閲覧

PHPunitが上手くいかない MAMP phalcon

kotaue

総合スコア14

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

PHPUnit

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

Phalcon

Phalconは、C言語で作られたPHPフレームワークです。 C言語で書かれているため、PHP Moduleとして動作するので、 他のフレームワークに比べて高速というのが特徴です。

MAMP

Mac 上で WordPress などの動的ページのサイトが作れるように環境を構築するフリーソフト

0グッド

0クリップ

投稿2020/07/08 08:26

前提・実現したいこと

MAMPで動かしているアプリのPHPunitを実施したいがエラーが起きてしまいます。

導入は以下の公式のドキュメントを参考にしています。
composer.jsonの中身は、phpとphalcon(2系)のバージョンに対応する、バージョンを調べてupdatesしています。

おそらくMAMPで作成しているアプリはMAMPのPHP Version 5.6.37で動かしているのですが
macにはいっているPHP 7.4.6がターミナルで./vendor/bin/phpunit を実施した際に動いている気がします。

MAMPのPHPに向ける方法はありますでしょうか。

■phalcon
https://teruchiphalcon-docs.readthedocs.io/ja/latest/reference/unit-testing.html

incubatorとphpunitインストール以外はドキュメント通りに進めています。
./vendor/bin/phpunitコマンドを入力した時のエラーです。

●参考
・PHPUnitとPHPのバージョン対応表
ttps://blog.shimabox.net/2016/09/15/phpunit-php-support-version/

・ここのREADME
https://github.com/phalcon/incubator

発生している問題・エラーメッセージ

PHP Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /Applications/MAMP/htdocs/phalcon_work/todo/vendor/phpunit/phpunit/src/Util/Getopt.php on line 38 PHP Stack trace: PHP 1. {main}() /Applications/MAMP/htdocs/phalcon_work/todo/vendor/phpunit/phpunit/phpunit:0 PHP 2. PHPUnit_TextUI_Command::main($exit = *uninitialized*) /Applications/MAMP/htdocs/phalcon_work/todo/vendor/phpunit/phpunit/phpunit:52 PHP 3. PHPUnit_TextUI_Command->run($argv = *uninitialized*, $exit = *uninitialized*) /Applications/MAMP/htdocs/phalcon_work/todo/vendor/phpunit/phpunit/src/TextUI/Command.php:100 PHP 4. PHPUnit_TextUI_Command->handleArguments($argv = *uninitialized*) /Applications/MAMP/htdocs/phalcon_work/todo/vendor/phpunit/phpunit/src/TextUI/Command.php:111 PHP 5. PHPUnit_Util_Getopt::getopt($args = *uninitialized*, $short_options = *uninitialized*, $long_options = *uninitialized*) /Applications/MAMP/htdocs/phalcon_work/todo/vendor/phpunit/phpunit/src/TextUI/Command.php:240 PHP 6. each(*uninitialized*) /Applications/MAMP/htdocs/phalcon_work/todo/vendor/phpunit/phpunit/src/Util/Getopt.php:38 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /Applications/MAMP/htdocs/phalcon_work/todo/vendor/phpunit/phpunit/src/Util/Getopt.php on line 38 Call Stack: 0.0016 397592 1. {main}() /Applications/MAMP/htdocs/phalcon_work/todo/vendor/phpunit/phpunit/phpunit:0 0.0068 702736 2. PHPUnit_TextUI_Command::main(???) /Applications/MAMP/htdocs/phalcon_work/todo/vendor/phpunit/phpunit/phpunit:52 0.0068 702848 3. PHPUnit_TextUI_Command->run(???, ???) /Applications/MAMP/htdocs/phalcon_work/todo/vendor/phpunit/phpunit/src/TextUI/Command.php:100 0.0068 702848 4. PHPUnit_TextUI_Command->handleArguments(???) /Applications/MAMP/htdocs/phalcon_work/todo/vendor/phpunit/phpunit/src/TextUI/Command.php:111 0.0070 729040 5. PHPUnit_Util_Getopt::getopt(???, ???, ???) /Applications/MAMP/htdocs/phalcon_work/todo/vendor/phpunit/phpunit/src/TextUI/Command.php:240 0.0071 729480 6. each(???) /Applications/MAMP/htdocs/phalcon_work/todo/vendor/phpunit/phpunit/src/Util/Getopt.php:38 PHPUnit 4.8.36 by Sebastian Bergmann and contributors. Usage: phpunit [options] UnitTest [UnitTest.php] phpunit [options] <directory> Code Coverage Options: --coverage-clover <file> Generate code coverage report in Clover XML format. --coverage-crap4j <file> Generate code coverage report in Crap4J XML format. --coverage-html <dir> Generate code coverage report in HTML format. --coverage-php <file> Export PHP_CodeCoverage object to file. --coverage-text=<file> Generate code coverage report in text format. Default: Standard output. --coverage-xml <dir> Generate code coverage report in PHPUnit XML format. Logging Options: --log-junit <file> Log test execution in JUnit XML format to file. --log-tap <file> Log test execution in TAP format to file. --log-json <file> Log test execution in JSON format. --testdox-html <file> Write agile documentation in HTML format to file. --testdox-text <file> Write agile documentation in Text format to file. Test Selection Options: --filter <pattern> Filter which tests to run. --testsuite <name> Filter which testsuite to run. --group ... Only runs tests from the specified group(s). --exclude-group ... Exclude tests from the specified group(s). --list-groups List available test groups. --test-suffix ... Only search for test in files with specified suffix(es). Default: Test.php,.phpt Test Execution Options: --report-useless-tests Be strict about tests that do not test anything. --strict-coverage Be strict about unintentionally covered code. --strict-global-state Be strict about changes to global state --disallow-test-output Be strict about output during tests. --enforce-time-limit Enforce time limit based on test size. --disallow-todo-tests Disallow @todo-annotated tests. --process-isolation Run each test in a separate PHP process. --no-globals-backup Do not backup and restore $GLOBALS for each test. --static-backup Backup and restore static attributes for each test. --colors=<flag> Use colors in output ("never", "auto" or "always"). --columns <n> Number of columns to use for progress output. --columns max Use maximum number of columns for progress output. --stderr Write to STDERR instead of STDOUT. --stop-on-error Stop execution upon first error. --stop-on-failure Stop execution upon first error or failure. --stop-on-risky Stop execution upon first risky test. --stop-on-skipped Stop execution upon first skipped test. --stop-on-incomplete Stop execution upon first incomplete test. -v|--verbose Output more verbose information. --debug Display debugging information during test execution. --loader <loader> TestSuiteLoader implementation to use. --repeat <times> Runs the test(s) repeatedly. --tap Report test execution progress in TAP format. --testdox Report test execution progress in TestDox format. --printer <printer> TestListener implementation to use. Configuration Options: --bootstrap <file> A "bootstrap" PHP file that is run before the tests. -c|--configuration <file> Read configuration from XML file. --no-configuration Ignore default configuration file (phpunit.xml). --no-coverage Ignore code coverage configuration. --include-path <path(s)> Prepend PHP's include_path with given path(s). -d key[=value] Sets a php.ini value. Miscellaneous Options: -h|--help Prints this usage information. --version Prints the version and exits.

該当のソースコード

json

1{ 2 "require-dev": { 3 "phpunit/phpunit": "~4.5" 4 }, 5 "require": { 6 7 "phalcon/incubator": "^2.0" 8 } 9 10} 11

補足情報(FW/ツールのバージョンなど)

MAMPのPHPは
PHP Version 5.6.37 を使用しています。

(macにはPHP 7.4.6が入っている)

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

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

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

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

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

guest

回答1

0

自己解決

MAMPで使用していたPHPのパスを通せば大丈夫でした。

投稿2020/07/09 07:52

kotaue

総合スコア14

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問