<commit_before><?php
/*
 * This file is part of the Money package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace SebastianBergmann\Money;

class MoneyTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @covers            \SebastianBergmann\Money\Money::__construct
     * @uses              \SebastianBergmann\Money\Currency
     * @expectedException \SebastianBergmann\Money\InvalidArgumentException
     */
    public function testCannotBeConstructedFromNonIntegerValue()
    {
        new Money(null, new Currency('EUR'));
    }

    /**
     * @covers            \SebastianBergmann\Money\Money::__construct
     * @covers            \SebastianBergmann\Money\Money::handleCurrencyArgument
     * @uses              \SebastianBergmann\Money\Currency
     * @expectedException \SebastianBergmann\Money\InvalidArgumentException
     */
    public function testCannotBeConstructedUsingInvalidCurrencyArgument()
    {
        new Money(0, null);
    }

    /**
     * @covers            \SebastianBergmann\Money\Money::fromString
     * @uses              \SebastianBergmann\Money\Currency
     * @expectedException \SebastianBergmann\Money\InvalidArgumentException
     */
    public function testCannotBeConstructedUsingInvalidValueArgument()
    {
        Money::fromString(1234, new Currency('EUR'));
    }

    /**
     * @covers \SebastianBergmann\Money\Money::__construct
     * @covers \SebastianBergmann\Money\Money::handleCurrencyArgument
     * @uses   \SebastianBergmann\Money\Currency
     */
    public function testObjectCanBeConstructedFromIntegerValueAndCurrencyObject()
    {
        $m = new Money(0, new Currency('EUR'));

        $this->assertInstanceOf(Money::class, $m);

        return $m;
    }

    /**
     * @covers \SebastianBergmann\Money\Money::__construct
     * @covers \SebastianBergmann\Money\Money::handleCurrencyArgument
     * @uses   \SebastianBergmann\Money\Currency
     */
    public function testObjectCanBeConstructedFromIntegerValueAndCurrencyString()
    {
        $m = new Money(0, 'EUR');

        $this->assertInstanceOf(Money::class, $m);

        return $m;
    }

    /**
     * @covers \SebastianBergmann\Money\Money::fromString
     * @uses   \SebastianBergmann\Money\Money::__construct
     * @uses   \SebastianBergmann\Money\Money::handleCurrencyArgument
     * @uses   \SebastianBergmann\Money\Currency
     */
    public function testObjectCanBeConstructedFromStringValueAndCurrencyObject()
    {<commit_msg>MoneyTest<commit_after><?php
/*
 * This file is part of the Money package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace SebastianBergmann\Money;

class MoneyTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @covers            \SebastianBergmann\Money\Money::__construct
     * @uses              \SebastianBergmann\Money\Currency
     * @expectedException \SebastianBergmann\Money\InvalidArgumentException
     */
    public function testCannotBeConstructedFromNonIntegerValue()
    {
        new Money(null, new Currency('EUR'));
    }

    /**
     * @covers            \SebastianBergmann\Money\Money::__construct
     * @covers            \SebastianBergmann\Money\Money::handleCurrencyArgument
     * @uses              \SebastianBergmann\Money\Currency
     * @expectedException \SebastianBergmann\Money\InvalidArgumentException
     */
    public function testCannotBeConstructedUsingInvalidCurrencyArgument()
    {
        new Money(0, null);
    }

    /**
     * @covers            \SebastianBergmann\Money\Money::fromString
     * @uses              \SebastianBergmann\Money\Currency
     * @expectedException \SebastianBergmann\Money\InvalidArgumentException
     */
    public function testCannotBeConstructedUsingInvalidValueArgument()
    {
        Money::fromString(1234, new Currency('EUR'));
    }

    /**
     * @covers \SebastianBergmann\Money\Money::__construct
     * @covers \SebastianBergmann\Money\Money::handleCurrencyArgument
     * @uses   \SebastianBergmann\Money\Currency
     */
    public function testObjectCanBeConstructedFromIntegerValueAndCurrencyObject()
    {
        $m = new Money(0, new Currency('EUR'));

        $this->assertInstanceOf('Money', $m);

        return $m;
    }

    /**
     * @covers \SebastianBergmann\Money\Money::__construct
     * @covers \SebastianBergmann\Money\Money::handleCurrencyArgument
     * @uses   \SebastianBergmann\Money\Currency
     */
    public function testObjectCanBeConstructedFromIntegerValueAndCurrencyString()
    {
        $m = new Money(0, 'EUR');

        $this->assertInstanceOf(Money::class, $m);

        return $m;
    }

    /**
     * @covers \SebastianBergmann\Money\Money::fromString
     * @uses   \SebastianBergmann\Money\Money::__construct
     * @uses   \SebastianBergmann\Money\Money::handleCurrencyArgument
     * @uses   \SebastianBergmann\Money\Currency
     */
    public function testObjectCanBeConstructedFromStringValueAndCurrencyObject()
    {
{'fraction_non_alphanumeric': 0.10380088751688211, 'fraction_numerical': 0.0027011383368705385, 'mean_word_length': 2.9242997728993188, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '6137106', 'n_tokens_mistral': 1639, 'n_tokens_neox': 1567, 'n_words': 244}