1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-18 23:42:25 +02:00

Added codeception

This commit is contained in:
Hillel Coren 2014-02-04 00:56:23 +02:00
parent fd09c67164
commit 466a026adb
26 changed files with 4834 additions and 16 deletions

View File

@ -54,10 +54,10 @@ return array(
'mysql' => array(
'driver' => 'mysql',
'host' => getenv('DB_HOST'),
'database' => getenv('DB_NAME'),
'username' => getenv('DB_USER'),
'password' => getenv('DB_PASS'),
'host' => 'localhost',
'database' => 'ninja',
'username' => 'ninja',
'password' => 'ninja',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',

View File

@ -246,6 +246,7 @@ class InvoiceController extends \BaseController {
}
$input = json_decode(Input::get('data'));
$invoice = $input->invoice;
if ($errors = $this->invoiceRepo->getErrors($invoice))

View File

@ -206,12 +206,14 @@
{{ Former::populateField('new_last_name', Auth::user()->last_name); }}
{{ Former::populateField('new_email', Auth::user()->email); }}
@endif
{{ Former::hidden('path')->value(Request::path()) }}
{{ Former::text('new_first_name')->label('First name') }}
{{ Former::text('new_last_name')->label('Last name') }}
{{ Former::text('new_email')->label('Email') }}
{{ Former::password('new_password')->label('Password') }}
{{ Former::close() }}
{{ Former::text('new_email')->label('Email') }}
{{ Former::password('new_password')->label('Password') }}
{{ Former::close() }}
<center><div id="errorTaken" style="display:none">&nbsp;<br/>The email address is already regiestered</div></center>
<br/>
</div>

View File

@ -24,7 +24,7 @@
<div class="form-group">
<label for="client" class="control-label col-lg-4 col-sm-4">Client</label>
<div class="col-lg-8 col-sm-8" style="padding-top: 7px">
<a href="#" data-bind="click: $root.showClientForm">{{ $client->getDisplayName() }}</a>
<a id="editClientLink" href="#" data-bind="click: $root.showClientForm">{{ $client->getDisplayName() }}</a>
</div>
</div>
<div style="display:none">
@ -34,7 +34,7 @@
<div class="form-group" style="margin-bottom: 8px">
<div class="col-lg-8 col-sm-8 col-lg-offset-4 col-sm-offset-4">
<a href="#" data-bind="click: $root.showClientForm, text: $root.clientLinkText"></a>
<a id="createClientLink" data-bind="click: $root.showClientForm, text: $root.clientLinkText"></a>
</div>
</div>
@ -208,7 +208,7 @@
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="javascript:onSaveClick()">Save Invoice</a></li>
<li><a href="javascript:onSaveClick()" id="saveButton">Save Invoice</a></li>
<li><a href="javascript:onCloneClick()">Clone Invoice</a></li>
<li class="divider"></li>
<li><a href="javascript:onArchiveClick()">Archive Invoice</a></li>
@ -240,7 +240,7 @@
)
, array('id'=>'primaryActions', 'style'=>'text-align:left', 'data-bind'=>'css: $root.enable.save'))->split(); --}}
@else
{{ Button::primary_submit('Save Invoice', array('data-bind'=>'css: $root.enable.save')) }}
{{ Button::primary_submit('Save Invoice', array('data-bind'=>'css: $root.enable.save', 'id' => 'saveButton')) }}
@endif
{{ Button::primary('Email Invoice', array('id' => 'email_button', 'onclick' => 'onEmailClick()', 'data-bind' => 'css: $root.enable.email')) }}
@ -346,7 +346,7 @@
<div class="modal-footer" style="margin-top: 0px">
<span class="error-block" id="emailError" style="display:none;float:left;font-weight:bold">Please provide a valid email address.</span><span>&nbsp;</span>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" data-bind="click: $root.clientFormComplete">Done</button>
<button id="clientDoneButton" type="button" class="btn btn-primary" data-bind="click: $root.clientFormComplete">Done</button>
</div>
</div>

View File

@ -39,7 +39,7 @@
</div>
<center style="margin-top:16px">
{{ Button::lg_primary_submit('Save') }} &nbsp;|&nbsp;
{{ Button::lg_primary_submit_success('Save') }} &nbsp;|&nbsp;
{{ link_to('payments/' . ($payment ? $payment->public_id : ''), 'Cancel') }}
</center>

View File

@ -83,7 +83,7 @@
<div class="col-md-3 center-block">
<a href="#">
<div class="cta">
<h2 onclick="getStarted()">Invoice Now <span>+</span></h2>
<h2 id="startButton" onclick="getStarted()">Invoice Now <span>+</span></h2>
</div>
</a>
</div>

BIN
codecept.phar Normal file

Binary file not shown.

18
codeception.yml Normal file
View File

@ -0,0 +1,18 @@
paths:
tests: tests
log: tests/_log
data: tests/_data
helpers: tests/_helpers
settings:
bootstrap: _bootstrap.php
suite_class: \PHPUnit_Framework_TestSuite
colors: true
memory_limit: 1024M
log: true
modules:
config:
Db:
dsn: 'mysql:host=localhost;dbname=ninja'
user: 'ninja'
password: 'ninja'
dump: tests/_data/dump.sql

View File

@ -14,7 +14,8 @@
"omnipay/omnipay": "2.x",
"intervention/image": "dev-master",
"webpatser/laravel-countries": "dev-master",
"anahkiasen/rocketeer": "dev-develop"
"anahkiasen/rocketeer": "dev-develop",
"codeception/codeception": "*"
},
"autoload": {
"classmap": [

581
composer.lock generated
View File

@ -3,7 +3,7 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "c5ddc3dddbc7d41a2d8929990a68536b",
"hash": "0373f16d12e501e049fc9caeffc95430",
"packages": [
{
"name": "anahkiasen/former",
@ -351,6 +351,69 @@
],
"time": "2013-06-24 22:58:34"
},
{
"name": "codeception/codeception",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/Codeception/Codeception.git",
"reference": "ec9f5a7470bf82788087aed13ca3240d3a9d1ca8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Codeception/Codeception/zipball/ec9f5a7470bf82788087aed13ca3240d3a9d1ca8",
"reference": "ec9f5a7470bf82788087aed13ca3240d3a9d1ca8",
"shasum": ""
},
"require": {
"fabpot/goutte": "*",
"facebook/webdriver": "~0.3",
"monolog/monolog": "*",
"php": ">=5.4.0",
"phpunit/phpunit": "3.7.*",
"symfony/console": "~2.3",
"symfony/event-dispatcher": "~2.3",
"symfony/finder": "~2.3",
"symfony/yaml": "~2.3"
},
"require-dev": {
"facebook/php-sdk": "3.*",
"videlalvaro/php-amqplib": "*"
},
"suggest": {
"codeception/phpbuiltinserver": "Extension to start and stop PHP built-in web server for your tests"
},
"bin": [
"codecept"
],
"type": "library",
"autoload": {
"psr-0": {
"Codeception": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Bodnarchuk",
"email": "davert@mail.ua",
"homepage": "http://codegyre.com"
}
],
"description": "BDD-style testing framework",
"homepage": "http://codeception.com/",
"keywords": [
"BDD",
"TDD",
"acceptance testing",
"functional testing",
"unit testing"
],
"time": "2014-02-01 00:19:30"
},
{
"name": "d11wtq/boris",
"version": "v1.0.8",
@ -385,6 +448,100 @@
"notification-url": "https://packagist.org/downloads/",
"time": "2014-01-17 12:21:18"
},
{
"name": "fabpot/goutte",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/fabpot/Goutte.git",
"reference": "a30e84e28fbaf14909d2d007249c24cd0ecd425e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fabpot/Goutte/zipball/a30e84e28fbaf14909d2d007249c24cd0ecd425e",
"reference": "a30e84e28fbaf14909d2d007249c24cd0ecd425e",
"shasum": ""
},
"require": {
"ext-curl": "*",
"guzzle/http": "~3.1",
"php": ">=5.3.0",
"symfony/browser-kit": "~2.1",
"symfony/css-selector": "~2.1",
"symfony/dom-crawler": "~2.1",
"symfony/finder": "~2.1",
"symfony/process": "~2.1"
},
"require-dev": {
"guzzle/plugin-history": "~3.1",
"guzzle/plugin-mock": "~3.1"
},
"type": "application",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-0": {
"Goutte": "."
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "A simple PHP Web Scraper",
"homepage": "https://github.com/fabpot/Goutte",
"keywords": [
"scraper"
],
"time": "2014-01-31 18:02:50"
},
{
"name": "facebook/webdriver",
"version": "v0.3",
"source": {
"type": "git",
"url": "https://github.com/facebook/php-webdriver.git",
"reference": "1b0facc33133f0ff990df8cebe7f2e19b2603da3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/facebook/php-webdriver/zipball/1b0facc33133f0ff990df8cebe7f2e19b2603da3",
"reference": "1b0facc33133f0ff990df8cebe7f2e19b2603da3",
"shasum": ""
},
"require": {
"php": ">=5.3.19",
"phpunit/phpunit": "3.7.*"
},
"type": "library",
"autoload": {
"classmap": [
"lib/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"description": "A php client for WebDriver",
"homepage": "https://github.com/facebook/php-webdriver",
"keywords": [
"facebook",
"php",
"selenium",
"webdriver"
],
"time": "2013-11-26 23:16:02"
},
{
"name": "filp/whoops",
"version": "1.0.10",
@ -3135,6 +3292,381 @@
],
"time": "2014-01-22 03:16:33"
},
{
"name": "phpunit/php-code-coverage",
"version": "1.2.x-dev",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "6ba4ed2895d538a039d5d5866edc4ec0424c7852"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6ba4ed2895d538a039d5d5866edc4ec0424c7852",
"reference": "6ba4ed2895d538a039d5d5866edc4ec0424c7852",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-file-iterator": ">=1.3.0@stable",
"phpunit/php-text-template": ">=1.2.0@stable",
"phpunit/php-token-stream": ">=1.1.3@stable"
},
"require-dev": {
"phpunit/phpunit": "3.7.*@dev"
},
"suggest": {
"ext-dom": "*",
"ext-xdebug": ">=2.0.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
"keywords": [
"coverage",
"testing",
"xunit"
],
"time": "2014-02-03 07:44:47"
},
{
"name": "phpunit/php-file-iterator",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb",
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"File/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
"keywords": [
"filesystem",
"iterator"
],
"time": "2013-10-10 15:34:57"
},
{
"name": "phpunit/php-text-template",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"Text/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"time": "2014-01-30 17:20:04"
},
{
"name": "phpunit/php-timer",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Utility class for timing",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"time": "2013-08-02 07:42:54"
},
{
"name": "phpunit/php-token-stream",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "292f4d5772dad5a12775be69f4a8dd663b20f103"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/292f4d5772dad5a12775be69f4a8dd663b20f103",
"reference": "292f4d5772dad5a12775be69f4a8dd663b20f103",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"time": "2013-10-21 14:03:39"
},
{
"name": "phpunit/phpunit",
"version": "3.7.x-dev",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "2f33258fa5a0c330515b7deba2bc040fa5c3953b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2f33258fa5a0c330515b7deba2bc040fa5c3953b",
"reference": "2f33258fa5a0c330515b7deba2bc040fa5c3953b",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
"phpunit/php-code-coverage": "~1.2.1",
"phpunit/php-file-iterator": ">=1.3.1",
"phpunit/php-text-template": ">=1.1.1",
"phpunit/php-timer": ">=1.0.4",
"phpunit/phpunit-mock-objects": "~1.2.0",
"symfony/yaml": "~2.0"
},
"require-dev": {
"pear-pear/pear": "1.9.4"
},
"suggest": {
"ext-json": "*",
"ext-simplexml": "*",
"ext-tokenizer": "*",
"phpunit/php-invoker": ">=1.1.0,<1.2.0"
},
"bin": [
"composer/bin/phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.7.x-dev"
}
},
"autoload": {
"classmap": [
"PHPUnit/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"",
"../../symfony/yaml/"
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "http://www.phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2014-01-31 08:54:33"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "1.2.x-dev",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "ed9c8ef8cecd7fa0e7dcee78970e5a972bcfd751"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ed9c8ef8cecd7fa0e7dcee78970e5a972bcfd751",
"reference": "ed9c8ef8cecd7fa0e7dcee78970e5a972bcfd751",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-text-template": ">=1.1.1@stable"
},
"require-dev": {
"phpunit/phpunit": "3.7.*@dev"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"classmap": [
"PHPUnit/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Mock Object library for PHPUnit",
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
"keywords": [
"mock",
"xunit"
],
"time": "2014-01-30 16:40:39"
},
{
"name": "predis/predis",
"version": "0.8.x-dev",
@ -4030,6 +4562,53 @@
"homepage": "http://symfony.com",
"time": "2014-01-24 14:36:08"
},
{
"name": "symfony/yaml",
"version": "dev-master",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
"reference": "9921872611710df49cf035c259e5a461ea2d0f8c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/9921872611710df49cf035c259e5a461ea2d0f8c",
"reference": "9921872611710df49cf035c259e5a461ea2d0f8c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Yaml\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
"time": "2014-01-07 13:29:57"
},
{
"name": "webpatser/laravel-countries",
"version": "dev-master",

2
tests/_bootstrap.php Normal file
View File

@ -0,0 +1,2 @@
<?php
// This is global bootstrap for autoloading

1012
tests/_data/dump.sql Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
<?php
namespace Codeception\Module;
// here you can define custom functions for CodeGuy
class CodeHelper extends \Codeception\Module
{
}

View File

@ -0,0 +1,8 @@
<?php
namespace Codeception\Module;
// here you can define custom functions for TestGuy
class TestHelper extends \Codeception\Module
{
}

View File

@ -0,0 +1,8 @@
<?php
namespace Codeception\Module;
// here you can define custom functions for WebGuy
class WebHelper extends \Codeception\Module
{
}

0
tests/_log/.gitkeep Normal file
View File

View File

@ -0,0 +1,23 @@
# Codeception Test Suite Configuration
# suite for acceptance tests.
# perform tests in browser using the Selenium-like tools.
# powered by Mink (http://mink.behat.org).
# (tip: that's what your customer will see).
# (tip: test your ajax and javascript by one of Mink drivers).
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
class_name: WebGuy
modules:
enabled:
- Selenium2
- WebHelper
- Db
config:
Selenium2:
url: 'http://ninja.dev/'
delay: 2000
browser: phantomjs
capabilities:
webStorageEnabled: true

2610
tests/acceptance/WebGuy.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
<?php
$I = new WebGuy($scenario);
$I->wantTo('ensure that frontpage works');
$I->amOnPage('/rocksteady');
$I->click('#startButton');
$I->seeInDatabase('users', ['id' => 1]);
$I->click('#createClientLink');
$I->fillField('input#email', 'test@aol.com');
$I->click('#clientDoneButton');
$I->click('#saveButton');
$I->seeInDatabase('contacts', ['email' => 'test@aol.com']);
$I->seeInField('input#email', 'test@aol.com');

View File

@ -0,0 +1,2 @@
<?php
// Here you can initialize variables that will for your tests

View File

@ -0,0 +1,11 @@
# Codeception Test Suite Configuration
# suite for functional (integration) tests.
# emulate web requests and make application process them.
# (tip: better to use with frameworks).
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
class_name: TestGuy
modules:
enabled: [Filesystem, TestHelper]

View File

@ -0,0 +1,460 @@
<?php
// This class was automatically generated by build task
// You should not change it manually as it will be overwritten on next build
// @codingStandardsIgnoreFile
use \Codeception\Maybe;
use Codeception\Module\Filesystem;
use Codeception\Module\TestHelper;
/**
* Inherited methods
* @method void execute($callable)
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void offsetGet($offset)
* @method void offsetSet($offset, $value)
* @method void offsetExists($offset)
* @method void offsetUnset($offset)
*/
class TestGuy extends \Codeception\AbstractGuy
{
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Enters a directory In local filesystem.
* Project root directory is used by default
*
* @param $path
* @see Codeception\Module\Filesystem::amInPath()
* @return \Codeception\Maybe
*/
public function amInPath($path) {
$this->scenario->addStep(new \Codeception\Step\Condition('amInPath', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Opens a file and stores it's content.
*
* Usage:
*
* ``` php
* <?php
* $I->openFile('composer.json');
* $I->seeInThisFile('codeception/codeception');
* ?>
* ```
*
* @param $filename
* @see Codeception\Module\Filesystem::openFile()
* @return \Codeception\Maybe
*/
public function openFile($filename) {
$this->scenario->addStep(new \Codeception\Step\Action('openFile', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Deletes a file
*
* ``` php
* <?php
* $I->deleteFile('composer.lock');
* ?>
* ```
*
* @param $filename
* @see Codeception\Module\Filesystem::deleteFile()
* @return \Codeception\Maybe
*/
public function deleteFile($filename) {
$this->scenario->addStep(new \Codeception\Step\Action('deleteFile', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Deletes directory with all subdirectories
*
* ``` php
* <?php
* $I->deleteDir('vendor');
* ?>
* ```
*
* @param $dirname
* @see Codeception\Module\Filesystem::deleteDir()
* @return \Codeception\Maybe
*/
public function deleteDir($dirname) {
$this->scenario->addStep(new \Codeception\Step\Action('deleteDir', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Copies directory with all contents
*
* ``` php
* <?php
* $I->copyDir('vendor','old_vendor');
* ?>
* ```
*
* @param $src
* @param $dst
* @see Codeception\Module\Filesystem::copyDir()
* @return \Codeception\Maybe
*/
public function copyDir($src, $dst) {
$this->scenario->addStep(new \Codeception\Step\Action('copyDir', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Checks If opened file has `text` in it.
*
* Usage:
*
* ``` php
* <?php
* $I->openFile('composer.json');
* $I->seeInThisFile('codeception/codeception');
* ?>
* ```
*
* @param $text
* Conditional Assertion: Test won't be stopped on fail
* @see Codeception\Module\Filesystem::seeInThisFile()
* @return \Codeception\Maybe
*/
public function canSeeInThisFile($text) {
$this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInThisFile', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Checks If opened file has `text` in it.
*
* Usage:
*
* ``` php
* <?php
* $I->openFile('composer.json');
* $I->seeInThisFile('codeception/codeception');
* ?>
* ```
*
* @param $text
* @see Codeception\Module\Filesystem::seeInThisFile()
* @return \Codeception\Maybe
*/
public function seeInThisFile($text) {
$this->scenario->addStep(new \Codeception\Step\Assertion('seeInThisFile', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Checks the strict matching of file contents.
* Unlike `seeInThisFile` will fail if file has something more then expected lines.
* Better to use with HEREDOC strings.
* Matching is done after removing "\r" chars from file content.
*
* ``` php
* <?php
* $I->openFile('process.pid');
* $I->seeFileContentsEqual('3192');
* ?>
* ```
*
* @param $text
* Conditional Assertion: Test won't be stopped on fail
* @see Codeception\Module\Filesystem::seeFileContentsEqual()
* @return \Codeception\Maybe
*/
public function canSeeFileContentsEqual($text) {
$this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeFileContentsEqual', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Checks the strict matching of file contents.
* Unlike `seeInThisFile` will fail if file has something more then expected lines.
* Better to use with HEREDOC strings.
* Matching is done after removing "\r" chars from file content.
*
* ``` php
* <?php
* $I->openFile('process.pid');
* $I->seeFileContentsEqual('3192');
* ?>
* ```
*
* @param $text
* @see Codeception\Module\Filesystem::seeFileContentsEqual()
* @return \Codeception\Maybe
*/
public function seeFileContentsEqual($text) {
$this->scenario->addStep(new \Codeception\Step\Assertion('seeFileContentsEqual', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Checks If opened file doesn't contain `text` in it
*
* ``` php
* <?php
* $I->openFile('composer.json');
* $I->dontSeeInThisFile('codeception/codeception');
* ?>
* ```
*
* @param $text
* Conditional Assertion: Test won't be stopped on fail
* @see Codeception\Module\Filesystem::dontSeeInThisFile()
* @return \Codeception\Maybe
*/
public function cantSeeInThisFile($text) {
$this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInThisFile', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Checks If opened file doesn't contain `text` in it
*
* ``` php
* <?php
* $I->openFile('composer.json');
* $I->dontSeeInThisFile('codeception/codeception');
* ?>
* ```
*
* @param $text
* @see Codeception\Module\Filesystem::dontSeeInThisFile()
* @return \Codeception\Maybe
*/
public function dontSeeInThisFile($text) {
$this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInThisFile', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Deletes a file
* @see Codeception\Module\Filesystem::deleteThisFile()
* @return \Codeception\Maybe
*/
public function deleteThisFile() {
$this->scenario->addStep(new \Codeception\Step\Action('deleteThisFile', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Checks if file exists in path.
* Opens a file when it's exists
*
* ``` php
* <?php
* $I->seeFileFound('UserModel.php','app/models');
* ?>
* ```
*
* @param $filename
* @param string $path
* Conditional Assertion: Test won't be stopped on fail
* @see Codeception\Module\Filesystem::seeFileFound()
* @return \Codeception\Maybe
*/
public function canSeeFileFound($filename, $path = null) {
$this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeFileFound', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Checks if file exists in path.
* Opens a file when it's exists
*
* ``` php
* <?php
* $I->seeFileFound('UserModel.php','app/models');
* ?>
* ```
*
* @param $filename
* @param string $path
* @see Codeception\Module\Filesystem::seeFileFound()
* @return \Codeception\Maybe
*/
public function seeFileFound($filename, $path = null) {
$this->scenario->addStep(new \Codeception\Step\Assertion('seeFileFound', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Erases directory contents
*
* ``` php
* <?php
* $I->cleanDir('logs');
* ?>
* ```
*
* @param $dirname
* @see Codeception\Module\Filesystem::cleanDir()
* @return \Codeception\Maybe
*/
public function cleanDir($dirname) {
$this->scenario->addStep(new \Codeception\Step\Action('cleanDir', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
*
* @see Codeception\Module::getName()
* @return \Codeception\Maybe
*/
public function getName() {
$this->scenario->addStep(new \Codeception\Step\Action('getName', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
}

View File

@ -0,0 +1,2 @@
<?php
// Here you can initialize variables that will for your tests

8
tests/unit.suite.yml Normal file
View File

@ -0,0 +1,8 @@
# Codeception Test Suite Configuration
# suite for unit (internal) tests.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
class_name: CodeGuy
modules:
enabled: [CodeHelper]

47
tests/unit/CodeGuy.php Normal file
View File

@ -0,0 +1,47 @@
<?php
// This class was automatically generated by build task
// You should not change it manually as it will be overwritten on next build
// @codingStandardsIgnoreFile
use \Codeception\Maybe;
use Codeception\Module\CodeHelper;
/**
* Inherited methods
* @method void execute($callable)
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void offsetGet($offset)
* @method void offsetSet($offset, $value)
* @method void offsetExists($offset)
* @method void offsetUnset($offset)
*/
class CodeGuy extends \Codeception\AbstractGuy
{
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
*
* @see Codeception\Module::getName()
* @return \Codeception\Maybe
*/
public function getName() {
$this->scenario->addStep(new \Codeception\Step\Action('getName', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
}

View File

@ -0,0 +1,2 @@
<?php
// Here you can initialize variables that will for your tests