<commit_before><?php
/*   _            _          _ ____   ___  _____
 *  | |          | |        | |___ \ / _ \| ____|
 *  | |      __ _| |__   ___| | __) | | | | |__
 *  | |     / _` | '_ \ / _ \ ||__ <|  -  |___ \
 *  | |____| (_| | |_) |  __/ |___) |     |___) |
 *  |______|\__,_|_.__/ \___|_|____/ \___/|____/
 *
 *  Copyright Label305 B.V. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

use Behat\Behat\Context\BehatContext;
use Behat\Gherkin\Node\TableNode;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Log;
use Label305\AujaLaravel\Config\AujaConfigurator;

use Label305\AujaLaravel\Config\ModelConfig;
use Label305\AujaLaravel\Config\Relation;
use Label305\AujaLaravel\Database\DatabaseHelper;
use \Mockery as m;

class FeatureContext extends BehatContext {

    /**
     * @var String[]
     */
    private $models = [];

    /**
     * @var String
     */
    private $lastModel;

    /**
     * @var
     */
    private $lastConfig;

    /**
     * @var Application
     */
    private $application;

    /**
     * @var DatabaseHelper
     */
    private $databaseHelper;

    /**
     * @var AujaConfigurator
     */
    private $aujaConfigurator;

    function __construct() {
        $this->application = m::mock('Illuminate\Foundation\Application');
        $this->databaseHelper = m::mock('Label305\AujaLaravel\Database\DatabaseHelper');

        $this->aujaConfigurator = new AujaConfigurator($this->application, $this->databaseHelper);

        Log::shouldReceive('debug');
        Log::shouldReceive('info');
    }

    /**
     * @Given /^there is a model "([^"]*)"$/
     */
    public function thereIsAModel($modelName) {

        if (!class_exists($modelName)) {
            eval('class ' . $modelName . ' extends \Illuminate\Database\Eloquent\Model { };');
        }

        $this->models[] = $modelName;
        $this->lastModel = $modelName;

        $config = new ModelConfig($modelName);
        $this->lastConfig = $config;

        $this->databaseHelper->shouldReceive('hasTable')->with($config->getTableName())->andReturn(true);
    }

    /**
     * @Given /^it has the following columns:$/
     */
    public function itHasTheFollowingColumns(TableNode $table) {
        $columns = [];
        foreach ($table->getHash() as $columnHash) {
            $columns[] = $columnHash['column'];
            $this->databaseHelper->shouldReceive('getColumnType')->with($this->lastConfig->getTableName(), $columnHash['column'])->andReturn($columnHash['type']);
        }
        $this->databaseHelper->shouldReceive('getColumnListing')->with($this->lastConfig->getTableName())->andReturn($columns);<commit_msg>removed semicolumn<commit_after><?php
/*   _            _          _ ____   ___  _____
 *  | |          | |        | |___ \ / _ \| ____|
 *  | |      __ _| |__   ___| | __) | | | | |__
 *  | |     / _` | '_ \ / _ \ ||__ <|  -  |___ \
 *  | |____| (_| | |_) |  __/ |___) |     |___) |
 *  |______|\__,_|_.__/ \___|_|____/ \___/|____/
 *
 *  Copyright Label305 B.V. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

use Behat\Behat\Context\BehatContext;
use Behat\Gherkin\Node\TableNode;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Log;
use Label305\AujaLaravel\Config\AujaConfigurator;

use Label305\AujaLaravel\Config\ModelConfig;
use Label305\AujaLaravel\Config\Relation;
use Label305\AujaLaravel\Database\DatabaseHelper;
use \Mockery as m;

class FeatureContext extends BehatContext {

    /**
     * @var String[]
     */
    private $models = [];

    /**
     * @var String
     */
    private $lastModel;

    /**
     * @var
     */
    private $lastConfig;

    /**
     * @var Application
     */
    private $application;

    /**
     * @var DatabaseHelper
     */
    private $databaseHelper;

    /**
     * @var AujaConfigurator
     */
    private $aujaConfigurator;

    function __construct() {
        $this->application = m::mock('Illuminate\Foundation\Application');
        $this->databaseHelper = m::mock('Label305\AujaLaravel\Database\DatabaseHelper');

        $this->aujaConfigurator = new AujaConfigurator($this->application, $this->databaseHelper);

        Log::shouldReceive('debug');
        Log::shouldReceive('info');
    }

    /**
     * @Given /^there is a model "([^"]*)"$/
     */
    public function thereIsAModel($modelName) {

        if (!class_exists($modelName)) {
            eval('class ' . $modelName . ' extends \Illuminate\Database\Eloquent\Model {  }');
        }

        $this->models[] = $modelName;
        $this->lastModel = $modelName;

        $config = new ModelConfig($modelName);
        $this->lastConfig = $config;

        $this->databaseHelper->shouldReceive('hasTable')->with($config->getTableName())->andReturn(true);
    }

    /**
     * @Given /^it has the following columns:$/
     */
    public function itHasTheFollowingColumns(TableNode $table) {
        $columns = [];
        foreach ($table->getHash() as $columnHash) {
            $columns[] = $columnHash['column'];
            $this->databaseHelper->shouldReceive('getColumnType')->with($this->lastConfig->getTableName(), $columnHash['column'])->andReturn($columnHash['type']);
        }
        $this->databaseHelper->shouldReceive('getColumnListing')->with($this->lastConfig->getTableName())->andReturn($columns);
{'fraction_non_alphanumeric': 0.14969497888315345, 'fraction_numerical': 0.006882527764742687, 'mean_word_length': 2.715281812899477, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 55, 'https://': 0, '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': '7145879', 'n_tokens_mistral': 1987, 'n_tokens_neox': 1903, 'n_words': 376}