<commit_before><?php

use CollectionPlusJson\Template;
use CollectionPlusJson\Error;
use CollectionPlusJson\Link;
use CollectionPlusJson\Item;
use CollectionPlusJson\Query;
use CollectionPlusJson\Util\Href;

class CollectionTest extends PHPUnit_Framework_TestCase
{

    /** @var  \CollectionPlusJson\Collection */
    protected $collection;

    public function setUp()
    {
        $href = new \CollectionPlusJson\Util\Href( 'http://test.com/api/' );
        $this->collection = new \CollectionPlusJson\Collection( $href );
    }

    public function testOutput()
    {
        $this->collection->setTemplate( new Template() )
            ->setError( new Error( 'testError', 'testCode', 'This is a test error object' ) );
        $wrapper = $this->collection->output();
        $collection = $wrapper->collection;
        $this->assertEquals( '0.1.0', $collection->version );
        $this->assertEquals( 'http://test.com/api/', $collection->href );
        $this->assertTrue( is_array( $collection->links ) );
        $this->assertTrue( is_array( $collection->items ) );
        $this->assertTrue( is_array( $collection->queries ) );
        $this->assertNotNull( $collection->template );
        $this->assertNotNull( $collection->error );
    }

    public function testGetHref()
    {
        $href = $this->collection->getHref();
        $this->assertInstanceOf('\collectionPlusJson\Util\Href', $href);
    }

    public function testAddLink()
    {
        $link = new Link( new Href( 'http://test.com/api/' ), 'test' );
        $links = $this->collection->addLink( $link )->getLinks();
        $this->assertCount( 1, $links );
        $this->assertEquals( $link, $links[0] );
    }

    public function testAddItem()
    {
        $item = new Item( new Href( 'http://test.com/api/' ) );<commit_msg>updtae collection test on version<commit_after><?php

use CollectionPlusJson\Template;
use CollectionPlusJson\Error;
use CollectionPlusJson\Link;
use CollectionPlusJson\Item;
use CollectionPlusJson\Query;
use CollectionPlusJson\Util\Href;

class CollectionTest extends PHPUnit_Framework_TestCase
{

    /** @var  \CollectionPlusJson\Collection */
    protected $collection;

    public function setUp()
    {
        $href = new \CollectionPlusJson\Util\Href( 'http://test.com/api/' );
        $this->collection = new \CollectionPlusJson\Collection( $href );
    }

    public function testOutput()
    {
        $this->collection->setTemplate( new Template() )
            ->setError( new Error( 'testError', 'testCode', 'This is a test error object' ) );
        $wrapper = $this->collection->output();
        $collection = $wrapper->collection;
        $this->assertNotEmpty( $collection->version );
        $this->assertEquals( 'http://test.com/api/', $collection->href );
        $this->assertTrue( is_array( $collection->links ) );
        $this->assertTrue( is_array( $collection->items ) );
        $this->assertTrue( is_array( $collection->queries ) );
        $this->assertNotNull( $collection->template );
        $this->assertNotNull( $collection->error );
    }

    public function testGetHref()
    {
        $href = $this->collection->getHref();
        $this->assertInstanceOf('\collectionPlusJson\Util\Href', $href);
    }

    public function testAddLink()
    {
        $link = new Link( new Href( 'http://test.com/api/' ), 'test' );
        $links = $this->collection->addLink( $link )->getLinks();
        $this->assertCount( 1, $links );
        $this->assertEquals( $link, $links[0] );
    }

    public function testAddItem()
    {
        $item = new Item( new Href( 'http://test.com/api/' ) );
{'fraction_non_alphanumeric': 0.1567925048222651, 'fraction_numerical': 0.0019289060347203086, 'mean_word_length': 2.9802631578947367, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 61, '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': '2850531', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1050, 'n_words': 219}