Fix for approving quote

This commit is contained in:
Hillel Coren 2016-07-04 13:21:40 +03:00
parent 6217419a2f
commit 637f298818
3 changed files with 120 additions and 126 deletions

View File

@ -113,18 +113,9 @@ class InvoiceService extends BaseService
* @param Invitation|null $invitation * @param Invitation|null $invitation
* @return mixed * @return mixed
*/ */
public function convertQuote($quote, Invitation $invitation = null) public function convertQuote($quote)
{ {
$invoice = $this->invoiceRepo->cloneInvoice($quote, $quote->id); return $this->invoiceRepo->cloneInvoice($quote, $quote->id);
if (!$invitation) {
return $invoice;
}
foreach ($invoice->invitations as $invoiceInvitation) {
if ($invitation->contact_id == $invoiceInvitation->contact_id) {
return $invoiceInvitation->invitation_key;
}
}
} }
/** /**
@ -141,7 +132,13 @@ class InvoiceService extends BaseService
} }
if ($account->auto_convert_quote || ! $account->hasFeature(FEATURE_QUOTES)) { if ($account->auto_convert_quote || ! $account->hasFeature(FEATURE_QUOTES)) {
$invoice = $this->convertQuote($quote, $invitation); $invoice = $this->convertQuote($quote);
foreach ($invoice->invitations as $invoiceInvitation) {
if ($invitation->contact_id == $invoiceInvitation->contact_id) {
$invitation = $invoiceInvitation;
}
}
event(new QuoteInvitationWasApproved($quote, $invoice, $invitation)); event(new QuoteInvitationWasApproved($quote, $invoice, $invitation));

View File

@ -1,4 +1,4 @@
<?php //[STAMP] a3cf36879dbbec28f15389e7d8d325a2 <?php //[STAMP] 37380042138360812111baed01969345
namespace _generated; namespace _generated;
// This class was automatically generated by build task // This class was automatically generated by build task
@ -274,8 +274,8 @@ trait AcceptanceTesterActions
* [!] Method is generated. Documentation taken from corresponding module. * [!] Method is generated. Documentation taken from corresponding module.
* *
* Checks that the current page contains the given string (case insensitive). * Checks that the current page contains the given string (case insensitive).
* *
* You can specify a specific HTML element (via CSS or XPath) as the second * You can specify a specific HTML element (via CSS or XPath) as the second
* parameter to only search within that element. * parameter to only search within that element.
* *
* ``` php * ``` php
@ -284,19 +284,19 @@ trait AcceptanceTesterActions
* $I->see('Sign Up', 'h1'); // I can suppose it's a signup page * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page
* $I->see('Sign Up', '//body/h1'); // with XPath * $I->see('Sign Up', '//body/h1'); // with XPath
* ``` * ```
* *
* Note that the search is done after stripping all HTML tags from the body, * Note that the search is done after stripping all HTML tags from the body,
* so `$I->see('strong')` will return true for strings like: * so `$I->see('strong')` will return true for strings like:
* *
* - `<p>I am Stronger than thou</p>` * - `<p>I am Stronger than thou</p>`
* - `<script>document.createElement('strong');</script>` * - `<script>document.createElement('strong');</script>`
* *
* But will *not* be true for strings like: * But will *not* be true for strings like:
* *
* - `<strong>Home</strong>` * - `<strong>Home</strong>`
* - `<div class="strong">Home</strong>` * - `<div class="strong">Home</strong>`
* - `<!-- strong -->` * - `<!-- strong -->`
* *
* For checking the raw source code, use `seeInSource()`. * For checking the raw source code, use `seeInSource()`.
* *
* @param $text * @param $text
@ -311,8 +311,8 @@ trait AcceptanceTesterActions
* [!] Method is generated. Documentation taken from corresponding module. * [!] Method is generated. Documentation taken from corresponding module.
* *
* Checks that the current page contains the given string (case insensitive). * Checks that the current page contains the given string (case insensitive).
* *
* You can specify a specific HTML element (via CSS or XPath) as the second * You can specify a specific HTML element (via CSS or XPath) as the second
* parameter to only search within that element. * parameter to only search within that element.
* *
* ``` php * ``` php
@ -321,19 +321,19 @@ trait AcceptanceTesterActions
* $I->see('Sign Up', 'h1'); // I can suppose it's a signup page * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page
* $I->see('Sign Up', '//body/h1'); // with XPath * $I->see('Sign Up', '//body/h1'); // with XPath
* ``` * ```
* *
* Note that the search is done after stripping all HTML tags from the body, * Note that the search is done after stripping all HTML tags from the body,
* so `$I->see('strong')` will return true for strings like: * so `$I->see('strong')` will return true for strings like:
* *
* - `<p>I am Stronger than thou</p>` * - `<p>I am Stronger than thou</p>`
* - `<script>document.createElement('strong');</script>` * - `<script>document.createElement('strong');</script>`
* *
* But will *not* be true for strings like: * But will *not* be true for strings like:
* *
* - `<strong>Home</strong>` * - `<strong>Home</strong>`
* - `<div class="strong">Home</strong>` * - `<div class="strong">Home</strong>`
* - `<!-- strong -->` * - `<!-- strong -->`
* *
* For checking the raw source code, use `seeInSource()`. * For checking the raw source code, use `seeInSource()`.
* *
* @param $text * @param $text
@ -357,19 +357,19 @@ trait AcceptanceTesterActions
* $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
* $I->dontSee('Sign Up','//body/h1'); // with XPath * $I->dontSee('Sign Up','//body/h1'); // with XPath
* ``` * ```
* *
* Note that the search is done after stripping all HTML tags from the body, * Note that the search is done after stripping all HTML tags from the body,
* so `$I->dontSee('strong')` will fail on strings like: * so `$I->dontSee('strong')` will fail on strings like:
* *
* - `<p>I am Stronger than thou</p>` * - `<p>I am Stronger than thou</p>`
* - `<script>document.createElement('strong');</script>` * - `<script>document.createElement('strong');</script>`
* *
* But will ignore strings like: * But will ignore strings like:
* *
* - `<strong>Home</strong>` * - `<strong>Home</strong>`
* - `<div class="strong">Home</strong>` * - `<div class="strong">Home</strong>`
* - `<!-- strong -->` * - `<!-- strong -->`
* *
* For checking the raw source code, use `seeInSource()`. * For checking the raw source code, use `seeInSource()`.
* *
* @param $text * @param $text
@ -392,19 +392,19 @@ trait AcceptanceTesterActions
* $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
* $I->dontSee('Sign Up','//body/h1'); // with XPath * $I->dontSee('Sign Up','//body/h1'); // with XPath
* ``` * ```
* *
* Note that the search is done after stripping all HTML tags from the body, * Note that the search is done after stripping all HTML tags from the body,
* so `$I->dontSee('strong')` will fail on strings like: * so `$I->dontSee('strong')` will fail on strings like:
* *
* - `<p>I am Stronger than thou</p>` * - `<p>I am Stronger than thou</p>`
* - `<script>document.createElement('strong');</script>` * - `<script>document.createElement('strong');</script>`
* *
* But will ignore strings like: * But will ignore strings like:
* *
* - `<strong>Home</strong>` * - `<strong>Home</strong>`
* - `<div class="strong">Home</strong>` * - `<div class="strong">Home</strong>`
* - `<!-- strong -->` * - `<!-- strong -->`
* *
* For checking the raw source code, use `seeInSource()`. * For checking the raw source code, use `seeInSource()`.
* *
* @param $text * @param $text
@ -1125,7 +1125,7 @@ trait AcceptanceTesterActions
* *
* Checks if the array of form parameters (name => value) are set on the form matched with the * Checks if the array of form parameters (name => value) are set on the form matched with the
* passed selector. * passed selector.
* *
* ``` php * ``` php
* <?php * <?php
* $I->seeInFormFields('form[name=myform]', [ * $I->seeInFormFields('form[name=myform]', [
@ -1134,10 +1134,10 @@ trait AcceptanceTesterActions
* ]); * ]);
* ?> * ?>
* ``` * ```
* *
* For multi-select elements, or to check values of multiple elements with the same name, an * For multi-select elements, or to check values of multiple elements with the same name, an
* array may be passed: * array may be passed:
* *
* ``` php * ``` php
* <?php * <?php
* $I->seeInFormFields('.form-class', [ * $I->seeInFormFields('.form-class', [
@ -1154,7 +1154,7 @@ trait AcceptanceTesterActions
* ``` * ```
* *
* Additionally, checkbox values can be checked with a boolean. * Additionally, checkbox values can be checked with a boolean.
* *
* ``` php * ``` php
* <?php * <?php
* $I->seeInFormFields('#form-id', [ * $I->seeInFormFields('#form-id', [
@ -1163,9 +1163,9 @@ trait AcceptanceTesterActions
* ]); * ]);
* ?> * ?>
* ``` * ```
* *
* Pair this with submitForm for quick testing magic. * Pair this with submitForm for quick testing magic.
* *
* ``` php * ``` php
* <?php * <?php
* $form = [ * $form = [
@ -1179,7 +1179,7 @@ trait AcceptanceTesterActions
* $I->seeInFormFields('//form[@id=my-form]', $form); * $I->seeInFormFields('//form[@id=my-form]', $form);
* ?> * ?>
* ``` * ```
* *
* @param $formSelector * @param $formSelector
* @param $params * @param $params
* Conditional Assertion: Test won't be stopped on fail * Conditional Assertion: Test won't be stopped on fail
@ -1193,7 +1193,7 @@ trait AcceptanceTesterActions
* *
* Checks if the array of form parameters (name => value) are set on the form matched with the * Checks if the array of form parameters (name => value) are set on the form matched with the
* passed selector. * passed selector.
* *
* ``` php * ``` php
* <?php * <?php
* $I->seeInFormFields('form[name=myform]', [ * $I->seeInFormFields('form[name=myform]', [
@ -1202,10 +1202,10 @@ trait AcceptanceTesterActions
* ]); * ]);
* ?> * ?>
* ``` * ```
* *
* For multi-select elements, or to check values of multiple elements with the same name, an * For multi-select elements, or to check values of multiple elements with the same name, an
* array may be passed: * array may be passed:
* *
* ``` php * ``` php
* <?php * <?php
* $I->seeInFormFields('.form-class', [ * $I->seeInFormFields('.form-class', [
@ -1222,7 +1222,7 @@ trait AcceptanceTesterActions
* ``` * ```
* *
* Additionally, checkbox values can be checked with a boolean. * Additionally, checkbox values can be checked with a boolean.
* *
* ``` php * ``` php
* <?php * <?php
* $I->seeInFormFields('#form-id', [ * $I->seeInFormFields('#form-id', [
@ -1231,9 +1231,9 @@ trait AcceptanceTesterActions
* ]); * ]);
* ?> * ?>
* ``` * ```
* *
* Pair this with submitForm for quick testing magic. * Pair this with submitForm for quick testing magic.
* *
* ``` php * ``` php
* <?php * <?php
* $form = [ * $form = [
@ -1247,7 +1247,7 @@ trait AcceptanceTesterActions
* $I->seeInFormFields('//form[@id=my-form]', $form); * $I->seeInFormFields('//form[@id=my-form]', $form);
* ?> * ?>
* ``` * ```
* *
* @param $formSelector * @param $formSelector
* @param $params * @param $params
* @see \Codeception\Module\WebDriver::seeInFormFields() * @see \Codeception\Module\WebDriver::seeInFormFields()
@ -1262,7 +1262,7 @@ trait AcceptanceTesterActions
* *
* Checks if the array of form parameters (name => value) are not set on the form matched with * Checks if the array of form parameters (name => value) are not set on the form matched with
* the passed selector. * the passed selector.
* *
* ``` php * ``` php
* <?php * <?php
* $I->dontSeeInFormFields('form[name=myform]', [ * $I->dontSeeInFormFields('form[name=myform]', [
@ -1271,10 +1271,10 @@ trait AcceptanceTesterActions
* ]); * ]);
* ?> * ?>
* ``` * ```
* *
* To check that an element hasn't been assigned any one of many values, an array can be passed * To check that an element hasn't been assigned any one of many values, an array can be passed
* as the value: * as the value:
* *
* ``` php * ``` php
* <?php * <?php
* $I->dontSeeInFormFields('.form-class', [ * $I->dontSeeInFormFields('.form-class', [
@ -1287,7 +1287,7 @@ trait AcceptanceTesterActions
* ``` * ```
* *
* Additionally, checkbox values can be checked with a boolean. * Additionally, checkbox values can be checked with a boolean.
* *
* ``` php * ``` php
* <?php * <?php
* $I->dontSeeInFormFields('#form-id', [ * $I->dontSeeInFormFields('#form-id', [
@ -1296,7 +1296,7 @@ trait AcceptanceTesterActions
* ]); * ]);
* ?> * ?>
* ``` * ```
* *
* @param $formSelector * @param $formSelector
* @param $params * @param $params
* Conditional Assertion: Test won't be stopped on fail * Conditional Assertion: Test won't be stopped on fail
@ -1310,7 +1310,7 @@ trait AcceptanceTesterActions
* *
* Checks if the array of form parameters (name => value) are not set on the form matched with * Checks if the array of form parameters (name => value) are not set on the form matched with
* the passed selector. * the passed selector.
* *
* ``` php * ``` php
* <?php * <?php
* $I->dontSeeInFormFields('form[name=myform]', [ * $I->dontSeeInFormFields('form[name=myform]', [
@ -1319,10 +1319,10 @@ trait AcceptanceTesterActions
* ]); * ]);
* ?> * ?>
* ``` * ```
* *
* To check that an element hasn't been assigned any one of many values, an array can be passed * To check that an element hasn't been assigned any one of many values, an array can be passed
* as the value: * as the value:
* *
* ``` php * ``` php
* <?php * <?php
* $I->dontSeeInFormFields('.form-class', [ * $I->dontSeeInFormFields('.form-class', [
@ -1335,7 +1335,7 @@ trait AcceptanceTesterActions
* ``` * ```
* *
* Additionally, checkbox values can be checked with a boolean. * Additionally, checkbox values can be checked with a boolean.
* *
* ``` php * ``` php
* <?php * <?php
* $I->dontSeeInFormFields('#form-id', [ * $I->dontSeeInFormFields('#form-id', [
@ -1344,7 +1344,7 @@ trait AcceptanceTesterActions
* ]); * ]);
* ?> * ?>
* ``` * ```
* *
* @param $formSelector * @param $formSelector
* @param $params * @param $params
* @see \Codeception\Module\WebDriver::dontSeeInFormFields() * @see \Codeception\Module\WebDriver::dontSeeInFormFields()
@ -1375,6 +1375,15 @@ trait AcceptanceTesterActions
* ?> * ?>
* ``` * ```
* *
* Or provide an associative array for the second argument to specifically define which selection method should be used:
*
* ``` php
* <?php
* $I->selectOption('Which OS do you use?', array('text' => 'Windows')); // Only search by text 'Windows'
* $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only search by value 'windows'
* ?>
+ ```
*
* @param $select * @param $select
* @param $option * @param $option
* @see \Codeception\Module\WebDriver::selectOption() * @see \Codeception\Module\WebDriver::selectOption()
@ -1492,7 +1501,8 @@ trait AcceptanceTesterActions
* [!] Method is generated. Documentation taken from corresponding module. * [!] Method is generated. Documentation taken from corresponding module.
* *
* Finds and returns the text contents of the given element. * Finds and returns the text contents of the given element.
* If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression. * If a fuzzy locator is used, the element is found using CSS, XPath,
* and by matching the full page source by regular expression.
* *
* ``` php * ``` php
* <?php * <?php
@ -1566,23 +1576,23 @@ trait AcceptanceTesterActions
* *
* Grabs either the text content, or attribute values, of nodes * Grabs either the text content, or attribute values, of nodes
* matched by $cssOrXpath and returns them as an array. * matched by $cssOrXpath and returns them as an array.
* *
* ```html * ```html
* <a href="#first">First</a> * <a href="#first">First</a>
* <a href="#second">Second</a> * <a href="#second">Second</a>
* <a href="#third">Third</a> * <a href="#third">Third</a>
* ``` * ```
* *
* ```php * ```php
* <?php * <?php
* // would return ['First', 'Second', 'Third'] * // would return ['First', 'Second', 'Third']
* $aLinkText = $I->grabMultiple('a'); * $aLinkText = $I->grabMultiple('a');
* *
* // would return ['#first', '#second', '#third'] * // would return ['#first', '#second', '#third']
* $aLinks = $I->grabMultiple('a', 'href'); * $aLinks = $I->grabMultiple('a', 'href');
* ?> * ?>
* ``` * ```
* *
* @param $cssOrXpath * @param $cssOrXpath
* @param $attribute * @param $attribute
* @return string[] * @return string[]
@ -1981,7 +1991,8 @@ trait AcceptanceTesterActions
* [!] Method is generated. Documentation taken from corresponding module. * [!] Method is generated. Documentation taken from corresponding module.
* *
* Accepts the active JavaScript native popup window, as created by `window.alert`|`window.confirm`|`window.prompt`. * Accepts the active JavaScript native popup window, as created by `window.alert`|`window.confirm`|`window.prompt`.
* Don't confuse popups with modal windows, as created by [various libraries](http://jster.net/category/windows-modals-popups). * Don't confuse popups with modal windows,
* as created by [various libraries](http://jster.net/category/windows-modals-popups).
* @see \Codeception\Module\WebDriver::acceptPopup() * @see \Codeception\Module\WebDriver::acceptPopup()
*/ */
public function acceptPopup() { public function acceptPopup() {
@ -2003,7 +2014,8 @@ trait AcceptanceTesterActions
/** /**
* [!] Method is generated. Documentation taken from corresponding module. * [!] Method is generated. Documentation taken from corresponding module.
* *
* Checks that the active JavaScript popup, as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string. * Checks that the active JavaScript popup,
* as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string.
* *
* @param $text * @param $text
* Conditional Assertion: Test won't be stopped on fail * Conditional Assertion: Test won't be stopped on fail
@ -2015,7 +2027,8 @@ trait AcceptanceTesterActions
/** /**
* [!] Method is generated. Documentation taken from corresponding module. * [!] Method is generated. Documentation taken from corresponding module.
* *
* Checks that the active JavaScript popup, as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string. * Checks that the active JavaScript popup,
* as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string.
* *
* @param $text * @param $text
* @see \Codeception\Module\WebDriver::seeInPopup() * @see \Codeception\Module\WebDriver::seeInPopup()
@ -2224,7 +2237,8 @@ trait AcceptanceTesterActions
* [!] Method is generated. Documentation taken from corresponding module. * [!] Method is generated. Documentation taken from corresponding module.
* *
* Waits up to $timeout seconds for the given element to change. * Waits up to $timeout seconds for the given element to change.
* Element "change" is determined by a callback function which is called repeatedly until the return value evaluates to true. * Element "change" is determined by a callback function which is called repeatedly
* until the return value evaluates to true.
* *
* ``` php * ``` php
* <?php * <?php
@ -2365,7 +2379,8 @@ trait AcceptanceTesterActions
* }); * });
* ``` * ```
* *
* This runs in the context of the [RemoteWebDriver class](https://github.com/facebook/php-webdriver/blob/master/lib/remote/RemoteWebDriver.php). * This runs in the context of the
* [RemoteWebDriver class](https://github.com/facebook/php-webdriver/blob/master/lib/remote/RemoteWebDriver.php).
* Try not to use this command on a regular basis. * Try not to use this command on a regular basis.
* If Codeception lacks a feature you need, please implement it and submit a patch. * If Codeception lacks a feature you need, please implement it and submit a patch.
* *
@ -2526,7 +2541,8 @@ trait AcceptanceTesterActions
* [!] Method is generated. Documentation taken from corresponding module. * [!] Method is generated. Documentation taken from corresponding module.
* *
* Move mouse over the first element matched by the given locator. * Move mouse over the first element matched by the given locator.
* If the second and third parameters are given, then the mouse is moved to an offset of the element's top-left corner. * If the second and third parameters are given,
* then the mouse is moved to an offset of the element's top-left corner.
* Otherwise, the mouse is moved to the center of the element. * Otherwise, the mouse is moved to the center of the element.
* *
* ``` php * ``` php
@ -2567,7 +2583,8 @@ trait AcceptanceTesterActions
* Pauses test execution in debug mode. * Pauses test execution in debug mode.
* To proceed test press "ENTER" in console. * To proceed test press "ENTER" in console.
* *
* This method is useful while writing tests, since it allows you to inspect the current page in the middle of a test case. * This method is useful while writing tests,
* since it allows you to inspect the current page in the middle of a test case.
* @see \Codeception\Module\WebDriver::pauseExecution() * @see \Codeception\Module\WebDriver::pauseExecution()
*/ */
public function pauseExecution() { public function pauseExecution() {
@ -2668,7 +2685,8 @@ trait AcceptanceTesterActions
* [!] Method is generated. Documentation taken from corresponding module. * [!] Method is generated. Documentation taken from corresponding module.
* *
* Move to the middle of the given element matched by the given locator. * Move to the middle of the given element matched by the given locator.
* Extra shift, calculated from the top-left corner of the element, can be set by passing $offsetX and $offsetY parameters. * Extra shift, calculated from the top-left corner of the element,
* can be set by passing $offsetX and $offsetY parameters.
* *
* ``` php * ``` php
* <?php * <?php
@ -2697,7 +2715,7 @@ trait AcceptanceTesterActions
* ?> * ?>
* ``` * ```
* *
* @param $table * @param string $table
* @param array $data * @param array $data
* *
* @return integer $id * @return integer $id
@ -2714,21 +2732,13 @@ trait AcceptanceTesterActions
* Asserts that a row with the given column values exists. * Asserts that a row with the given column values exists.
* Provide table name and column values. * Provide table name and column values.
* *
* Example:
*
* ``` php * ``` php
* <?php * <?php
* $I->seeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com')); * $I->seeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com'));
*
* ```
* Will generate:
*
* ``` sql
* SELECT COUNT(*) FROM `users` WHERE `name` = 'Davert' AND `email` = 'davert@mail.com'
* ``` * ```
* Fails if no such user found. * Fails if no such user found.
* *
* @param $table * @param string $table
* @param array $criteria * @param array $criteria
* Conditional Assertion: Test won't be stopped on fail * Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Module\Db::seeInDatabase() * @see \Codeception\Module\Db::seeInDatabase()
@ -2742,21 +2752,13 @@ trait AcceptanceTesterActions
* Asserts that a row with the given column values exists. * Asserts that a row with the given column values exists.
* Provide table name and column values. * Provide table name and column values.
* *
* Example:
*
* ``` php * ``` php
* <?php * <?php
* $I->seeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com')); * $I->seeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com'));
*
* ```
* Will generate:
*
* ``` sql
* SELECT COUNT(*) FROM `users` WHERE `name` = 'Davert' AND `email` = 'davert@mail.com'
* ``` * ```
* Fails if no such user found. * Fails if no such user found.
* *
* @param $table * @param string $table
* @param array $criteria * @param array $criteria
* @see \Codeception\Module\Db::seeInDatabase() * @see \Codeception\Module\Db::seeInDatabase()
*/ */
@ -2776,9 +2778,9 @@ trait AcceptanceTesterActions
* ?> * ?>
* ``` * ```
* *
* @param int $expectedNumber Expected number * @param int $expectedNumber Expected number
* @param string $table Table name * @param string $table Table name
* @param array $criteria Search criteria [Optional] * @param array $criteria Search criteria [Optional]
* Conditional Assertion: Test won't be stopped on fail * Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Module\Db::seeNumRecords() * @see \Codeception\Module\Db::seeNumRecords()
*/ */
@ -2796,9 +2798,9 @@ trait AcceptanceTesterActions
* ?> * ?>
* ``` * ```
* *
* @param int $expectedNumber Expected number * @param int $expectedNumber Expected number
* @param string $table Table name * @param string $table Table name
* @param array $criteria Search criteria [Optional] * @param array $criteria Search criteria [Optional]
* @see \Codeception\Module\Db::seeNumRecords() * @see \Codeception\Module\Db::seeNumRecords()
*/ */
public function seeNumRecords($expectedNumber, $table, $criteria = null) { public function seeNumRecords($expectedNumber, $table, $criteria = null) {
@ -2814,21 +2816,13 @@ trait AcceptanceTesterActions
* Asserts that there is no record with the given column values in a database. * Asserts that there is no record with the given column values in a database.
* Provide table name and column values. * Provide table name and column values.
* *
* Example:
*
* ``` php * ``` php
* <?php * <?php
* $I->dontSeeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com')); * $I->dontSeeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com'));
*
* ```
* Will generate:
*
* ``` sql
* SELECT COUNT(*) FROM `users` WHERE `name` = 'Davert' AND `email` = 'davert@mail.com'
* ``` * ```
* Fails if such user was found. * Fails if such user was found.
* *
* @param $table * @param string $table
* @param array $criteria * @param array $criteria
* Conditional Assertion: Test won't be stopped on fail * Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Module\Db::dontSeeInDatabase() * @see \Codeception\Module\Db::dontSeeInDatabase()
@ -2844,21 +2838,13 @@ trait AcceptanceTesterActions
* Asserts that there is no record with the given column values in a database. * Asserts that there is no record with the given column values in a database.
* Provide table name and column values. * Provide table name and column values.
* *
* Example:
*
* ``` php * ``` php
* <?php * <?php
* $I->dontSeeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com')); * $I->dontSeeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com'));
*
* ```
* Will generate:
*
* ``` sql
* SELECT COUNT(*) FROM `users` WHERE `name` = 'Davert' AND `email` = 'davert@mail.com'
* ``` * ```
* Fails if such user was found. * Fails if such user was found.
* *
* @param $table * @param string $table
* @param array $criteria * @param array $criteria
* @see \Codeception\Module\Db::dontSeeInDatabase() * @see \Codeception\Module\Db::dontSeeInDatabase()
*/ */
@ -2873,18 +2859,13 @@ trait AcceptanceTesterActions
* Fetches a single column value from a database. * Fetches a single column value from a database.
* Provide table name, desired column and criteria. * Provide table name, desired column and criteria.
* *
* Example:
*
* ``` php * ``` php
* <?php * <?php
* $mail = $I->grabFromDatabase('users', 'email', array('name' => 'Davert')); * $mail = $I->grabFromDatabase('users', 'email', array('name' => 'Davert'));
*
* ``` * ```
* *
* @version 1.1 * @param string $table
* * @param string $column
* @param $table
* @param $column
* @param array $criteria * @param array $criteria
* *
* @return mixed * @return mixed
@ -2893,4 +2874,20 @@ trait AcceptanceTesterActions
public function grabFromDatabase($table, $column, $criteria = null) { public function grabFromDatabase($table, $column, $criteria = null) {
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromDatabase', func_get_args())); return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromDatabase', func_get_args()));
} }
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Returns the number of rows in a database
*
* @param string $table Table name
* @param array $criteria Search criteria [Optional]
*
* @return int
* @see \Codeception\Module\Db::grabNumRecords()
*/
public function grabNumRecords($table, $criteria = null) {
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabNumRecords', func_get_args()));
}
} }

View File

@ -8,7 +8,7 @@ class_name: AcceptanceTester
modules: modules:
enabled: enabled:
- WebDriver: - WebDriver:
url: 'http://ninja.dev:8000/' url: 'http://ninja.dev/'
window_size: 1024x768 window_size: 1024x768
wait: 5 wait: 5
browser: firefox browser: firefox
@ -20,4 +20,4 @@ modules:
user: 'ninja' user: 'ninja'
password: 'ninja' password: 'ninja'
dump: tests/_data/dump.sql dump: tests/_data/dump.sql
- \Helper\Acceptance - \Helper\Acceptance