<commit_before><?php

namespace LinkValue\MobileNotifBundle\Tests\Bridge\Mobile\IOs;


use PHPUnit_Framework_TestCase;
use LinkValue\MobileNotifBundle\Entity\MobileClient\MobileMessage;
use LinkValue\MobileNotifBundle\Bridge\Mobile\IOs\AppleMobileClient;

/**
 * Unit test class for AppleMobileClient.php.
 *
 * @see LinkValue\MobileNotifBundle\Bridge\Mobile\IOs\AppleMobileClient
 */
class AppleMobileClientTest extends PHPUnit_Framework_TestCase
{
    /**
     * tests push() method throws an exception when an inexisting ssl bundle is given.
     */
    public function testFailToCreateClientBecauseOfInexistingBundleFile()
    {
        $this->setExpectedException('Symfony\Component\Filesystem\Exception\FileNotFoundException');

        new AppleMobileClient(
            'http://apple-push.com/endpoint',
            '/this/file/probably/doesnt/exists/bundle.pem',
            'random passphrase',
            $this->prophesize('Psr\Log\LoggerInterface')->reveal()
        );
    }

    /**
     * tests push() method throws an exception when an error occurs while trying to contact the push server.
     */
    public function testFailToConnectToPushServer()
    {
        $this->setExpectedException('LinkValue\MobileNotifBundle\Entity\MobileClient\Exception\PushException');

        $message = (new MobileMessage())
            ->setDeviceToken('<PASSWORD> <PASSWORD> <PASSWORD> <PASSWORD>')
            ->setMessage('apple <3')
        ;

        $appleMobileClient = new AppleMobileClient(
            'http://random-apple-push.com/endpoint',
            __FILE__,
            'random passphrase',
            $this->prophesize('Psr\Log\LoggerInterface')->reveal()
        );

        @$appleMobileClient->push($message);
    }
}<commit_msg>Use new construct definition in tests<commit_after><?php

namespace LinkValue\MobileNotifBundle\Tests\Bridge\Mobile\IOs;

use PHPUnit_Framework_TestCase;
use LinkValue\MobileNotifBundle\Entity\MobileClient\MobileMessage;
use LinkValue\MobileNotifBundle\Bridge\Mobile\IOs\AppleMobileClient;

/**
 * Unit test class for AppleMobileClient.php.
 *
 * @see LinkValue\MobileNotifBundle\Bridge\Mobile\IOs\AppleMobileClient
 */
class AppleMobileClientTest extends PHPUnit_Framework_TestCase
{

    /**
     * tests push() method throws an exception when an inexisting ssl bundle is given.
     */
    public function testFailToCreateClientBecauseOfInexistingBundleFile()
    {
        $this->setExpectedException('Symfony\Component\Filesystem\Exception\FileNotFoundException');

        (new AppleMobileClient($this->prophesize('Psr\Log\LoggerInterface')->reveal()))
            ->setUp([
                'endpoint' => 'http://apple-push.com/endpoint',
                'ssl_pem' => '/this/file/probably/doesnt/exists/bundle.pem',
                'passphrase' => '<PASSWORD>'
            ])
        ;
    }

    /**
     * tests push() method throws an exception when an error occurs while trying to contact the push server.
     */
    public function testFailToConnectToPushServer()
    {
        $this->setExpectedException('LinkValue\MobileNotifBundle\Entity\MobileClient\Exception\PushException');

        $message = (new MobileMessage())
                ->setDeviceToken('1<PASSWORD> 1<PASSWORD> 12<PASSWORD>6789 123456789')
                ->setMessage('apple <3')
        ;

        $mobileClient = new AppleMobileClient($this->prophesize('Psr\Log\LoggerInterface')->reveal());
        $mobileClient->setUp([
                'endpoint' => 'http://random-apple-push.com/endpoint',
                'ssl_pem' => __FILE__,
                'passphrase' => '<PASSWORD>'
            ])
        ;
        $mobileClient->push($message);
    }
}
{'fraction_non_alphanumeric': 0.11791813499593386, 'fraction_numerical': 0.005150447275684467, 'mean_word_length': 2.9634801288936625, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 38, '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': '5037738', 'n_tokens_mistral': 1041, 'n_tokens_neox': 993, 'n_words': 175}