mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Adding permissions to the API
This commit is contained in:
parent
4db5a19885
commit
1b92f66482
@ -70,6 +70,7 @@ class BaseAPIController extends Controller
|
||||
|
||||
protected function returnList($query)
|
||||
{
|
||||
//\DB::enableQueryLog();
|
||||
if ($clientPublicId = Input::get('client_id')) {
|
||||
$filter = function($query) use ($clientPublicId) {
|
||||
$query->where('public_id', '=', $clientPublicId);
|
||||
@ -77,11 +78,20 @@ class BaseAPIController extends Controller
|
||||
$query->whereHas('client', $filter);
|
||||
}
|
||||
|
||||
if ( ! Utils::hasPermission('view_all')){
|
||||
if ($this->entityType == ENTITY_USER) {
|
||||
$query->where('id', '=', Auth::user()->id);
|
||||
} else {
|
||||
$query->where('user_id', '=', Auth::user()->id);
|
||||
}
|
||||
}
|
||||
|
||||
$transformerClass = EntityModel::getTransformerName($this->entityType);
|
||||
$transformer = new $transformerClass(Auth::user()->account, Input::get('serializer'));
|
||||
|
||||
$data = $this->createCollection($query, $transformer, $this->entityType);
|
||||
|
||||
//return \DB::getQueryLog();
|
||||
return $this->response($data);
|
||||
}
|
||||
|
||||
@ -101,11 +111,11 @@ class BaseAPIController extends Controller
|
||||
$entityType = null;
|
||||
}
|
||||
|
||||
if ($query instanceof LengthAwarePaginator) {
|
||||
$resource = new Collection($query, $transformer, $entityType);
|
||||
} else {
|
||||
if (is_a($query, "Illuminate\Database\Eloquent\Builder")) {
|
||||
$resource = new Collection($query->get(), $transformer, $entityType);
|
||||
$resource->setPaginator(new IlluminatePaginatorAdapter($query->paginate()));
|
||||
} else {
|
||||
$resource = new Collection($query, $transformer, $entityType);
|
||||
}
|
||||
|
||||
return $this->manager->createData($resource)->toArray();
|
||||
|
@ -59,8 +59,7 @@ class ClientApiController extends BaseAPIController
|
||||
->withTrashed();
|
||||
|
||||
// Filter by email
|
||||
if (Input::has('email')) {
|
||||
$email = Input::get('email');
|
||||
if ($email = Input::get('email')) {
|
||||
$clients = $clients->whereHas('contacts', function ($query) use ($email) {
|
||||
$query->where('email', $email);
|
||||
});
|
||||
@ -200,7 +199,6 @@ class ClientApiController extends BaseAPIController
|
||||
|
||||
public function destroy($publicId)
|
||||
{
|
||||
|
||||
$client = Client::scope($publicId)->withTrashed()->first();
|
||||
$this->clientRepo->delete($client);
|
||||
|
||||
@ -213,8 +211,6 @@ class ClientApiController extends BaseAPIController
|
||||
$data = $this->createItem($client, $transformer, ENTITY_CLIENT);
|
||||
|
||||
return $this->response($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<?php //[STAMP] a3cf36879dbbec28f15389e7d8d325a2
|
||||
<?php //[STAMP] 33bf8261bed0f36cf769e15182e6d905
|
||||
namespace _generated;
|
||||
|
||||
// This class was automatically generated by build task
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php //[STAMP] 3a5564865956327f909936a09aa15a20
|
||||
<?php //[STAMP] edfdba9bbd7ff01f985af7335c51a510
|
||||
namespace _generated;
|
||||
|
||||
// This class was automatically generated by build task
|
||||
@ -164,7 +164,6 @@ trait FunctionalTesterActions
|
||||
* $I->amOnPage('/');
|
||||
* // opens /register page
|
||||
* $I->amOnPage('/register');
|
||||
* ?>
|
||||
* ```
|
||||
*
|
||||
* @param $page
|
||||
@ -217,17 +216,32 @@ trait FunctionalTesterActions
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that the current page contains the given string.
|
||||
* Specify a locator as the second parameter to match a specific region.
|
||||
* 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
|
||||
* parameter to only search within that element.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->see('Logout'); // I can suppose user is logged in
|
||||
* $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', 'h1'); // I can suppose it's a signup page
|
||||
* $I->see('Sign Up', '//body/h1'); // with XPath
|
||||
* ```
|
||||
*
|
||||
* Note that the search is done after stripping all HTML tags from the body,
|
||||
* so `$I->see('strong')` will return true for strings like:
|
||||
*
|
||||
* - `<p>I am Stronger than thou</p>`
|
||||
* - `<script>document.createElement('strong');</script>`
|
||||
*
|
||||
* But will *not* be true for strings like:
|
||||
*
|
||||
* - `<strong>Home</strong>`
|
||||
* - `<div class="strong">Home</strong>`
|
||||
* - `<!-- strong -->`
|
||||
*
|
||||
* For checking the raw source code, use `seeInSource()`.
|
||||
*
|
||||
* @param $text
|
||||
* @param null $selector
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
@ -239,17 +253,32 @@ trait FunctionalTesterActions
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that the current page contains the given string.
|
||||
* Specify a locator as the second parameter to match a specific region.
|
||||
* 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
|
||||
* parameter to only search within that element.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->see('Logout'); // I can suppose user is logged in
|
||||
* $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', 'h1'); // I can suppose it's a signup page
|
||||
* $I->see('Sign Up', '//body/h1'); // with XPath
|
||||
* ```
|
||||
*
|
||||
* Note that the search is done after stripping all HTML tags from the body,
|
||||
* so `$I->see('strong')` will return true for strings like:
|
||||
*
|
||||
* - `<p>I am Stronger than thou</p>`
|
||||
* - `<script>document.createElement('strong');</script>`
|
||||
*
|
||||
* But will *not* be true for strings like:
|
||||
*
|
||||
* - `<strong>Home</strong>`
|
||||
* - `<div class="strong">Home</strong>`
|
||||
* - `<!-- strong -->`
|
||||
*
|
||||
* For checking the raw source code, use `seeInSource()`.
|
||||
*
|
||||
* @param $text
|
||||
* @param null $selector
|
||||
* @see \Codeception\Lib\InnerBrowser::see()
|
||||
@ -262,7 +291,7 @@ trait FunctionalTesterActions
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that the current page doesn't contain the text specified.
|
||||
* Checks that the current page doesn't contain the text specified (case insensitive).
|
||||
* Give a locator as the second parameter to match a specific region.
|
||||
*
|
||||
* ```php
|
||||
@ -270,9 +299,22 @@ trait FunctionalTesterActions
|
||||
* $I->dontSee('Login'); // I can suppose user is already logged in
|
||||
* $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
|
||||
* $I->dontSee('Sign Up','//body/h1'); // with XPath
|
||||
* ?>
|
||||
* ```
|
||||
*
|
||||
* Note that the search is done after stripping all HTML tags from the body,
|
||||
* so `$I->dontSee('strong')` will fail on strings like:
|
||||
*
|
||||
* - `<p>I am Stronger than thou</p>`
|
||||
* - `<script>document.createElement('strong');</script>`
|
||||
*
|
||||
* But will ignore strings like:
|
||||
*
|
||||
* - `<strong>Home</strong>`
|
||||
* - `<div class="strong">Home</strong>`
|
||||
* - `<!-- strong -->`
|
||||
*
|
||||
* For checking the raw source code, use `seeInSource()`.
|
||||
*
|
||||
* @param $text
|
||||
* @param null $selector
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
@ -284,7 +326,7 @@ trait FunctionalTesterActions
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that the current page doesn't contain the text specified.
|
||||
* Checks that the current page doesn't contain the text specified (case insensitive).
|
||||
* Give a locator as the second parameter to match a specific region.
|
||||
*
|
||||
* ```php
|
||||
@ -292,9 +334,22 @@ trait FunctionalTesterActions
|
||||
* $I->dontSee('Login'); // I can suppose user is already logged in
|
||||
* $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
|
||||
* $I->dontSee('Sign Up','//body/h1'); // with XPath
|
||||
* ?>
|
||||
* ```
|
||||
*
|
||||
* Note that the search is done after stripping all HTML tags from the body,
|
||||
* so `$I->dontSee('strong')` will fail on strings like:
|
||||
*
|
||||
* - `<p>I am Stronger than thou</p>`
|
||||
* - `<script>document.createElement('strong');</script>`
|
||||
*
|
||||
* But will ignore strings like:
|
||||
*
|
||||
* - `<strong>Home</strong>`
|
||||
* - `<div class="strong">Home</strong>`
|
||||
* - `<!-- strong -->`
|
||||
*
|
||||
* For checking the raw source code, use `seeInSource()`.
|
||||
*
|
||||
* @param $text
|
||||
* @param null $selector
|
||||
* @see \Codeception\Lib\InnerBrowser::dontSee()
|
||||
@ -304,6 +359,80 @@ trait FunctionalTesterActions
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that the current page contains the given string in its
|
||||
* raw source code.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeInSource('<h1>Green eggs & ham</h1>');
|
||||
* ```
|
||||
*
|
||||
* @param $raw
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Lib\InnerBrowser::seeInSource()
|
||||
*/
|
||||
public function canSeeInSource($raw) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInSource', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that the current page contains the given string in its
|
||||
* raw source code.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeInSource('<h1>Green eggs & ham</h1>');
|
||||
* ```
|
||||
*
|
||||
* @param $raw
|
||||
* @see \Codeception\Lib\InnerBrowser::seeInSource()
|
||||
*/
|
||||
public function seeInSource($raw) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInSource', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that the current page contains the given string in its
|
||||
* raw source code.
|
||||
*
|
||||
* ```php
|
||||
* <?php
|
||||
* $I->dontSeeInSource('<h1>Green eggs & ham</h1>');
|
||||
* ```
|
||||
*
|
||||
* @param $raw
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Lib\InnerBrowser::dontSeeInSource()
|
||||
*/
|
||||
public function cantSeeInSource($raw) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInSource', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that the current page contains the given string in its
|
||||
* raw source code.
|
||||
*
|
||||
* ```php
|
||||
* <?php
|
||||
* $I->dontSeeInSource('<h1>Green eggs & ham</h1>');
|
||||
* ```
|
||||
*
|
||||
* @param $raw
|
||||
* @see \Codeception\Lib\InnerBrowser::dontSeeInSource()
|
||||
*/
|
||||
public function dontSeeInSource($raw) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInSource', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
@ -645,7 +774,6 @@ trait FunctionalTesterActions
|
||||
*
|
||||
* @param null $uri
|
||||
*
|
||||
* @internal param $url
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl()
|
||||
*/
|
||||
@ -1074,15 +1202,28 @@ trait FunctionalTesterActions
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Submits the given form on the page, optionally with the given form
|
||||
* values. Give the form fields values as an array.
|
||||
* values. Pass the form field's values as an array in the second
|
||||
* parameter.
|
||||
*
|
||||
* Skipped fields will be filled by their values from the page.
|
||||
* Although this function can be used as a short-hand version of
|
||||
* `fillField()`, `selectOption()`, `click()` etc. it has some important
|
||||
* differences:
|
||||
*
|
||||
* * Only field *names* may be used, not CSS/XPath selectors nor field labels
|
||||
* * If a field is sent to this function that does *not* exist on the page,
|
||||
* it will silently be added to the HTTP request. This is helpful for testing
|
||||
* some types of forms, but be aware that you will *not* get an exception
|
||||
* like you would if you called `fillField()` or `selectOption()` with
|
||||
* a missing field.
|
||||
*
|
||||
* Fields that are not provided will be filled by their values from the page,
|
||||
* or from any previous calls to `fillField()`, `selectOption()` etc.
|
||||
* You don't need to click the 'Submit' button afterwards.
|
||||
* This command itself triggers the request to form's action.
|
||||
*
|
||||
* You can optionally specify what button's value to include
|
||||
* in the request with the last parameter as an alternative to
|
||||
* explicitly setting its value in the second parameter, as
|
||||
* You can optionally specify which button's value to include
|
||||
* in the request with the last parameter (as an alternative to
|
||||
* explicitly setting its value in the second parameter), as
|
||||
* button values are not otherwise included in the request.
|
||||
*
|
||||
* Examples:
|
||||
@ -1156,7 +1297,8 @@ trait FunctionalTesterActions
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* Pair this with seeInFormFields for quick testing magic.
|
||||
* This function works well when paired with `seeInFormFields()`
|
||||
* for quickly testing CRUD interfaces and form validation logic.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
@ -1166,15 +1308,14 @@ trait FunctionalTesterActions
|
||||
* 'checkbox1' => true,
|
||||
* // ...
|
||||
* ];
|
||||
* $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
|
||||
* $I->submitForm('#my-form', $form, 'submitButton');
|
||||
* // $I->amOnPage('/path/to/form-page') may be needed
|
||||
* $I->seeInFormFields('//form[@id=my-form]', $form);
|
||||
* ?>
|
||||
* $I->seeInFormFields('#my-form', $form);
|
||||
* ```
|
||||
*
|
||||
* Parameter values can be set to arrays for multiple input fields
|
||||
* of the same name, or multi-select combo boxes. For checkboxes,
|
||||
* either the string value can be used, or boolean values which will
|
||||
* you can use either the string value or boolean `true`/`false` which will
|
||||
* be replaced by the checkbox's value in the DOM.
|
||||
*
|
||||
* ``` php
|
||||
@ -1183,7 +1324,7 @@ trait FunctionalTesterActions
|
||||
* 'field1' => 'value',
|
||||
* 'checkbox' => [
|
||||
* 'value of first checkbox',
|
||||
* 'value of second checkbox,
|
||||
* 'value of second checkbox',
|
||||
* ],
|
||||
* 'otherCheckboxes' => [
|
||||
* true,
|
||||
@ -1195,17 +1336,18 @@ trait FunctionalTesterActions
|
||||
* 'second option value'
|
||||
* ]
|
||||
* ]);
|
||||
* ?>
|
||||
* ```
|
||||
*
|
||||
* Mixing string and boolean values for a checkbox's value is not supported
|
||||
* and may produce unexpected results.
|
||||
*
|
||||
* Field names ending in "[]" must be passed without the trailing square
|
||||
* Field names ending in `[]` must be passed without the trailing square
|
||||
* bracket characters, and must contain an array for its value. This allows
|
||||
* submitting multiple values with the same name, consider:
|
||||
*
|
||||
* ```php
|
||||
* <?php
|
||||
* // This will NOT work correctly
|
||||
* $I->submitForm('#my-form', [
|
||||
* 'field[]' => 'value',
|
||||
* 'field[]' => 'another value', // 'field[]' is already a defined key
|
||||
@ -1215,7 +1357,8 @@ trait FunctionalTesterActions
|
||||
* The solution is to pass an array value:
|
||||
*
|
||||
* ```php
|
||||
* // this way both values are submitted
|
||||
* <?php
|
||||
* // This way both values are submitted
|
||||
* $I->submitForm('#my-form', [
|
||||
* 'field' => [
|
||||
* 'value',
|
||||
@ -1454,7 +1597,7 @@ trait FunctionalTesterActions
|
||||
*
|
||||
* @param $cssOrXpath
|
||||
* @param $attribute
|
||||
* @internal param $element
|
||||
*
|
||||
* @return mixed
|
||||
* @see \Codeception\Lib\InnerBrowser::grabAttributeFrom()
|
||||
*/
|
||||
@ -1466,7 +1609,28 @@ trait FunctionalTesterActions
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Grabs either the text content, or attribute values, of nodes
|
||||
* matched by $cssOrXpath and returns them as an array.
|
||||
*
|
||||
* ```html
|
||||
* <a href="#first">First</a>
|
||||
* <a href="#second">Second</a>
|
||||
* <a href="#third">Third</a>
|
||||
* ```
|
||||
*
|
||||
* ```php
|
||||
* <?php
|
||||
* // would return ['First', 'Second', 'Third']
|
||||
* $aLinkText = $I->grabMultiple('a');
|
||||
*
|
||||
* // would return ['#first', '#second', '#third']
|
||||
* $aLinks = $I->grabMultiple('a', 'href');
|
||||
* ?>
|
||||
* ```
|
||||
*
|
||||
* @param $cssOrXpath
|
||||
* @param $attribute
|
||||
* @return string[]
|
||||
* @see \Codeception\Lib\InnerBrowser::grabMultiple()
|
||||
*/
|
||||
public function grabMultiple($cssOrXpath, $attribute = null) {
|
||||
@ -1491,7 +1655,7 @@ trait FunctionalTesterActions
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Sets a cookie with the given name and value.
|
||||
* You can set additional cookie params like `domain`, `path`, `expire`, `secure` in array passed as last argument.
|
||||
* You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
@ -1972,6 +2136,43 @@ trait FunctionalTesterActions
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Switch to iframe or frame on the page.
|
||||
*
|
||||
* Example:
|
||||
* ``` html
|
||||
* <iframe name="another_frame" src="http://example.com">
|
||||
* ```
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* # switch to iframe
|
||||
* $I->switchToIframe("another_frame");
|
||||
* ```
|
||||
*
|
||||
* @param string $name
|
||||
* @see \Codeception\Lib\InnerBrowser::switchToIframe()
|
||||
*/
|
||||
public function switchToIframe($name) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('switchToIframe', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Moves back in history.
|
||||
*
|
||||
* @param int $numberOfSteps (default value 1)
|
||||
* @see \Codeception\Lib\InnerBrowser::moveBack()
|
||||
*/
|
||||
public function moveBack($numberOfSteps = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('moveBack', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
@ -1996,6 +2197,40 @@ trait FunctionalTesterActions
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Enable Laravel exception handling.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->enableExceptionHandling();
|
||||
* ?>
|
||||
* ```
|
||||
* @see \Codeception\Module\Laravel5::enableExceptionHandling()
|
||||
*/
|
||||
public function enableExceptionHandling() {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('enableExceptionHandling', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Disable Laravel exception handling.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->disableExceptionHandling();
|
||||
* ?>
|
||||
* ```
|
||||
* @see \Codeception\Module\Laravel5::disableExceptionHandling()
|
||||
*/
|
||||
public function disableExceptionHandling() {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('disableExceptionHandling', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
@ -2016,17 +2251,99 @@ trait FunctionalTesterActions
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Enable middleware for the next requests.
|
||||
* Disable events for the next requests.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->enableMiddleware();
|
||||
* $I->disableEvents();
|
||||
* ?>
|
||||
* ```
|
||||
* @see \Codeception\Module\Laravel5::enableMiddleware()
|
||||
* @see \Codeception\Module\Laravel5::disableEvents()
|
||||
*/
|
||||
public function enableMiddleware() {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('enableMiddleware', func_get_args()));
|
||||
public function disableEvents() {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('disableEvents', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Make sure events fired during the test.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeEventTriggered('App\MyEvent');
|
||||
* $I->seeEventTriggered(new App\Events\MyEvent());
|
||||
* $I->seeEventTriggered('App\MyEvent', 'App\MyOtherEvent');
|
||||
* $I->seeEventTriggered(['App\MyEvent', 'App\MyOtherEvent']);
|
||||
* ?>
|
||||
* ```
|
||||
* @param $events
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel5::seeEventTriggered()
|
||||
*/
|
||||
public function canSeeEventTriggered($events) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeEventTriggered', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Make sure events fired during the test.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeEventTriggered('App\MyEvent');
|
||||
* $I->seeEventTriggered(new App\Events\MyEvent());
|
||||
* $I->seeEventTriggered('App\MyEvent', 'App\MyOtherEvent');
|
||||
* $I->seeEventTriggered(['App\MyEvent', 'App\MyOtherEvent']);
|
||||
* ?>
|
||||
* ```
|
||||
* @param $events
|
||||
* @see \Codeception\Module\Laravel5::seeEventTriggered()
|
||||
*/
|
||||
public function seeEventTriggered($events) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeEventTriggered', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Make sure events did not fire during the test.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->dontSeeEventTriggered('App\MyEvent');
|
||||
* $I->dontSeeEventTriggered(new App\Events\MyEvent());
|
||||
* $I->dontSeeEventTriggered('App\MyEvent', 'App\MyOtherEvent');
|
||||
* $I->dontSeeEventTriggered(['App\MyEvent', 'App\MyOtherEvent']);
|
||||
* ?>
|
||||
* ```
|
||||
* @param $events
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel5::dontSeeEventTriggered()
|
||||
*/
|
||||
public function cantSeeEventTriggered($events) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeEventTriggered', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Make sure events did not fire during the test.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->dontSeeEventTriggered('App\MyEvent');
|
||||
* $I->dontSeeEventTriggered(new App\Events\MyEvent());
|
||||
* $I->dontSeeEventTriggered('App\MyEvent', 'App\MyOtherEvent');
|
||||
* $I->dontSeeEventTriggered(['App\MyEvent', 'App\MyOtherEvent']);
|
||||
* ?>
|
||||
* ```
|
||||
* @param $events
|
||||
* @see \Codeception\Module\Laravel5::dontSeeEventTriggered()
|
||||
*/
|
||||
public function dontSeeEventTriggered($events) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeEventTriggered', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
@ -2050,6 +2367,41 @@ trait FunctionalTesterActions
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that current url matches route
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeCurrentRouteIs('posts.index');
|
||||
* ?>
|
||||
* ```
|
||||
* @param $routeName
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel5::seeCurrentRouteIs()
|
||||
*/
|
||||
public function canSeeCurrentRouteIs($routeName) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentRouteIs', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that current url matches route
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeCurrentRouteIs('posts.index');
|
||||
* ?>
|
||||
* ```
|
||||
* @param $routeName
|
||||
* @see \Codeception\Module\Laravel5::seeCurrentRouteIs()
|
||||
*/
|
||||
public function seeCurrentRouteIs($routeName) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentRouteIs', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
@ -2070,43 +2422,6 @@ trait FunctionalTesterActions
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that current url matches route
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeCurrentRouteIs('posts.index');
|
||||
* ?>
|
||||
* ```
|
||||
* @param $route
|
||||
* @param array $params
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel5::seeCurrentRouteIs()
|
||||
*/
|
||||
public function canSeeCurrentRouteIs($route, $params = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentRouteIs', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that current url matches route
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeCurrentRouteIs('posts.index');
|
||||
* ?>
|
||||
* ```
|
||||
* @param $route
|
||||
* @param array $params
|
||||
* @see \Codeception\Module\Laravel5::seeCurrentRouteIs()
|
||||
*/
|
||||
public function seeCurrentRouteIs($route, $params = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentRouteIs', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
@ -2119,11 +2434,10 @@ trait FunctionalTesterActions
|
||||
* ```
|
||||
*
|
||||
* @param $action
|
||||
* @param array $params
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel5::seeCurrentActionIs()
|
||||
*/
|
||||
public function canSeeCurrentActionIs($action, $params = null) {
|
||||
public function canSeeCurrentActionIs($action) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentActionIs', func_get_args()));
|
||||
}
|
||||
/**
|
||||
@ -2138,10 +2452,9 @@ trait FunctionalTesterActions
|
||||
* ```
|
||||
*
|
||||
* @param $action
|
||||
* @param array $params
|
||||
* @see \Codeception\Module\Laravel5::seeCurrentActionIs()
|
||||
*/
|
||||
public function seeCurrentActionIs($action, $params = null) {
|
||||
public function seeCurrentActionIs($action) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentActionIs', func_get_args()));
|
||||
}
|
||||
|
||||
@ -2159,7 +2472,7 @@ trait FunctionalTesterActions
|
||||
* ```
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @param mixed|null $value
|
||||
* @return void
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel5::seeInSession()
|
||||
@ -2180,7 +2493,7 @@ trait FunctionalTesterActions
|
||||
* ```
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @param mixed|null $value
|
||||
* @return void
|
||||
* @see \Codeception\Module\Laravel5::seeInSession()
|
||||
*/
|
||||
@ -2270,16 +2583,53 @@ trait FunctionalTesterActions
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that specific form error messages are set in the view.
|
||||
*
|
||||
* Useful for validation messages e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
*
|
||||
* Example of Usage
|
||||
* Assert that there are no form errors bound to the View.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeFormErrorMessages(array('username'=>'Invalid Username'));
|
||||
* $I->dontSeeFormErrors();
|
||||
* ?>
|
||||
* ```
|
||||
*
|
||||
* @return bool
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel5::dontSeeFormErrors()
|
||||
*/
|
||||
public function cantSeeFormErrors() {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeFormErrors', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that there are no form errors bound to the View.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->dontSeeFormErrors();
|
||||
* ?>
|
||||
* ```
|
||||
*
|
||||
* @return bool
|
||||
* @see \Codeception\Module\Laravel5::dontSeeFormErrors()
|
||||
*/
|
||||
public function dontSeeFormErrors() {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeFormErrors', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that specific form error messages are set in the view.
|
||||
*
|
||||
* This method calls `seeFormErrorMessage` for each entry in the `$bindings` array.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeFormErrorMessages([
|
||||
* 'username' => 'Invalid Username',
|
||||
* 'password' => null,
|
||||
* ]);
|
||||
* ?>
|
||||
* ```
|
||||
* @param array $bindings
|
||||
@ -2294,14 +2644,14 @@ trait FunctionalTesterActions
|
||||
*
|
||||
* Assert that specific form error messages are set in the view.
|
||||
*
|
||||
* Useful for validation messages e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
*
|
||||
* Example of Usage
|
||||
* This method calls `seeFormErrorMessage` for each entry in the `$bindings` array.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeFormErrorMessages(array('username'=>'Invalid Username'));
|
||||
* $I->seeFormErrorMessages([
|
||||
* 'username' => 'Invalid Username',
|
||||
* 'password' => null,
|
||||
* ]);
|
||||
* ?>
|
||||
* ```
|
||||
* @param array $bindings
|
||||
@ -2315,48 +2665,50 @@ trait FunctionalTesterActions
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that specific form error message is set in the view.
|
||||
* Assert that a specific form error message is set in the view.
|
||||
*
|
||||
* Useful for validation messages and generally messages array
|
||||
* e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
* If you want to assert that there is a form error message for a specific key
|
||||
* but don't care about the actual error message you can omit `$expectedErrorMessage`.
|
||||
*
|
||||
* Example of Usage
|
||||
* If you do pass `$expectedErrorMessage`, this method checks if the actual error message for a key
|
||||
* contains `$expectedErrorMessage`.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeFormErrorMessage('username');
|
||||
* $I->seeFormErrorMessage('username', 'Invalid Username');
|
||||
* ?>
|
||||
* ```
|
||||
* @param string $key
|
||||
* @param string $errorMessage
|
||||
* @param string|null $expectedErrorMessage
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel5::seeFormErrorMessage()
|
||||
*/
|
||||
public function canSeeFormErrorMessage($key, $errorMessage) {
|
||||
public function canSeeFormErrorMessage($key, $expectedErrorMessage = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeFormErrorMessage', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Assert that specific form error message is set in the view.
|
||||
* Assert that a specific form error message is set in the view.
|
||||
*
|
||||
* Useful for validation messages and generally messages array
|
||||
* e.g.
|
||||
* return `Redirect::to('register')->withErrors($validator);`
|
||||
* If you want to assert that there is a form error message for a specific key
|
||||
* but don't care about the actual error message you can omit `$expectedErrorMessage`.
|
||||
*
|
||||
* Example of Usage
|
||||
* If you do pass `$expectedErrorMessage`, this method checks if the actual error message for a key
|
||||
* contains `$expectedErrorMessage`.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->seeFormErrorMessage('username');
|
||||
* $I->seeFormErrorMessage('username', 'Invalid Username');
|
||||
* ?>
|
||||
* ```
|
||||
* @param string $key
|
||||
* @param string $errorMessage
|
||||
* @param string|null $expectedErrorMessage
|
||||
* @see \Codeception\Module\Laravel5::seeFormErrorMessage()
|
||||
*/
|
||||
public function seeFormErrorMessage($key, $errorMessage) {
|
||||
public function seeFormErrorMessage($key, $expectedErrorMessage = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeFormErrorMessage', func_get_args()));
|
||||
}
|
||||
|
||||
@ -2368,8 +2720,19 @@ trait FunctionalTesterActions
|
||||
* Takes either an object that implements the User interface or
|
||||
* an array of credentials.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* // provide array of credentials
|
||||
* $I->amLoggedAs(['username' => 'jane@example.com', 'password' => 'password']);
|
||||
*
|
||||
* // provide User object
|
||||
* $I->amLoggedAs( new User );
|
||||
*
|
||||
* // can be verified with $I->seeAuthentication();
|
||||
* ?>
|
||||
* ```
|
||||
* @param \Illuminate\Contracts\Auth\User|array $user
|
||||
* @param string $driver
|
||||
* @param string|null $driver The authentication driver for Laravel <= 5.1.*, guard name for Laravel >= 5.2
|
||||
* @return void
|
||||
* @see \Codeception\Module\Laravel5::amLoggedAs()
|
||||
*/
|
||||
@ -2381,7 +2744,7 @@ trait FunctionalTesterActions
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Logs user out
|
||||
* Logout user.
|
||||
* @see \Codeception\Module\Laravel5::logout()
|
||||
*/
|
||||
public function logout() {
|
||||
@ -2392,20 +2755,24 @@ trait FunctionalTesterActions
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that user is authenticated
|
||||
* Checks that a user is authenticated.
|
||||
* You can specify the guard that should be use for Laravel >= 5.2.
|
||||
* @param string|null $guard
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel5::seeAuthentication()
|
||||
*/
|
||||
public function canSeeAuthentication() {
|
||||
public function canSeeAuthentication($guard = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeAuthentication', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that user is authenticated
|
||||
* Checks that a user is authenticated.
|
||||
* You can specify the guard that should be use for Laravel >= 5.2.
|
||||
* @param string|null $guard
|
||||
* @see \Codeception\Module\Laravel5::seeAuthentication()
|
||||
*/
|
||||
public function seeAuthentication() {
|
||||
public function seeAuthentication($guard = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeAuthentication', func_get_args()));
|
||||
}
|
||||
|
||||
@ -2413,20 +2780,24 @@ trait FunctionalTesterActions
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Check that user is not authenticated
|
||||
* Check that user is not authenticated.
|
||||
* You can specify the guard that should be use for Laravel >= 5.2.
|
||||
* @param string|null $guard
|
||||
* Conditional Assertion: Test won't be stopped on fail
|
||||
* @see \Codeception\Module\Laravel5::dontSeeAuthentication()
|
||||
*/
|
||||
public function cantSeeAuthentication() {
|
||||
public function cantSeeAuthentication($guard = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeAuthentication', func_get_args()));
|
||||
}
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Check that user is not authenticated
|
||||
* Check that user is not authenticated.
|
||||
* You can specify the guard that should be use for Laravel >= 5.2.
|
||||
* @param string|null $guard
|
||||
* @see \Codeception\Module\Laravel5::dontSeeAuthentication()
|
||||
*/
|
||||
public function dontSeeAuthentication() {
|
||||
public function dontSeeAuthentication($guard = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeAuthentication', func_get_args()));
|
||||
}
|
||||
|
||||
@ -2437,7 +2808,6 @@ trait FunctionalTesterActions
|
||||
* Return an instance of a class from the IoC Container.
|
||||
* (http://laravel.com/docs/ioc)
|
||||
*
|
||||
* Example
|
||||
* ``` php
|
||||
* <?php
|
||||
* // In Laravel
|
||||
@ -2586,4 +2956,71 @@ trait FunctionalTesterActions
|
||||
public function grabRecord($tableName, $attributes = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabRecord', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
*
|
||||
* @see \Codeception\Module\Laravel5::haveModel()
|
||||
*/
|
||||
public function haveModel($model, $attributes = null, $name = null, $times = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('haveModel', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Use Laravel's model factory to create a model.
|
||||
* Can only be used with Laravel 5.1 and later.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->createModel('App\User');
|
||||
* $I->createModel('App\User', ['name' => 'John Doe']);
|
||||
* $I->createModel('App\User', [], 'admin');
|
||||
* $I->createModel('App\User', [], 'admin', 3);
|
||||
* ?>
|
||||
* ```
|
||||
*
|
||||
* @see http://laravel.com/docs/5.1/testing#model-factories
|
||||
* @param string $model
|
||||
* @param array $attributes
|
||||
* @param string $name
|
||||
* @param int $times
|
||||
* @return mixed
|
||||
* @see \Codeception\Module\Laravel5::createModel()
|
||||
*/
|
||||
public function createModel($model, $attributes = null, $name = null, $times = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('createModel', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Use Laravel's model factory to make a model.
|
||||
* Can only be used with Laravel 5.1 and later.
|
||||
*
|
||||
* ``` php
|
||||
* <?php
|
||||
* $I->makeModel('App\User');
|
||||
* $I->makeModel('App\User', ['name' => 'John Doe']);
|
||||
* $I->makeModel('App\User', [], 'admin');
|
||||
* $I->makeModel('App\User', [], 'admin', 3);
|
||||
* ?>
|
||||
* ```
|
||||
*
|
||||
* @see http://laravel.com/docs/5.1/testing#model-factories
|
||||
* @param string $model
|
||||
* @param array $attributes
|
||||
* @param string $name
|
||||
* @param int $times
|
||||
* @return mixed
|
||||
* @see \Codeception\Module\Laravel5::makeModel()
|
||||
*/
|
||||
public function makeModel($model, $attributes = null, $name = null, $times = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('makeModel', func_get_args()));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user