PHPUnit not working (thus far) on Oxygen.1 [message #1774793] |
Thu, 19 October 2017 15:53 |
Adam Sandler Messages: 4 Registered: July 2009 |
Junior Member |
|
|
Hello:
I just downloaded and started running Oxygen.1.
I also installed Composer and PHPUnit in accordance with Chapter 1, the Windows section, from the documentation:
https://phpunit.de/manual/current/en/phpunit-book.pdf
Back in Eclipse I went to In Eclipse install the packages from http://download.eclipse.org/tools/pdt/updates/latest and installed the "PHP Development Tools" (Note: Under "PHP Development Tools (SDK), "PHP Development Tools (PDT) JUnit Tests" showed up in the "Will not be installed" part of the Solution Details section).
So I went into Project -> Properties -> PHP -> Source Paths -> Include Path -> Libraries,
I clicked Add External PHARs... and pointed the file chooser to the home of where I put PHPUnit, c:\php\latest\phpunit\phpunit.phar.
After that, in the Project Explorer tabbed pane, in the PHP Include Path node of the project tree, I can expand phpunit.phar and see all the packages underneath...
Here's the source code:
CalculatorTest.php
<?php
require 'Calculator.php';
class TestCalculator extends PHPUnit_Framework_TestCase {
private $calculator;
protected function setUp() {
$this->calculator = new Calculator();
}
protected function tearDown() {
$this->calculator = NULL;
}
public function testAdd() {
$result = $this->calculator->add(1, 2);
$this->assertEquals(4, $result);
}
}
Calculator.php
<?php
class Calculator
{
public function add($x, $y)
{
return $x + $y;
}
}
For this line in the code:
class TestCalculator extends PHPUnit_Framework_TestCase {
Eclipse has an error, "Quote:PHPUnit_Framework_TestCase cannot be resolved to a type ".
Eclipse tells me to change it to PHPUnit_Framework_MockObject_Matcher instead... so I do so...
But when going to Run -> Run As _> PHPUnit Test, this popup is displayed:
"Quote:Unable to find PHPUnit phar Check PHPUnit configuration ".
Does anyone have any ideas how to get PHPUnit running in Oxygen.1? I've attached a couple of screenshots showing my Eclipse. Suggestions are greatly appreciated. Thanks!
-
Attachment: pic3.jpg
(Size: 199.56KB, Downloaded 642 times) -
Attachment: pic4.jpg
(Size: 319.79KB, Downloaded 518 times)
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04648 seconds