<commit_before><?php
use izzum\command\Command;
use izzum\command\Exception;
use izzum\command\ExceptionCommand;
use izzum\command\Composite;
use izzum\command\Closure;
use izzum\command\Null;
use izzum\command\ICommand;
use izzum\command\IComposite;
/**
 * This class tests the basic workings of the Core Command package.
 * Since all commands build upon the Core, these tests should cover all 
 * public methods and workings
 * @group command
 * @author rolf
 *
 */
class CommandTest extends PHPUnit_Framework_TestCase {
    
    
    public function testCommand()
    {
        //use a command that has a reference to a list.
        //we can then check the list to see what happens to it.
        $list = array();
        $command = new AddToListCommand($list);
        
        //check basics
        $this->assertTrue(is_subclass_of($command, 'izzum\command\Command'));
        $this->assertFalse(in_array('izzum\command\IComposite', class_implements($command)));
        $this->assertTrue(in_array('izzum\command\ICommand', class_implements($command)));

        //check that execute does something
        $this->assertEquals(0, count($list));
        $command->execute();
        $this->assertEquals(1, count($list));
        $command->execute();
        $this->assertEquals(2, count($list));
        
        $this->assertNotNull($command->toString());
        $this->assertContains('AddToListCommand', $command . '', '__toString()');
    }
    
    public function testNullCommand()
    {
        //test creation
        $command = new Null();
        $command->execute();<commit_msg>php 7 fix<commit_after><?php
use izzum\command\Command;
use izzum\command\Exception;
use izzum\command\ExceptionCommand;
use izzum\command\Composite;
use izzum\command\Closure;
use izzum\command\ICommand;
use izzum\command\IComposite;
/**
 * This class tests the basic workings of the Core Command package.
 * Since all commands build upon the Core, these tests should cover all 
 * public methods and workings
 * @group command
 * @author rolf
 *
 */
class CommandTest extends PHPUnit_Framework_TestCase {
    
    
    public function testCommand()
    {
        //use a command that has a reference to a list.
        //we can then check the list to see what happens to it.
        $list = array();
        $command = new AddToListCommand($list);
        
        //check basics
        $this->assertTrue(is_subclass_of($command, 'izzum\command\Command'));
        $this->assertFalse(in_array('izzum\command\IComposite', class_implements($command)));
        $this->assertTrue(in_array('izzum\command\ICommand', class_implements($command)));

        //check that execute does something
        $this->assertEquals(0, count($list));
        $command->execute();
        $this->assertEquals(1, count($list));
        $command->execute();
        $this->assertEquals(2, count($list));
        
        $this->assertNotNull($command->toString());
        $this->assertContains('AddToListCommand', $command . '', '__toString()');
    }
    
    public function testNullCommand()
    {
        //test creation
        $command = new izzum\command\Null();
        $command->execute();
{'fraction_non_alphanumeric': 0.12751889168765743, 'fraction_numerical': 0.002204030226700252, 'mean_word_length': 3.0063051702395964, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5813613', 'n_tokens_mistral': 896, 'n_tokens_neox': 894, 'n_words': 231}