<commit_before><?php

use Codeception\Util\Stub;
use Datatype\Object;
use Datatype\Collection;


class ObjectTest extends \Codeception\TestCase\Test
{
	/**
	 * @var \CodeGuy
	 */
	protected $codeGuy;


	protected function _before()
	{
		$this->obj = new Object;
		$this->col = new Collection( ['a', 'b', 'c', 2] );
	}

	protected function _after()
	{
	}

	public function testParentPropertyHoldsNameOfParentClass()
	{
		$this->assertEquals( 'Datatype\Object', $this->col->parent );
	}

	public function testInstance_ofPropertyHoldsClassName()
	{
		$this->assertEquals( 'Datatype\Object', $this->obj->instance_of );
	}

	public function testStaticMethodClass_implementsBehaviour()
	{
		$this->assertContains( 'ArrayAccess', Collection::class_implements(), 'class_implements should return a Collection with all implemented interfaces' );
		$this->assertEquals( true, Collection::class_implements( 'SeekableIterator' ) );
		$this->assertEquals( false, Collection::class_implements( 'NonExistentInterface' ) );
	}

	public function testStaticMethodClass_usesBehaviour()
	{
		$this->assertContains( 'Datatype\Traits\PropertyMapperTrait', Collection::class_uses(), 'class_uses should return a Collection with all used traits in given class' );
		$this->assertEquals( true, Collection::class_uses( 'Datatype\Traits\PropertyMapperTrait' ) );
		$this->assertEquals( false, Collection::class_uses( 'NonExistentTrait' ) );
	}

	public function testInstance_ofMethodChecksOnlyCurrentClass()
	{

		$this->assertTrue( $this->obj->instance_of( 'Datatype\Object' ) );
		$this->assertFalse( $this->col->instance_of( 'Datatype\Object' ) );
	}

	public function testIsaMethodIncludesParentsInClassChecking()
	{
		$this->assertTrue( $this->col->is_a( 'Datatype\Collection' ) );
		$this->assertTrue( $this->col->is_a( 'Datatype\Object' ) );
	}

	public function testSame_asMethodShouldReturnTrueOnlyForReferencesToIdenticalObject()
	{
		$ref = $this->obj;
		$new = new Object;
		$dup = clone $this->obj;

		$this->assertTrue( $this->obj->same_as( $ref ) );
		$this->assertFalse( $this->obj->same_as( $new ) );
		$this->assertFalse( $this->obj->same_as( $dup ) );
	}

	public function testEqualsMethodShouldNotBeSoStrict()
	{
		$ref = $this->obj;
		$new = new Object;
		$dup = clone $this->obj;

		$this->assertTrue( $this->obj->equals( $ref ) );
		$this->assertTrue( $this->obj->equals( $new ) );
		$this->assertTrue( $this->obj->equals( $dup ) );
	}

	public function testResponds_toOnlyRespondsToPublicMethods()
	{
		$this->assertFalse( $this->obj->responds_to( '___parent' ) );
		$this->assertTrue( $this->obj->responds_to( 'responds_to' ) );
	}
<commit_msg>Add forgotten bracket<commit_after><?php

use Codeception\Util\Stub;
use Datatype\Object;
use Datatype\Collection;


class ObjectTest extends \Codeception\TestCase\Test
{
	/**
	 * @var \CodeGuy
	 */
	protected $codeGuy;


	protected function _before()
	{
		$this->obj = new Object;
		$this->col = new Collection( ['a', 'b', 'c', 2] );
	}

	protected function _after()
	{
	}

	public function testParentPropertyHoldsNameOfParentClass()
	{
		$this->assertEquals( 'Datatype\Object', $this->col->parent );
	}

	public function testInstance_ofPropertyHoldsClassName()
	{
		$this->assertEquals( 'Datatype\Object', $this->obj->instance_of );
	}

	public function testStaticMethodClass_implementsBehaviour()
	{
		$this->assertContains( 'ArrayAccess', Collection::class_implements(), 'class_implements should return a Collection with all implemented interfaces' );
		$this->assertEquals( true, Collection::class_implements( 'SeekableIterator' ) );
		$this->assertEquals( false, Collection::class_implements( 'NonExistentInterface' ) );
	}

	public function testStaticMethodClass_usesBehaviour()
	{
		$this->assertContains( 'Datatype\Traits\PropertyMapperTrait', Collection::class_uses(), 'class_uses should return a Collection with all used traits in given class' );
		$this->assertEquals( true, Collection::class_uses( 'Datatype\Traits\PropertyMapperTrait' ) );
		$this->assertEquals( false, Collection::class_uses( 'NonExistentTrait' ) );
	}

	public function testInstance_ofMethodChecksOnlyCurrentClass()
	{

		$this->assertTrue( $this->obj->instance_of( 'Datatype\Object' ) );
		$this->assertFalse( $this->col->instance_of( 'Datatype\Object' ) );
	}

	public function testIsaMethodIncludesParentsInClassChecking()
	{
		$this->assertTrue( $this->col->is_a( 'Datatype\Collection' ) );
		$this->assertTrue( $this->col->is_a( 'Datatype\Object' ) );
	}

	public function testSame_asMethodShouldReturnTrueOnlyForReferencesToIdenticalObject()
	{
		$ref = $this->obj;
		$new = new Object;
		$dup = clone $this->obj;

		$this->assertTrue( $this->obj->same_as( $ref ) );
		$this->assertFalse( $this->obj->same_as( $new ) );
		$this->assertFalse( $this->obj->same_as( $dup ) );
	}

	public function testEqualsMethodShouldNotBeSoStrict()
	{
		$ref = $this->obj;
		$new = new Object;
		$dup = clone $this->obj;

		$this->assertTrue( $this->obj->equals( $ref ) );
		$this->assertTrue( $this->obj->equals( $new ) );
		$this->assertTrue( $this->obj->equals( $dup ) );
	}

	public function testResponds_toOnlyRespondsToPublicMethods()
	{
		$this->assertFalse( $this->obj->responds_to( '___parent' ) );
		$this->assertTrue( $this->obj->responds_to( 'responds_to' ) );
	}

}
{'fraction_non_alphanumeric': 0.15860113421550096, 'fraction_numerical': 0.0003780718336483932, 'mean_word_length': 5.313842482100239, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 111, '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': '4119573', 'n_tokens_mistral': 1830, 'n_tokens_neox': 1734, 'n_words': 320}