{"id":428,"date":"2014-08-19T13:39:00","date_gmt":"2014-08-19T10:39:00","guid":{"rendered":"https:\/\/polyetilen.lt\/?p=428"},"modified":"2023-04-13T16:23:33","modified_gmt":"2023-04-13T13:23:33","slug":"installing-phpunit-with-composer-on-windows","status":"publish","type":"post","link":"https:\/\/polyetilen.lt\/en\/installing-phpunit-with-composer-on-windows","title":{"rendered":"Installing PHPUnit with Composer on Windows"},"content":{"rendered":"\n<p>On Windows to install <a href=\"http:\/\/phpunit.de\" target=\"_blank\" rel=\"noreferrer noopener\">PHPUnit<\/a>, need Composer, which you can download from <a href=\"https:\/\/getcomposer.org\/Composer-Setup.exe\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/getcomposer.org\/Composer-Setup.exe<\/a>.<\/p>\n\n\n\n<p>Also need <a href=\"http:\/\/git-scm.com\" target=\"_blank\" rel=\"noreferrer noopener\">Git<\/a>, which can be downloaded from <a href=\"http:\/\/git-scm.com\/download\/win\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/git-scm.com\/download\/win<\/a>. I installed Git with the option \"Use Git from the Windows Command Promt\".<\/p>\n\n\n\n<p>After you install Git and Composer, you need to edit the file C:\\Users\\Aleksandras\\AppData\\Roaming\\Composer\\composer.json (change your username in the file path) and specify to create a copy of the git repository package php-invoker, because Composer refuses install this package, it uses php extension <a href=\"http:\/\/php.net\/manual\/en\/pcntl.installation.php\" target=\"_blank\" rel=\"noreferrer noopener\">pcntl<\/a>, which is not supported on Windows. Here is content of the file composer.json:<\/p>\n\n\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n{\n    \"repositories\": &#x5B;\n        {\n            \"type\": \"composer\",\n            \"url\": \"http:\/\/packages.phundament.com\"\n        },\n        {\n            \"type\": \"package\",\n            \"package\": {\n                \"name\": \"phpunit\/php-invoker\",\n                \"version\": \"1.1.3\",\n                \"source\": {\n                    \"type\": \"git\",\n                    \"url\": \"http:\/\/github.com\/sebastianbergmann\/php-invoker\",\n                    \"reference\": \"master\"\n                },\n                \"autoload\": {\n                    \"classmap\": &#x5B;\n                        \"PHP\/\"\n                    ]\n                }\n            }\n        }\n    ],\n    \"require\": {\n        \"phpunit\/phpunit\": \"4.1.*\",\n        \"phpunit\/phpunit-selenium\": \"*\",\n        \"phpunit\/phpunit-skeleton-generator\": \"*\",\n        \"phpunit\/dbunit\": \"*\",\n        \"phpunit\/phpunit-story\": \"*\",\n        \"phpunit\/php-invoker\": \"*\",\n        \"phpunit\/phpunit-mock-objects\": \"*\"\n    }\n}\n<\/pre>\n\n\n\n<p>Now you can install PHPUnit, you need to run Windows command prompt (Win+R and enter cmd) and run the command:<\/p>\n\n\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\ncomposer global require \"phpunit\/phpunit=4.1.*\"\n<\/pre>\n\n\n\n<p>After installation have to configure <a rel=\"noreferrer noopener\" href=\"https:\/\/netbeans.org\" target=\"_blank\">NetBeans IDE 8.0<\/a> (Tools->Options->PHP->Frameworks &amp; Tools->PHPUnit) full path to PHPUnit Script:<\/p>\n\n\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\nC:\\Users\\Aleksandras\\AppData\\Roaming\\Composer\\vendor\\bin\\phpunit.bat\n<\/pre>\n\n\n\n<p>and Skeleton Generator Script:<\/p>\n\n\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\nC:\\Users\\Aleksandras\\AppData\\Roaming\\Composer\\vendor\\bin\\phpunit-skelgen.bat\n<\/pre>\n\n\n\n<p>All file paths should be with your username.<\/p>\n\n\n\n<p>Additionally, you will need Web Browser Automation <a rel=\"noreferrer noopener\" href=\"http:\/\/www.seleniumhq.org\" target=\"_blank\">Selenium<\/a>, server downloaded from <a rel=\"noreferrer noopener\" href=\"http:\/\/selenium-release.storage.googleapis.com\/2.42\/selenium-server-standalone-2.42.2.jar\" target=\"_blank\">http:\/\/selenium-release.storage.googleapis.com\/2.42\/selenium-server-standalone-2.42.2.jar<\/a> and before the test, this server should be run by the following command (or create a bat file):<\/p>\n\n\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\njava -jar selenium-server-standalone-2.42.2.jar\n<\/pre>\n\n\n\n<p>If Java is not installed, then you can download from <a rel=\"noreferrer noopener\" href=\"http:\/\/java.com\/en\/download\/index.jsp\" target=\"_blank\">http:\/\/java.com\/en\/download\/index.jsp<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On Windows to install PHPUnit, need Composer, which you can download from https:\/\/getcomposer.org\/Composer-Setup.exe. Also need Git, which can be downloaded from http:\/\/git-scm.com\/download\/win. I installed Git with the option \"Use Git from the Windows Command Promt\". &hellip; <a href=\"https:\/\/polyetilen.lt\/en\/installing-phpunit-with-composer-on-windows\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"en_US","_original_post":"http:\/\/polyetilen.lt\/?p=354","footnotes":""},"categories":[8],"tags":[142,143,144,145,146],"class_list":["post-428","post","type-post","status-publish","format-standard","hentry","category-programavimas","tag-composer","tag-netbeans","tag-phpunit","tag-selenium","tag-testas","en-US"],"_links":{"self":[{"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/posts\/428","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/comments?post=428"}],"version-history":[{"count":5,"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/posts\/428\/revisions"}],"predecessor-version":[{"id":433,"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/posts\/428\/revisions\/433"}],"wp:attachment":[{"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/media?parent=428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/categories?post=428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/tags?post=428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}