<commit_before><?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright	Copyright 2013, Block 8 Limited.
* @license		https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link			http://www.phptesting.org/
*/

namespace PHPCI\Plugin\Tests;
use PHPCI\Plugin\Email as EmailPlugin;

define('PHPCI_BIN_DIR', "FAKEPHPCIBIN");

/**
* Unit test for the PHPUnit plugin.
* @author meadsteve
*/
class EmailTest extends  \PHPUnit_Framework_TestCase
{

	/**
	 * @var EmailPlugin $testedPhpUnit
	 */
	protected $testedEmailPlugin;

	/**
	 * @var \PHPUnit_Framework_MockObject_MockObject $mockCiBuilder
	 */
	protected $mockCiBuilder;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject $mockMailer
     */
    protected $mockMailer;

	public function setUp()
	{
		$this->mockCiBuilder = $this->getMock(
			'\PHPCI\Builder',
			array('getConfig'),
			array(),
			"mockBuilder",
			false
		);
		$this->mockCiBuilder->buildPath = "/";
        $this->mockCiBuilder->expects($this->any())
            ->method('getConfig')
            ->with('email_settings')
            ->will($this->returnValue(array(
                'from_address'  => "<EMAIL>"
            )));

        $this->mockMailer = $this->getMock(
			'\Swift_Mailer',
			array('send'),
			array(),
			"mockMailer",
			false
		);

		$this->loadEmailPluginWithOptions();
	}

	protected function loadEmailPluginWithOptions($arrOptions = array())
	{
		$this->testedEmailPlugin = new EmailPlugin(
            $this->mockCiBuilder,
            $arrOptions,
            $this->mockMailer
        );
	}

	/**
	 * @covers PHPUnit::execute
	 */
	public function testExecute_ReturnsTrueWithoutArgs()<commit_msg>Updating the email plugin tests so that getSystemConfig is mocked correctly.<commit_after><?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright	Copyright 2013, Block 8 Limited.
* @license		https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link			http://www.phptesting.org/
*/

namespace PHPCI\Plugin\Tests;
use PHPCI\Plugin\Email as EmailPlugin;

define('PHPCI_BIN_DIR', "FAKEPHPCIBIN");

/**
* Unit test for the PHPUnit plugin.
* @author meadsteve
*/
class EmailTest extends  \PHPUnit_Framework_TestCase
{

	/**
	 * @var EmailPlugin $testedPhpUnit
	 */
	protected $testedEmailPlugin;

	/**
	 * @var \PHPUnit_Framework_MockObject_MockObject $mockCiBuilder
	 */
	protected $mockCiBuilder;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject $mockMailer
     */
    protected $mockMailer;

	public function setUp()
	{
		$this->mockCiBuilder = $this->getMock(
			'\PHPCI\Builder',
			array('getSystemConfig'),
			array(),
			"mockBuilder",
			false
		);
		$this->mockCiBuilder->buildPath = "/";
        $this->mockCiBuilder->expects($this->any())
            ->method('getSystemConfig')
            ->with('phpci')
            ->will($this->returnValue(array(
                'email_settings' => array(
                    'from_address'  => "<EMAIL>"
                )
            )));

        $this->mockMailer = $this->getMock(
			'\Swift_Mailer',
			array('send'),
			array(),
			"mockMailer",
			false
		);

		$this->loadEmailPluginWithOptions();
	}

	protected function loadEmailPluginWithOptions($arrOptions = array())
	{
		$this->testedEmailPlugin = new EmailPlugin(
            $this->mockCiBuilder,
            $arrOptions,
            $this->mockMailer
        );
	}

	/**
	 * @covers PHPUnit::execute
	 */
	public function testExecute_ReturnsTrueWithoutArgs()
{'fraction_non_alphanumeric': 0.14277473319873088, 'fraction_numerical': 0.003461205653302567, 'mean_word_length': 2.9679633867276887, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 42, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '7121562', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1076, 'n_words': 193}