<commit_before><?php
namespace Neducatio\TestBundle\Tests\PageObject;

use \Mockery as m;
use Behat\Mink\Element\TraversableElement;

/**
 * Page test case
 */
abstract class PageTestCase extends \PHPUnit_Framework_TestCase
{
  protected $harvester;
  protected $pageObject;
  protected $page;
  protected $subpage;

  /**
   * Sets up
   */
  public function setUp()
  {
    $this->page = $this->getPage();
    $this->subpage = $this->getSubPage();
    $this->pageObject = $this->getPageObject($this->page);
  }

  /**
   * Do sth.
   */
  public function tearDown()
  {
    m::close();
  }

  /**
   * Gets PageObject
   */
  abstract protected function getPageObject();

  /**
   * Do sth.
   * 
   * @param TraversableElement $page Page/subpage to be passed to validator
   *
   * @return PageObjectBuilder
   */
  protected function getBuilder(TraversableElement $page)
  {
    $validator = m::mock('stdClass');
    $validator->shouldReceive('validate')->byDefault();
    $this->harvester = m::mock('Neducatio\TestBundle\Utility\HookHarvester');
    $this->harvester->shouldReceive('registerHooks')->byDefault();
    $awaiter = m::mock("Neducatio\TestBundle\Utility\Awaiter\PageAwaiter");
    $builder = m::mock('Neducatio\TestBundle\PageObject\PageObjectBuilder');
    $builder->shouldReceive('getValidator')->andReturn($validator)->with($page);
    $builder->shouldReceive('getHarvester')->andReturn($this->harvester);
    $builder->shouldReceive('getAwaiter')->andReturn($awaiter);

    return $builder;
  }

  /**
   * Creates DocumentElement mock
   *
   * @return DocumentElement
   */
  protected function getPage()
  {
    return m::mock('\Behat\Mink\Element\DocumentElement');
  }

  /**
   * Creates DocumentElement mock
   *
   * @return DocumentElement
   */
  protected function getSubPage()<commit_msg>Przygotowanie do zwracania PageObject przez page buildera przy testowaniu page objectow<commit_after><?php
namespace Neducatio\TestBundle\Tests\PageObject;

use \Mockery as m;
use Behat\Mink\Element\TraversableElement;

/**
 * Page test case
 */
abstract class PageTestCase extends \PHPUnit_Framework_TestCase
{
  protected $harvester;
  protected $pageObject;
  protected $page;
  protected $subpage;

  /**
   * Sets up
   */
  public function setUp()
  {
    $this->page = $this->getPage();
    $this->subpage = $this->getSubPage();
    $this->pageObject = $this->getPageObject($this->page);
  }

  /**
   * Do sth.
   */
  public function tearDown()
  {
    m::close();
  }

  /**
   * Gets PageObject
   */
  abstract protected function getPageObject();

  /**
   * Do sth.
   * 
   * @param TraversableElement $page Page/subpage to be passed to validator
   *
   * @return PageObjectBuilder
   */
  protected function getBuilder(TraversableElement $page)
  {
    $validator = m::mock('stdClass');
    $validator->shouldReceive('validate')->byDefault();
    $this->harvester = m::mock('Neducatio\TestBundle\Utility\HookHarvester');
    $this->harvester->shouldReceive('registerHooks')->byDefault();
    $awaiter = m::mock("Neducatio\TestBundle\Utility\Awaiter\PageAwaiter");
    $builder = m::mock('Neducatio\TestBundle\PageObject\PageObjectBuilder');
    $builder->shouldReceive('getValidator')->andReturn($validator)->with($page);
    $builder->shouldReceive('getHarvester')->andReturn($this->harvester);
    $builder->shouldReceive('getAwaiter')->andReturn($awaiter);
    $createdPageObject = m::mock('Neducatio\TestBundle\PageObject\BasePageObject');
    $builder->shouldReceive('build')->andReturn($createdPageObject)->byDefault();

    return $builder;
  }

  /**
   * Creates DocumentElement mock
   *
   * @return DocumentElement
   */
  protected function getPage()
  {
    return m::mock('\Behat\Mink\Element\DocumentElement');
  }

  /**
   * Creates DocumentElement mock
   *
   * @return DocumentElement
   */
  protected function getSubPage()
{'fraction_non_alphanumeric': 0.14966512107161256, 'fraction_numerical': 0.0, 'mean_word_length': 3.896595208070618, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 48, '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': '675345', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1207, 'n_words': 208}