NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
PHPUNIT 5.2.12 works with PHPED?


Joined: 09 Sep 2016
Posts: 4
Reply with quote
Hi,

recently I post a reply about some issues with PHPUNIT and PHPED. I am new on it. They are solved. The problem I experienced is the example
Code:

namespace sparkbits\backend\core;  //this is my namespace
use PHPUnit\Framework\TestCase;
use RuntimeException;
use PDO;
class StackTest extends TestCase
{
    public function testmytest1()
    {
            <my tests inside>
     }
}



works on version 5.5.4 but not in 5.2.12 which informs that PHPUnit\Framework\TestCase is not found. If I try to use this versoin on PHPED I cannot because it is unsuported (???). Anyone experience the same? what's wrong?

thank you
View user's profileFind all posts by roger73Send private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
Correct example is available here:
https://phpunit.de/manual/5.2/en/writing-tests-for-phpunit.html
Code:
<?php
class StackTest extends PHPUnit_Framework_TestCase
{
    public function testPushAndPop()
    {
        $stack = array();
        $this->assertEquals(0, count($stack));

        array_push($stack, 'foo');
        $this->assertEquals('foo', $stack[count($stack)-1]);
        $this->assertEquals(1, count($stack));

        $this->assertEquals('foo', array_pop($stack));
        $this->assertEquals(0, count($stack));
    }
}
?>


As you can see it extends PHPUnit_Framework_TestCase, not TestCase.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 09 Sep 2016
Posts: 4
Reply with quote
dmitri wrote:
Correct example is available here:
https://phpunit.de/manual/5.2/en/writing-tests-for-phpunit.html
Code:
<?php
class StackTest extends PHPUnit_Framework_TestCase
{
    public function testPushAndPop()
    {
        $stack = array();
        $this->assertEquals(0, count($stack));

        array_push($stack, 'foo');
        $this->assertEquals('foo', $stack[count($stack)-1]);
        $this->assertEquals(1, count($stack));

        $this->assertEquals('foo', array_pop($stack));
        $this->assertEquals(0, count($stack));
    }
}
?>


As you can see it extends PHPUnit_Framework_TestCase, not TestCase.


This example works for me with 5.2.12 via Command line. I still experiencing problems with IDE. Maybe any include or some missing configuration.
View user's profileFind all posts by roger73Send private message
PHPUNIT 5.2.12 works with PHPED?
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic