<commit_before><?php

Bundle::start('orchestra');

class MessagesTest extends PHPUnit_Framework_TestCase {

	/**
	 * Setup the test environment.
	 */
	public function setUp()
	{
		Session::$instance = null;
		Session::load();
	}

	/**
	 * Teardown the test environment.
	 */
	public function tearDown()
	{
		Session::$instance = null;
	}

	/**
	 * Test Orchestra\Messages::make()
	 *
	 * @test
	 */
	public function testMake()
	{
		$messages = Orchestra\Messages::make('welcome', 'Hello world');

		$this->assertInstanceOf('Orchestra\Messages', $messages);
		$this->assertEquals(array('Hello world'), $messages->get('welcome'));

		$messages->add('welcome', 'Hi Foobar');
		$this->assertEquals(array('Hello world', 'Hi Foobar'), $messages->get('welcome'));
	}

	/**
	 * Test serializing and retrieving Orchestra\Messages over
	 * Session
	 *
	 * @test
	 */
	public function testSerializeAndRetrieve()
	{
		$messages = new Orchestra\Messages;
		$messages->add('hello', 'Hi World');
		$messages->add('bye', 'Goodbye');

		$serialize = $messages->serialize();

		$this->assertTrue(is_string($serialize));
		$this->assertContains('hello', $serialize);
		$this->assertContains('Hi World', $serialize);
		$this->assertContains('bye', $serialize);
		$this->assertContains('Goodbye', $serialize);

		Session::flash('message', $serialize);

		$this->assertTrue(Session::has('message'));

		$retrieve = Orchestra\Messages::retrieve();

		$this->assertEquals($messages, $retrieve);
		$this->assertEquals(array('Hi World'), $retrieve->get('hello'));
		$this->assertEquals(array('Goodbye'), $retrieve->get('bye'));
	}
}
<commit_msg>Check instanceof when getting from Orchestra\Message::retrieve()<commit_after><?php

Bundle::start('orchestra');

class MessagesTest extends PHPUnit_Framework_TestCase {

	/**
	 * Setup the test environment.
	 */
	public function setUp()
	{
		Session::$instance = null;
		Session::load();
	}

	/**
	 * Teardown the test environment.
	 */
	public function tearDown()
	{
		Session::$instance = null;
	}

	/**
	 * Test Orchestra\Messages::make()
	 *
	 * @test
	 */
	public function testMake()
	{
		$messages = Orchestra\Messages::make('welcome', 'Hello world');

		$this->assertInstanceOf('Orchestra\Messages', $messages);
		$this->assertEquals(array('Hello world'), $messages->get('welcome'));

		$messages->add('welcome', 'Hi Foobar');
		$this->assertEquals(array('Hello world', 'Hi Foobar'), $messages->get('welcome'));
	}

	/**
	 * Test serializing and retrieving Orchestra\Messages over
	 * Session
	 *
	 * @test
	 */
	public function testSerializeAndRetrieve()
	{
		$messages = new Orchestra\Messages;
		$messages->add('hello', 'Hi World');
		$messages->add('bye', 'Goodbye');

		$serialize = $messages->serialize();

		$this->assertTrue(is_string($serialize));
		$this->assertContains('hello', $serialize);
		$this->assertContains('Hi World', $serialize);
		$this->assertContains('bye', $serialize);
		$this->assertContains('Goodbye', $serialize);

		Session::flash('message', $serialize);

		$this->assertTrue(Session::has('message'));

		$retrieve = Orchestra\Messages::retrieve();

		$this->assertInstanceOf('Orchestra\Messages', $retrieve);
		$this->assertEquals($messages, $retrieve);
		$this->assertEquals(array('Hi World'), $retrieve->get('hello'));
		$this->assertEquals(array('Goodbye'), $retrieve->get('bye'));
	}
}

{'fraction_non_alphanumeric': 0.19289340101522842, 'fraction_numerical': 0.0, 'mean_word_length': 5.238361266294227, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 44, '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': '3184771', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1008, 'n_words': 189}