diff --git a/app/Http/Controllers/AccountApiController.php b/app/Http/Controllers/AccountApiController.php index 75ef6ac8a383..9c51c40dcd3c 100644 --- a/app/Http/Controllers/AccountApiController.php +++ b/app/Http/Controllers/AccountApiController.php @@ -51,26 +51,21 @@ class AccountApiController extends BaseAPIController $this->accountRepo->createTokens($user, $request->token_name); $users = $this->accountRepo->findUsers($user, 'account.account_tokens'); - $data = $this->createCollection($users, new UserAccountTransformer($user->account, $request->token_name)); + $transformer = new UserAccountTransformer($user->account, $request->serializer, $request->token_name); + $data = $this->createCollection($users, $transformer, 'user_account'); - $response = [ - 'user_accounts' => $data - ]; - - return $this->response($response); + return $this->response($data); } - public function show() + public function show(Request $request) { $account = Auth::user()->account; $account->loadAllData(); - $account = $this->createItem($account, new AccountTransformer); - $response = [ - 'account' => $account - ]; + $transformer = new AccountTransformer(null, $request->serializer); + $account = $this->createItem($account, $transformer, 'account'); - return $this->response($response); + return $this->response($account); } public function getStaticData() diff --git a/app/Http/Controllers/BaseAPIController.php b/app/Http/Controllers/BaseAPIController.php index ac10d6678622..e5878e22ab55 100644 --- a/app/Http/Controllers/BaseAPIController.php +++ b/app/Http/Controllers/BaseAPIController.php @@ -1,12 +1,16 @@ manager = new Manager(); - $this->manager->setSerializer(new ArraySerializer()); + + if ($include = Request::get('include')) { + $this->manager->parseIncludes($include); + } + + $this->serializer = Request::get('serializer') ?: API_SERIALIZER_ARRAY; + + if ($this->serializer === API_SERIALIZER_JSON) { + $this->manager->setSerializer(new JsonApiSerializer()); + } else { + $this->manager->setSerializer(new ArraySerializer()); + } } - protected function createItem($data, $transformer) + protected function createItem($data, $transformer, $entityType) { - $resource = new Item($data, $transformer); + if ($this->serializer && $this->serializer != API_SERIALIZER_JSON) { + $entityType = null; + } + + $resource = new Item($data, $transformer, $entityType); return $this->manager->createData($resource)->toArray(); } - protected function createCollection($data, $transformer) + protected function createCollection($data, $transformer, $entityType, $paginator = false) { - $resource = new Collection($data, $transformer); + if ($this->serializer && $this->serializer != API_SERIALIZER_JSON) { + $entityType = null; + } + + $resource = new Collection($data, $transformer, $entityType); + + if ($paginator) { + $resource->setPaginator(new IlluminatePaginatorAdapter($paginator)); + } + return $this->manager->createData($resource)->toArray(); } protected function response($response) { + $index = Request::get('index') ?: 'data'; + $meta = isset($response['meta']) ? $response['meta'] : null; + $response = [ + $index => $response + ]; + if ($meta) { + $response['meta'] = $meta; + unset($response[$index]['meta']); + } + $response = json_encode($response, JSON_PRETTY_PRINT); $headers = Utils::getApiHeaders(); return Response::make($response, 200, $headers); } + protected function getIncluded() + { + $data = ['user']; + + $included = Request::get('include'); + $included = explode(',', $included); + + foreach ($included as $include) { + if ($include == 'invoices') { + $data[] = 'invoices.invoice_items'; + $data[] = 'invoices.user'; + } elseif ($include == 'clients') { + $data[] = 'clients.contacts'; + $data[] = 'clients.user'; + } elseif ($include) { + $data[] = $include; + } + } + + return $data; + } + } diff --git a/app/Http/Controllers/ClientApiController.php b/app/Http/Controllers/ClientApiController.php index 12d0d25c814a..bbe0f9fde298 100644 --- a/app/Http/Controllers/ClientApiController.php +++ b/app/Http/Controllers/ClientApiController.php @@ -3,10 +3,11 @@ use Utils; use Response; use Input; +use Auth; use App\Models\Client; -use App\Http\Controllers\BaseAPIController; use App\Ninja\Repositories\ClientRepository; use App\Http\Requests\CreateClientRequest; +use App\Http\Controllers\BaseAPIController; use App\Ninja\Transformers\ClientTransformer; class ClientApiController extends BaseAPIController @@ -46,17 +47,16 @@ class ClientApiController extends BaseAPIController public function index() { $clients = Client::scope() - ->with('country', 'contacts', 'industry', 'size', 'currency') + ->with($this->getIncluded()) ->orderBy('created_at', 'desc') - ->get(); + ->paginate(); - $data = $this->createCollection($clients, new ClientTransformer(\Auth::user()->account)); + $transformer = new ClientTransformer(Auth::user()->account, Input::get('serializer')); + $paginator = Client::scope()->paginate(); - $response = [ - 'clients' => $data - ]; + $data = $this->createCollection($clients, $transformer, ENTITY_CLIENT, $paginator); - return $this->response($response); + return $this->response($data); } /** @@ -83,15 +83,14 @@ class ClientApiController extends BaseAPIController public function store(CreateClientRequest $request) { $client = $this->clientRepo->save($request->input()); + + $client = Client::scope($client->public_id) + ->with('country', 'contacts', 'industry', 'size', 'currency') + ->first(); - $client = Client::scope($client->public_id)->with('country', 'contacts', 'industry', 'size', 'currency')->first(); + $transformer = new ClientTransformer(Auth::user()->account, Input::get('serializer')); + $data = $this->createItem($client, $transformer, ENTITY_CLIENT); - $data = $this->createItem($client, new ClientTransformer(\Auth::user()->account)); - - $response = [ - 'client' => $data - ]; - - return $this->response($response); + return $this->response($data); } } diff --git a/app/Http/Controllers/InvoiceApiController.php b/app/Http/Controllers/InvoiceApiController.php index b5f92d9a0eed..a85a1b622cd2 100644 --- a/app/Http/Controllers/InvoiceApiController.php +++ b/app/Http/Controllers/InvoiceApiController.php @@ -13,13 +13,17 @@ use App\Models\Invitation; use App\Ninja\Repositories\ClientRepository; use App\Ninja\Repositories\InvoiceRepository; use App\Ninja\Mailers\ContactMailer as Mailer; +use App\Http\Controllers\BaseAPIController; +use App\Ninja\Transformers\InvoiceTransformer; -class InvoiceApiController extends Controller +class InvoiceApiController extends BaseAPIController { protected $invoiceRepo; public function __construct(InvoiceRepository $invoiceRepo, ClientRepository $clientRepo, Mailer $mailer) { + parent::__construct(); + $this->invoiceRepo = $invoiceRepo; $this->clientRepo = $clientRepo; $this->mailer = $mailer; @@ -41,20 +45,24 @@ class InvoiceApiController extends Controller * ) * ) */ - public function index($clientPublicId = false) + public function index() { + $paginator = Invoice::scope(); $invoices = Invoice::scope() - ->with('client', 'invitations.account') + ->with(array_merge(['invoice_items'], $this->getIncluded())) ->where('invoices.is_quote', '=', false); - if ($clientPublicId) { - $invoices->whereHas('client', function($query) use ($clientPublicId) { + if ($clientPublicId = Input::get('client_id')) { + $filter = function($query) use ($clientPublicId) { $query->where('public_id', '=', $clientPublicId); - }); + }; + $invoices->whereHas('client', $filter); + $paginator->whereHas('client', $filter); } - $invoices = $invoices->orderBy('created_at', 'desc')->get(); + $invoices = $invoices->orderBy('created_at', 'desc')->paginate(); + /* // Add the first invitation link to the data foreach ($invoices as $key => $invoice) { foreach ($invoice->invitations as $subKey => $invitation) { @@ -62,13 +70,14 @@ class InvoiceApiController extends Controller } unset($invoice['invitations']); } + */ - $invoices = Utils::remapPublicIds($invoices); - - $response = json_encode($invoices, JSON_PRETTY_PRINT); - $headers = Utils::getApiHeaders(count($invoices)); + $transformer = new InvoiceTransformer(Auth::user()->account, Input::get('serializer')); + $paginator = $paginator->paginate(); - return Response::make($response, 200, $headers); + $data = $this->createCollection($invoices, $transformer, 'invoices', $paginator); + + return $this->response($data); } @@ -145,14 +154,14 @@ class InvoiceApiController extends Controller if (!$error) { if (!isset($data['client_id']) && !isset($data['email'])) { - $error = trans('validation.', ['attribute' => 'client_id or email']); + $error = trans('validation.required_without', ['attribute' => 'client_id', 'values' => 'email']); } else if (!$client) { $error = trans('validation.not_in', ['attribute' => 'client_id']); } } if ($error) { - $response = json_encode($error, JSON_PRETTY_PRINT); + return $error; } else { $data = self::prepareData($data, $client); $data['client_id'] = $client->id; @@ -170,16 +179,12 @@ class InvoiceApiController extends Controller $this->mailer->sendInvoice($invoice); } - // prepare the return data $invoice = Invoice::scope($invoice->public_id)->with('client', 'invoice_items', 'invitations')->first(); - $invoice = Utils::remapPublicIds([$invoice]); + $transformer = new InvoiceTransformer(\Auth::user()->account, Input::get('serializer')); + $data = $this->createItem($invoice, $transformer, 'invoice'); - $response = json_encode($invoice, JSON_PRETTY_PRINT); + return $this->response($data); } - - $headers = Utils::getApiHeaders(); - - return Response::make($response, $error ? 400 : 200, $headers); } private function prepareData($data, $client) diff --git a/app/Http/Controllers/PaymentApiController.php b/app/Http/Controllers/PaymentApiController.php index f23a26969fb0..b271d4c99996 100644 --- a/app/Http/Controllers/PaymentApiController.php +++ b/app/Http/Controllers/PaymentApiController.php @@ -1,18 +1,23 @@ paymentRepo = $paymentRepo; } @@ -32,27 +37,29 @@ class PaymentApiController extends Controller * ) * ) */ - public function index($clientPublicId = false) + public function index() { + $paginator = Payment::scope(); $payments = Payment::scope() - ->with('client', 'contact', 'invitation', 'user', 'invoice'); + ->with('client.contacts', 'invitation', 'user', 'invoice'); - if ($clientPublicId) { - $payments->whereHas('client', function($query) use ($clientPublicId) { + if ($clientPublicId = Input::get('client_id')) { + $filter = function($query) use ($clientPublicId) { $query->where('public_id', '=', $clientPublicId); - }); + }; + $payments->whereHas('client', $filter); + $paginator->whereHas('client', $filter); } - $payments = $payments->orderBy('created_at', 'desc')->get(); - $payments = Utils::remapPublicIds($payments); + $payments = $payments->orderBy('created_at', 'desc')->paginate(); + $paginator = $paginator->paginate(); + $transformer = new PaymentTransformer(Auth::user()->account, Input::get('serializer')); - $response = json_encode($payments, JSON_PRETTY_PRINT); - $headers = Utils::getApiHeaders(count($payments)); + $data = $this->createCollection($payments, $transformer, 'payments', $paginator); - return Response::make($response, 200, $headers); + return $this->response($data); } - /** * @SWG\Post( * path="/payments", @@ -96,15 +103,17 @@ class PaymentApiController extends Controller $data['transaction_reference'] = ''; } - if (!$error) { - $payment = $this->paymentRepo->save($data); - $payment = Payment::scope($payment->public_id)->with('client', 'contact', 'user', 'invoice')->first(); - - $payment = Utils::remapPublicIds([$payment]); + if ($error) { + return $error; } - $response = json_encode($error ?: $payment, JSON_PRETTY_PRINT); - $headers = Utils::getApiHeaders(); - return Response::make($response, 200, $headers); + + $payment = $this->paymentRepo->save($data); + $payment = Payment::scope($payment->public_id)->with('client', 'contact', 'user', 'invoice')->first(); + + $transformer = new PaymentTransformer(Auth::user()->account, Input::get('serializer')); + $data = $this->createItem($payment, $transformer, 'payment'); + + return $this->response($data); } } diff --git a/app/Http/Controllers/PaymentController.php b/app/Http/Controllers/PaymentController.php index 3b9f1269a124..7ce213b5231f 100644 --- a/app/Http/Controllers/PaymentController.php +++ b/app/Http/Controllers/PaymentController.php @@ -391,11 +391,11 @@ class PaymentController extends BaseController // check if we're creating/using a billing token if ($accountGateway->gateway_id == GATEWAY_STRIPE) { if ($useToken) { - $details['cardReference'] = $client->getGatewayToken(); + $details['customerReference'] = $client->getGatewayToken(); } elseif ($account->token_billing_type_id == TOKEN_BILLING_ALWAYS || Input::get('token_billing')) { $token = $this->paymentService->createToken($gateway, $details, $accountGateway, $client, $invitation->contact_id); if ($token) { - $details['cardReference'] = $token; + $details['customerReference'] = $token; } else { $this->error('Token-No-Ref', $this->paymentService->lastError, $accountGateway); return Redirect::to('payment/'.$invitationKey)->withInput(); diff --git a/app/Http/Controllers/QuoteApiController.php b/app/Http/Controllers/QuoteApiController.php index 055f718fb179..3e3cfa580c23 100644 --- a/app/Http/Controllers/QuoteApiController.php +++ b/app/Http/Controllers/QuoteApiController.php @@ -1,16 +1,22 @@ invoiceRepo = $invoiceRepo; } @@ -30,25 +36,29 @@ class QuoteApiController extends Controller * ) * ) */ - public function index($clientPublicId = false) + public function index() { + $paginator = Invoice::scope(); $invoices = Invoice::scope() - ->with('client', 'user') + ->with('client', 'invitations', 'user', 'invoice_items') ->where('invoices.is_quote', '=', true); - if ($clientPublicId) { - $invoices->whereHas('client', function($query) use ($clientPublicId) { + if ($clientPublicId = Input::get('client_id')) { + $filter = function($query) use ($clientPublicId) { $query->where('public_id', '=', $clientPublicId); - }); + }; + $invoices->whereHas('client', $filter); + $paginator->whereHas('client', $filter); } - $invoices = $invoices->orderBy('created_at', 'desc')->get(); - $invoices = Utils::remapPublicIds($invoices); + $invoices = $invoices->orderBy('created_at', 'desc')->paginate(); + + $transformer = new QuoteTransformer(\Auth::user()->account, Input::get('serializer')); + $paginator = $paginator->paginate(); - $response = json_encode($invoices, JSON_PRETTY_PRINT); - $headers = Utils::getApiHeaders(count($invoices)); + $data = $this->createCollection($invoices, $transformer, 'quotes', $paginator); - return Response::make($response, 200, $headers); + return $this->response($data); } /* diff --git a/app/Http/Controllers/TaskApiController.php b/app/Http/Controllers/TaskApiController.php index ddbd11f7ae92..a302944d2b62 100644 --- a/app/Http/Controllers/TaskApiController.php +++ b/app/Http/Controllers/TaskApiController.php @@ -1,17 +1,22 @@ taskRepo = $taskRepo; } @@ -31,23 +36,27 @@ class TaskApiController extends Controller * ) * ) */ - public function index($clientPublicId = false) + public function index() { - $tasks = Task::scope()->with('client'); + $paginator = Task::scope(); + $tasks = Task::scope() + ->with($this->getIncluded()); - if ($clientPublicId) { - $tasks->whereHas('client', function($query) use ($clientPublicId) { + if ($clientPublicId = Input::get('client_id')) { + $filter = function($query) use ($clientPublicId) { $query->where('public_id', '=', $clientPublicId); - }); + }; + $tasks->whereHas('client', $filter); + $paginator->whereHas('client', $filter); } - $tasks = $tasks->orderBy('created_at', 'desc')->get(); - $tasks = Utils::remapPublicIds($tasks); + $tasks = $tasks->orderBy('created_at', 'desc')->paginate(); + $paginator = $paginator->paginate(); + $transformer = new TaskTransformer(\Auth::user()->account, Input::get('serializer')); - $response = json_encode($tasks, JSON_PRETTY_PRINT); - $headers = Utils::getApiHeaders(count($tasks)); + $data = $this->createCollection($tasks, $transformer, 'tasks', $paginator); - return Response::make($response, 200, $headers); + return $this->response($data); } /** @@ -82,12 +91,11 @@ class TaskApiController extends Controller $task = $this->taskRepo->save($taskId, $data); $task = Task::scope($task->public_id)->with('client')->first(); - $task = Utils::remapPublicIds([$task]); - $response = json_encode($task, JSON_PRETTY_PRINT); - $headers = Utils::getApiHeaders(); + $transformer = new TaskTransformer(Auth::user()->account, Input::get('serializer')); + $data = $this->createItem($task, $transformer, 'task'); - return Response::make($response, 200, $headers); + return $this->response($data); } } diff --git a/app/Http/routes.php b/app/Http/routes.php index f58d5269b522..8d91650c3911 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -199,13 +199,13 @@ Route::group(['middleware' => 'api', 'prefix' => 'api/v1'], function() Route::get('static', 'AccountApiController@getStaticData'); Route::get('accounts', 'AccountApiController@show'); Route::resource('clients', 'ClientApiController'); - Route::get('quotes/{client_id?}', 'QuoteApiController@index'); + Route::get('quotes', 'QuoteApiController@index'); Route::resource('quotes', 'QuoteApiController'); - Route::get('invoices/{client_id?}', 'InvoiceApiController@index'); + Route::get('invoices', 'InvoiceApiController@index'); Route::resource('invoices', 'InvoiceApiController'); - Route::get('payments/{client_id?}', 'PaymentApiController@index'); + Route::get('payments', 'PaymentApiController@index'); Route::resource('payments', 'PaymentApiController'); - Route::get('tasks/{client_id?}', 'TaskApiController@index'); + Route::get('tasks', 'TaskApiController@index'); Route::resource('tasks', 'TaskApiController'); Route::post('hooks', 'IntegrationController@subscribe'); Route::post('email_invoice', 'InvoiceApiController@emailInvoice'); @@ -250,7 +250,9 @@ if (!defined('CONTACT_EMAIL')) { define('RECENTLY_VIEWED', 'RECENTLY_VIEWED'); define('ENTITY_CLIENT', 'client'); + define('ENTITY_CONTACT', 'contact'); define('ENTITY_INVOICE', 'invoice'); + define('ENTITY_INVOICE_ITEMS', 'invoice_items'); define('ENTITY_RECURRING_INVOICE', 'recurring_invoice'); define('ENTITY_PAYMENT', 'payment'); define('ENTITY_CREDIT', 'credit'); @@ -442,6 +444,7 @@ if (!defined('CONTACT_EMAIL')) { define('OUTDATE_BROWSER_URL', 'http://browsehappy.com/'); define('PDFMAKE_DOCS', 'http://pdfmake.org/playground.html'); define('PHANTOMJS_CLOUD', 'http://api.phantomjscloud.com/single/browser/v1/'); + //define('PHANTOMJS_CLOUD', 'http://api.phantomjscloud.com/api/browser/v2/'); define('PHP_DATE_FORMATS', 'http://php.net/manual/en/function.date.php'); define('REFERRAL_PROGRAM_URL', 'https://www.invoiceninja.com/referral-program/'); @@ -492,7 +495,9 @@ if (!defined('CONTACT_EMAIL')) { define('USER_STATE_PENDING', 'pending'); define('USER_STATE_DISABLED', 'disabled'); define('USER_STATE_ADMIN', 'admin'); - + + define('API_SERIALIZER_ARRAY', 'array'); + define('API_SERIALIZER_JSON', 'json'); $creditCards = [ 1 => ['card' => 'images/credit_cards/Test-Visa-Icon.png', 'text' => 'Visa'], @@ -542,7 +547,6 @@ if (!defined('CONTACT_EMAIL')) { } } -/* // Log all SQL queries to laravel.log if (Utils::isNinjaDev()) { Event::listen('illuminate.query', function($query, $bindings, $time, $name) { @@ -564,11 +568,10 @@ if (Utils::isNinjaDev()) { Log::info($query, $data); }); } -*/ /* if (Auth::check() && Auth::user()->id === 1) { Auth::loginUsingId(1); } -*/ +*/ \ No newline at end of file diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index 8ce036dbdbfe..a6ded03507bb 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -590,18 +590,6 @@ class Utils } } - - public static function remapPublicIds($items) - { - $return = []; - - foreach ($items as $item) { - $return[] = $item->toPublicArray(); - } - - return $return; - } - public static function hideIds($data, $mapped = false) { $publicId = null; diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index f2c67b81c418..ee150d6cf3e4 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -612,7 +612,6 @@ class Invoice extends EntityModel implements BalanceAffecting $invitation = $this->invitations[0]; $link = $invitation->getLink(); - $curl = curl_init(); $jsonEncodedData = json_encode([ 'targetUrl' => "{$link}?phantomjs=true", diff --git a/app/Ninja/Transformers/AccountTransformer.php b/app/Ninja/Transformers/AccountTransformer.php index 7e50baff9e6a..d812d243628f 100644 --- a/app/Ninja/Transformers/AccountTransformer.php +++ b/app/Ninja/Transformers/AccountTransformer.php @@ -7,7 +7,7 @@ use App\Models\Product; use League\Fractal; use League\Fractal\TransformerAbstract; -class AccountTransformer extends TransformerAbstract +class AccountTransformer extends EntityTransformer { protected $defaultIncludes = [ 'users', @@ -19,27 +19,32 @@ class AccountTransformer extends TransformerAbstract public function includeUsers(Account $account) { - return $this->collection($account->users, new UserTransformer($account)); + $transformer = new UserTransformer($account, $this->serializer); + return $this->includeCollection($account->users, $transformer, 'users'); } public function includeClients(Account $account) { - return $this->collection($account->clients, new ClientTransformer($account)); + $transformer = new ClientTransformer($account, $this->serializer); + return $this->includeCollection($account->clients, $transformer, 'clients'); } public function includeInvoices(Account $account) { - return $this->collection($account->invoices, new InvoiceTransformer($account)); + $transformer = new InvoiceTransformer($account, $this->serializer); + return $this->includeCollection($account->invoices, $transformer, 'invoices'); } public function includeContacts(Account $account) { - return $this->collection($account->contacts, new ContactTransformer($account)); + $transformer = new ContactTransformer($account, $this->serializer); + return $this->includeCollection($account->contacts, $transformer, 'contacts'); } public function includeProducts(Account $account) { - return $this->collection($account->products, new ProductTransformer($account)); + $transformer = new ProductTransformer($account, $this->serializer); + return $this->includeCollection($account->products, $transformer, 'products'); } public function transform(Account $account) diff --git a/app/Ninja/Transformers/ClientTransformer.php b/app/Ninja/Transformers/ClientTransformer.php index 2f4a8cdf44aa..8423786fd7d4 100644 --- a/app/Ninja/Transformers/ClientTransformer.php +++ b/app/Ninja/Transformers/ClientTransformer.php @@ -40,25 +40,28 @@ class ClientTransformer extends EntityTransformer * @SWG\Property(property="language_id", type="integer", example=1) */ - protected $defaultIncludes = [ - // 'contacts', - // 'invoices', - // 'quotes', + protected $availableIncludes = [ + 'contacts', + 'invoices', + 'quotes', ]; public function includeContacts(Client $client) { - return $this->collection($client->contacts, new ContactTransformer($this->account)); + $transformer = new ContactTransformer($this->account, $this->serializer); + return $this->includeCollection($client->contacts, $transformer, ENTITY_CONTACT); } public function includeInvoices(Client $client) { - return $this->collection($client->getInvoices, new InvoiceTransformer($this->account, $client)); + $transformer = new InvoiceTransformer($this->account, $this->serializer); + return $this->includeCollection($client->getInvoices, $transformer, ENTITY_INVOICE); } public function includeQuotes(Client $client) { - return $this->collection($client->getQuotes, new QuoteTransformer($this->account, $client)); + $transformer = new QuoteTransformer($this->account, $this->serializer); + return $this->includeCollection($client->getQuotes, $transformer, ENTITY_QUOTE); } public function transform(Client $client) @@ -68,7 +71,7 @@ class ClientTransformer extends EntityTransformer 'name' => $client->name, 'balance' => (float) $client->balance, 'paid_to_date' => (float) $client->paid_to_date, - 'user_id' => (int) $client->user->public_id+1, + 'user_id' => (int) $client->user->public_id + 1, 'account_key' => $this->account->account_key, 'updated_at' => $client->updated_at, 'deleted_at' => $client->deleted_at, diff --git a/app/Ninja/Transformers/ContactTransformer.php b/app/Ninja/Transformers/ContactTransformer.php index 5c5cd7d4b00d..51114da5aee4 100644 --- a/app/Ninja/Transformers/ContactTransformer.php +++ b/app/Ninja/Transformers/ContactTransformer.php @@ -20,7 +20,6 @@ class ContactTransformer extends EntityTransformer 'phone' => $contact->phone, 'last_login' => $contact->last_login, 'account_key' => $this->account->account_key, - 'client_id' => $contact->client->public_id ]; } } \ No newline at end of file diff --git a/app/Ninja/Transformers/EntityTransformer.php b/app/Ninja/Transformers/EntityTransformer.php index 11ba0d1fc356..f3d61f94de8d 100644 --- a/app/Ninja/Transformers/EntityTransformer.php +++ b/app/Ninja/Transformers/EntityTransformer.php @@ -1,14 +1,35 @@ account = $account; + $this->serializer = $serializer; + } + + protected function includeCollection($data, $transformer, $entityType) + { + if ($this->serializer && $this->serializer != API_SERIALIZER_JSON) { + $entityType = null; + } + + return $this->collection($data, $transformer, $entityType); + } + + protected function includeItem($data, $transformer, $entityType) + { + if ($this->serializer && $this->serializer != API_SERIALIZER_JSON) { + $entityType = null; + } + + return $this->item($data, $transformer, $entityType); } } diff --git a/app/Ninja/Transformers/InvoiceTransformer.php b/app/Ninja/Transformers/InvoiceTransformer.php index 0024e44117d4..8415374d4e00 100644 --- a/app/Ninja/Transformers/InvoiceTransformer.php +++ b/app/Ninja/Transformers/InvoiceTransformer.php @@ -20,20 +20,14 @@ class InvoiceTransformer extends EntityTransformer * @SWG\Property(property="invoice_status_id", type="integer", example=1) */ - - public function __construct(Account $account) - { - parent::__construct($account); - - } - protected $defaultIncludes = [ 'invoice_items', ]; - + public function includeInvoiceItems(Invoice $invoice) { - return $this->collection($invoice->invoice_items, new InvoiceItemTransformer($this->account)); + $transformer = new InvoiceItemTransformer($this->account, $this->serializer); + return $this->includeCollection($invoice->invoice_items, $transformer, ENTITY_INVOICE_ITEMS); } public function transform(Invoice $invoice) @@ -70,7 +64,7 @@ class InvoiceTransformer extends EntityTransformer 'has_tasks' => (bool) $invoice->has_tasks, 'auto_bill' => (bool) $invoice->auto_bill, 'account_key' => $this->account->account_key, - 'user_id' => (int) $invoice->user->public_id+1 + 'user_id' => (int) $invoice->user->public_id + 1 ]; } } \ No newline at end of file diff --git a/app/Ninja/Transformers/PaymentTransformer.php b/app/Ninja/Transformers/PaymentTransformer.php new file mode 100644 index 000000000000..6ec0b13da78e --- /dev/null +++ b/app/Ninja/Transformers/PaymentTransformer.php @@ -0,0 +1,55 @@ +account, $this->serializer); + return $this->includeItem($payment->invoice, $transformer, 'invoice'); + } + + public function includeClient(Payment $payment) + { + $transformer = new ClientTransformer($this->account, $this->serializer); + return $this->includeItem($payment->client, $transformer, 'client'); + } + + public function transform(Payment $payment) + { + return [ + 'id' => (int) $payment->public_id, + 'amount' => (float) $payment->amount, + 'account_key' => $this->account->account_key, + 'user_id' => (int) $payment->user->public_id + 1, + 'transaction_reference' => $payment->transaction_reference, + ]; + } +} \ No newline at end of file diff --git a/app/Ninja/Transformers/QuoteTransformer.php b/app/Ninja/Transformers/QuoteTransformer.php index 716b29656a59..d012aceb45b8 100644 --- a/app/Ninja/Transformers/QuoteTransformer.php +++ b/app/Ninja/Transformers/QuoteTransformer.php @@ -11,7 +11,8 @@ class QuoteTransformer extends EntityTransformer public function includeInvoiceItems($invoice) { - return $this->collection($invoice->invoice_items, new InvoiceItemTransformer($this->account)); + $transformer = new InvoiceItemTransformer($this->account, $this->serializer); + return $this->includeCollection($invoice->invoice_items, $transformer, 'invoice_items'); } public function transform(Invoice $invoice) diff --git a/app/Ninja/Transformers/TaskTransformer.php b/app/Ninja/Transformers/TaskTransformer.php new file mode 100644 index 000000000000..908a8118aaea --- /dev/null +++ b/app/Ninja/Transformers/TaskTransformer.php @@ -0,0 +1,50 @@ +client) { + $transformer = new ClientTransformer($this->account, $this->serializer); + return $this->includeItem($task->client, $transformer, 'client'); + } else { + return null; + } + } + + public function transform(Task $task) + { + return [ + 'id' => (int) $task->public_id, + 'account_key' => $this->account->account_key, + 'user_id' => (int) $task->user->public_id + 1, + 'description' => $task->description, + 'duration' => $task->getDuration() + ]; + } +} \ No newline at end of file diff --git a/app/Ninja/Transformers/UserAccountTransformer.php b/app/Ninja/Transformers/UserAccountTransformer.php index 18992ae1706f..bc49a96c546a 100644 --- a/app/Ninja/Transformers/UserAccountTransformer.php +++ b/app/Ninja/Transformers/UserAccountTransformer.php @@ -14,16 +14,17 @@ class UserAccountTransformer extends EntityTransformer protected $tokenName; - public function __construct(Account $account, $tokenName) + public function __construct(Account $account, $serializer, $tokenName) { - parent::__construct($account); + parent::__construct($account, $serializer); $this->tokenName = $tokenName; } public function includeUser(User $user) { - return $this->item($user, new UserTransformer($this->account)); + $transformer = new UserTransformer($this->account, $this->serializer); + return $this->includeItem($user, $transformer, 'user'); } public function transform(User $user) diff --git a/app/Services/PaymentService.php b/app/Services/PaymentService.php index 19c95a23bfbf..4d0d53841d8d 100644 --- a/app/Services/PaymentService.php +++ b/app/Services/PaymentService.php @@ -159,7 +159,7 @@ class PaymentService extends BaseService public function createToken($gateway, $details, $accountGateway, $client, $contactId) { $tokenResponse = $gateway->createCard($details)->send(); - $cardReference = $tokenResponse->getCardReference(); + $cardReference = $tokenResponse->getCustomerReference(); if ($cardReference) { $token = AccountGatewayToken::where('client_id', '=', $client->id) @@ -237,7 +237,7 @@ class PaymentService extends BaseService // setup the gateway/payment info $gateway = $this->createGateway($accountGateway); $details = $this->getPaymentDetails($invitation, $accountGateway); - $details['cardReference'] = $token; + $details['customerReference'] = $token; // submit purchase/get response $response = $gateway->purchase($details)->send(); diff --git a/c3.php b/c3.php index 96720d95adc9..cadb3a399b95 100755 --- a/c3.php +++ b/c3.php @@ -33,7 +33,14 @@ if (!array_key_exists('HTTP_X_CODECEPTION_CODECOVERAGE', $_SERVER)) { if (!function_exists('__c3_error')) { function __c3_error($message) { - file_put_contents(C3_CODECOVERAGE_MEDIATE_STORAGE . DIRECTORY_SEPARATOR . 'error.txt', $message); + $errorLogFile = defined('C3_CODECOVERAGE_ERROR_LOG_FILE') ? + C3_CODECOVERAGE_ERROR_LOG_FILE : + C3_CODECOVERAGE_MEDIATE_STORAGE . DIRECTORY_SEPARATOR . 'error.txt'; + if (is_writable($errorLogFile)) { + file_put_contents($errorLogFile, $message); + }else{ + $message = "Could not write error to log file ($errorLogFile), original message: $message"; + } if (!headers_sent()) { header('X-Codeception-CodeCoverage-Error: ' . str_replace("\n", ' ', $message), true, 500); } @@ -43,10 +50,14 @@ if (!function_exists('__c3_error')) { // Autoload Codeception classes if (!class_exists('\\Codeception\\Codecept')) { - if (stream_resolve_include_path(__DIR__ . '/vendor/autoload.php')) { - require_once __DIR__ . '/vendor/autoload.php'; - } elseif (file_exists(__DIR__ . '/codecept.phar')) { + if (file_exists(__DIR__ . '/codecept.phar')) { require_once 'phar://'.__DIR__ . '/codecept.phar/autoload.php'; + } elseif (stream_resolve_include_path(__DIR__ . '/vendor/autoload.php')) { + require_once __DIR__ . '/vendor/autoload.php'; + // Required to load some methods only available at codeception/autoload.php + if (stream_resolve_include_path(__DIR__ . '/vendor/codeception/codeception/autoload.php')) { + require_once __DIR__ . '/vendor/codeception/codeception/autoload.php'; + } } elseif (stream_resolve_include_path('Codeception/autoload.php')) { require_once 'Codeception/autoload.php'; } else { @@ -55,11 +66,18 @@ if (!class_exists('\\Codeception\\Codecept')) { } // Load Codeception Config +$config_dist_file = realpath(__DIR__) . DIRECTORY_SEPARATOR . 'codeception.dist.yml'; $config_file = realpath(__DIR__) . DIRECTORY_SEPARATOR . 'codeception.yml'; + if (isset($_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_CONFIG'])) { $config_file = realpath(__DIR__) . DIRECTORY_SEPARATOR . $_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_CONFIG']; } -if (!file_exists($config_file)) { +if (file_exists($config_file)) { + // Use codeception.yml for configuration. +} elseif (file_exists($config_dist_file)) { + // Use codeception.dist.yml for configuration. + $config_file = $config_dist_file; +} else { __c3_error(sprintf("Codeception config file '%s' not found", $config_file)); } try { @@ -237,4 +255,4 @@ if ($requested_c3_report) { } } -// @codeCoverageIgnoreEnd \ No newline at end of file +// @codeCoverageIgnoreEnd diff --git a/composer.json b/composer.json index 85579d8c9b44..9f128c3f76a7 100644 --- a/composer.json +++ b/composer.json @@ -66,7 +66,7 @@ "require-dev": { "phpunit/phpunit": "~4.0", "phpspec/phpspec": "~2.1", - "codeception/codeception": "~2.0", + "codeception/codeception": "2.1.2", "codeception/c3": "~2.0", "fzaninotto/faker": "^1.5" }, diff --git a/composer.lock b/composer.lock index e532d0739db5..7066d4070c87 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "b6c2660a613f4e94f13f226ec19c66eb", + "hash": "6966ff410ab9fb5745347a70ab9d85ca", "packages": [ { "name": "agmscode/omnipay-agms", @@ -779,16 +779,16 @@ }, { "name": "collizo4sky/omnipay-wepay", - "version": "1.0", + "version": "1.1", "source": { "type": "git", - "url": "https://github.com/Collizo4sky/omnipay-wepay.git", - "reference": "360abf8c4bb4a926c39846abde970ab7dad93cb2" + "url": "https://github.com/collizo4sky/omnipay-wepay.git", + "reference": "bcc235113915c1547f62b8f02019f6289869c95c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Collizo4sky/omnipay-wepay/zipball/360abf8c4bb4a926c39846abde970ab7dad93cb2", - "reference": "360abf8c4bb4a926c39846abde970ab7dad93cb2", + "url": "https://api.github.com/repos/collizo4sky/omnipay-wepay/zipball/bcc235113915c1547f62b8f02019f6289869c95c", + "reference": "bcc235113915c1547f62b8f02019f6289869c95c", "shasum": "" }, "require": { @@ -800,7 +800,7 @@ }, "type": "library", "autoload": { - "psr-0": { + "psr-4": { "Omnipay\\WePay\\": "src/" } }, @@ -809,7 +809,7 @@ "MIT" ], "description": "WePay driver for the Omnipay payment processing library", - "homepage": "https://github.com/Collizo4sky/omnipay-wepay", + "homepage": "https://github.com/collizo4sky/omnipay-wepay", "keywords": [ "gateway", "merchant", @@ -818,7 +818,7 @@ "payment", "wepay" ], - "time": "2015-10-08 14:12:18" + "time": "2015-11-13 13:19:25" }, { "name": "danielstjules/stringy", @@ -2610,12 +2610,12 @@ "source": { "type": "git", "url": "https://github.com/labs7in0/omnipay-wechat.git", - "reference": "d4c46d37f438c48510840aa3e5b806d4280c6b40" + "reference": "4e279ff4535dfa0636a3d6af5c92b8e9dcc4311a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/labs7in0/omnipay-wechat/zipball/d4c46d37f438c48510840aa3e5b806d4280c6b40", - "reference": "d4c46d37f438c48510840aa3e5b806d4280c6b40", + "url": "https://api.github.com/repos/labs7in0/omnipay-wechat/zipball/4e279ff4535dfa0636a3d6af5c92b8e9dcc4311a", + "reference": "4e279ff4535dfa0636a3d6af5c92b8e9dcc4311a", "shasum": "" }, "require": { @@ -2651,7 +2651,7 @@ "purchase", "wechat" ], - "time": "2015-10-27 05:12:08" + "time": "2015-11-16 11:04:21" }, { "name": "laracasts/presenter", @@ -5309,16 +5309,16 @@ }, { "name": "omnipay/stripe", - "version": "v2.2.1", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/thephpleague/omnipay-stripe.git", - "reference": "906377e50045dc2ba9c612aa1f6924157e1f750e" + "reference": "54b816a5e95e34c988d71fb805b0232cfd7c1ce5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/omnipay-stripe/zipball/906377e50045dc2ba9c612aa1f6924157e1f750e", - "reference": "906377e50045dc2ba9c612aa1f6924157e1f750e", + "url": "https://api.github.com/repos/thephpleague/omnipay-stripe/zipball/54b816a5e95e34c988d71fb805b0232cfd7c1ce5", + "reference": "54b816a5e95e34c988d71fb805b0232cfd7c1ce5", "shasum": "" }, "require": { @@ -5362,7 +5362,7 @@ "payment", "stripe" ], - "time": "2015-04-14 18:55:56" + "time": "2015-11-10 16:17:35" }, { "name": "omnipay/targetpay", @@ -6068,16 +6068,16 @@ }, { "name": "symfony/class-loader", - "version": "v2.7.6", + "version": "v2.7.7", "source": { "type": "git", "url": "https://github.com/symfony/class-loader.git", - "reference": "320f8d2a9cdbcbeb24be602c124aae9d998474a4" + "reference": "9d8359ca865621ba7f43ac6a3455d064d064bed7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/class-loader/zipball/320f8d2a9cdbcbeb24be602c124aae9d998474a4", - "reference": "320f8d2a9cdbcbeb24be602c124aae9d998474a4", + "url": "https://api.github.com/repos/symfony/class-loader/zipball/9d8359ca865621ba7f43ac6a3455d064d064bed7", + "reference": "9d8359ca865621ba7f43ac6a3455d064d064bed7", "shasum": "" }, "require": { @@ -6095,7 +6095,10 @@ "autoload": { "psr-4": { "Symfony\\Component\\ClassLoader\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -6113,20 +6116,20 @@ ], "description": "Symfony ClassLoader Component", "homepage": "https://symfony.com", - "time": "2015-10-23 14:47:27" + "time": "2015-10-30 20:10:21" }, { "name": "symfony/console", - "version": "v2.6.11", + "version": "v2.6.12", "target-dir": "Symfony/Component/Console", "source": { "type": "git", - "url": "https://github.com/symfony/Console.git", + "url": "https://github.com/symfony/console.git", "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/0e5e18ae09d3f5c06367759be940e9ed3f568359", + "url": "https://api.github.com/repos/symfony/console/zipball/0e5e18ae09d3f5c06367759be940e9ed3f568359", "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359", "shasum": "" }, @@ -6175,16 +6178,16 @@ }, { "name": "symfony/css-selector", - "version": "v2.7.6", + "version": "v2.7.7", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "e1b865b26be4a56d22a8dee398375044a80c865b" + "reference": "abb47717fb88aebd9437da2fc8bb01a50a36679f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/e1b865b26be4a56d22a8dee398375044a80c865b", - "reference": "e1b865b26be4a56d22a8dee398375044a80c865b", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/abb47717fb88aebd9437da2fc8bb01a50a36679f", + "reference": "abb47717fb88aebd9437da2fc8bb01a50a36679f", "shasum": "" }, "require": { @@ -6199,7 +6202,10 @@ "autoload": { "psr-4": { "Symfony\\Component\\CssSelector\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -6221,20 +6227,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2015-10-11 09:39:48" + "time": "2015-10-30 20:10:21" }, { "name": "symfony/debug", - "version": "v2.6.11", + "version": "v2.6.12", "target-dir": "Symfony/Component/Debug", "source": { "type": "git", - "url": "https://github.com/symfony/Debug.git", + "url": "https://github.com/symfony/debug.git", "reference": "fca5696e0c9787722baa8f2ad6940dfd7a6a6941" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Debug/zipball/fca5696e0c9787722baa8f2ad6940dfd7a6a6941", + "url": "https://api.github.com/repos/symfony/debug/zipball/fca5696e0c9787722baa8f2ad6940dfd7a6a6941", "reference": "fca5696e0c9787722baa8f2ad6940dfd7a6a6941", "shasum": "" }, @@ -6286,16 +6292,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.7.6", + "version": "v2.7.7", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8" + "reference": "7e2f9c31645680026c2372edf66f863fc7757af5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/87a5db5ea887763fa3a31a5471b512ff1596d9b8", - "reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7e2f9c31645680026c2372edf66f863fc7757af5", + "reference": "7e2f9c31645680026c2372edf66f863fc7757af5", "shasum": "" }, "require": { @@ -6321,7 +6327,10 @@ "autoload": { "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -6339,20 +6348,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2015-10-11 09:39:48" + "time": "2015-10-30 20:10:21" }, { "name": "symfony/filesystem", - "version": "v2.7.6", + "version": "v2.7.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "56fd6df73be859323ff97418d97edc1d756df6df" + "reference": "8e173509d7fdbbba3cf34d6d072f2073c0210c1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/56fd6df73be859323ff97418d97edc1d756df6df", - "reference": "56fd6df73be859323ff97418d97edc1d756df6df", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/8e173509d7fdbbba3cf34d6d072f2073c0210c1d", + "reference": "8e173509d7fdbbba3cf34d6d072f2073c0210c1d", "shasum": "" }, "require": { @@ -6367,7 +6376,10 @@ "autoload": { "psr-4": { "Symfony\\Component\\Filesystem\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -6385,20 +6397,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2015-10-18 20:23:18" + "time": "2015-11-18 13:41:01" }, { "name": "symfony/finder", - "version": "v2.6.11", + "version": "v2.6.12", "target-dir": "Symfony/Component/Finder", "source": { "type": "git", - "url": "https://github.com/symfony/Finder.git", + "url": "https://github.com/symfony/finder.git", "reference": "203a10f928ae30176deeba33512999233181dd28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/203a10f928ae30176deeba33512999233181dd28", + "url": "https://api.github.com/repos/symfony/finder/zipball/203a10f928ae30176deeba33512999233181dd28", "reference": "203a10f928ae30176deeba33512999233181dd28", "shasum": "" }, @@ -6439,16 +6451,16 @@ }, { "name": "symfony/http-foundation", - "version": "v2.6.11", + "version": "v2.6.12", "target-dir": "Symfony/Component/HttpFoundation", "source": { "type": "git", - "url": "https://github.com/symfony/HttpFoundation.git", + "url": "https://github.com/symfony/http-foundation.git", "reference": "e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c", "reference": "e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c", "shasum": "" }, @@ -6493,17 +6505,17 @@ }, { "name": "symfony/http-kernel", - "version": "v2.6.11", + "version": "v2.6.12", "target-dir": "Symfony/Component/HttpKernel", "source": { "type": "git", - "url": "https://github.com/symfony/HttpKernel.git", - "reference": "a3f0ed713255c0400a2db38b3ed01989ef4b7322" + "url": "https://github.com/symfony/http-kernel.git", + "reference": "498866a8ca0bcbcd3f3824b1520fa568ff7ca3b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/a3f0ed713255c0400a2db38b3ed01989ef4b7322", - "reference": "a3f0ed713255c0400a2db38b3ed01989ef4b7322", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/498866a8ca0bcbcd3f3824b1520fa568ff7ca3b6", + "reference": "498866a8ca0bcbcd3f3824b1520fa568ff7ca3b6", "shasum": "" }, "require": { @@ -6567,20 +6579,20 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2015-07-26 10:44:22" + "time": "2015-11-23 11:37:53" }, { "name": "symfony/process", - "version": "v2.6.11", + "version": "v2.6.12", "target-dir": "Symfony/Component/Process", "source": { "type": "git", - "url": "https://github.com/symfony/Process.git", + "url": "https://github.com/symfony/process.git", "reference": "57f1e88bb5dafa449b83f9f265b11d52d517b3e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/57f1e88bb5dafa449b83f9f265b11d52d517b3e9", + "url": "https://api.github.com/repos/symfony/process/zipball/57f1e88bb5dafa449b83f9f265b11d52d517b3e9", "reference": "57f1e88bb5dafa449b83f9f265b11d52d517b3e9", "shasum": "" }, @@ -6621,16 +6633,16 @@ }, { "name": "symfony/routing", - "version": "v2.6.11", + "version": "v2.6.12", "target-dir": "Symfony/Component/Routing", "source": { "type": "git", - "url": "https://github.com/symfony/Routing.git", + "url": "https://github.com/symfony/routing.git", "reference": "0a1764d41bbb54f3864808c50569ac382b44d128" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Routing/zipball/0a1764d41bbb54f3864808c50569ac382b44d128", + "url": "https://api.github.com/repos/symfony/routing/zipball/0a1764d41bbb54f3864808c50569ac382b44d128", "reference": "0a1764d41bbb54f3864808c50569ac382b44d128", "shasum": "" }, @@ -6690,7 +6702,7 @@ }, { "name": "symfony/security-core", - "version": "v2.6.11", + "version": "v2.6.12", "target-dir": "Symfony/Component/Security/Core", "source": { "type": "git", @@ -6754,16 +6766,16 @@ }, { "name": "symfony/translation", - "version": "v2.6.11", + "version": "v2.6.12", "target-dir": "Symfony/Component/Translation", "source": { "type": "git", - "url": "https://github.com/symfony/Translation.git", + "url": "https://github.com/symfony/translation.git", "reference": "d84291215b5892834dd8ca8ee52f9cbdb8274904" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/d84291215b5892834dd8ca8ee52f9cbdb8274904", + "url": "https://api.github.com/repos/symfony/translation/zipball/d84291215b5892834dd8ca8ee52f9cbdb8274904", "reference": "d84291215b5892834dd8ca8ee52f9cbdb8274904", "shasum": "" }, @@ -6813,7 +6825,7 @@ }, { "name": "symfony/var-dumper", - "version": "v2.6.11", + "version": "v2.6.12", "target-dir": "Symfony/Component/VarDumper", "source": { "type": "git", @@ -6966,16 +6978,16 @@ }, { "name": "twbs/bootstrap", - "version": "v3.3.5", + "version": "v3.3.6", "source": { "type": "git", "url": "https://github.com/twbs/bootstrap.git", - "reference": "16b48259a62f576e52c903c476bd42b90ab22482" + "reference": "81df608a40bf0629a1dc08e584849bb1e43e0b7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twbs/bootstrap/zipball/16b48259a62f576e52c903c476bd42b90ab22482", - "reference": "16b48259a62f576e52c903c476bd42b90ab22482", + "url": "https://api.github.com/repos/twbs/bootstrap/zipball/81df608a40bf0629a1dc08e584849bb1e43e0b7a", + "reference": "81df608a40bf0629a1dc08e584849bb1e43e0b7a", "shasum": "" }, "replace": { @@ -7013,7 +7025,7 @@ "responsive", "web" ], - "time": "2015-06-16 16:13:22" + "time": "2015-11-24 19:37:05" }, { "name": "vink/omnipay-komoju", @@ -7236,16 +7248,16 @@ }, { "name": "zircote/swagger-php", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/zircote/swagger-php.git", - "reference": "f6624cc067d7894ec32943f5b94cf282c683f7c7" + "reference": "be5d96e56c23cbe52c5bc5e267851323d95c57cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zircote/swagger-php/zipball/f6624cc067d7894ec32943f5b94cf282c683f7c7", - "reference": "f6624cc067d7894ec32943f5b94cf282c683f7c7", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/be5d96e56c23cbe52c5bc5e267851323d95c57cd", + "reference": "be5d96e56c23cbe52c5bc5e267851323d95c57cd", "shasum": "" }, "require": { @@ -7292,28 +7304,32 @@ "rest", "service discovery" ], - "time": "2015-10-18 13:05:54" + "time": "2015-11-13 13:50:11" } ], "packages-dev": [ { "name": "codeception/c3", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/Codeception/c3.git", - "reference": "30321efb2421c5d201d02e2cb8da1a1ca96e4a38" + "reference": "bc22b4f6cd1a7e74a98dbff541c055dbf0f6f7c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/c3/zipball/30321efb2421c5d201d02e2cb8da1a1ca96e4a38", - "reference": "30321efb2421c5d201d02e2cb8da1a1ca96e4a38", + "url": "https://api.github.com/repos/Codeception/c3/zipball/bc22b4f6cd1a7e74a98dbff541c055dbf0f6f7c8", + "reference": "bc22b4f6cd1a7e74a98dbff541c055dbf0f6f7c8", "shasum": "" }, "require": { + "composer-plugin-api": "1.0.0", "php": ">=5.4.0" }, - "type": "library", + "type": "composer-plugin", + "extra": { + "class": "Codeception\\c3\\Installer" + }, "autoload": { "psr-4": { "Codeception\\c3\\": "." @@ -7324,9 +7340,13 @@ "MIT" ], "authors": [ + { + "name": "Tiger Seo", + "email": "tiger.seo@gmail.com" + }, { "name": "Michael Bodnarchuk", - "email": "davert.php@resend.cc", + "email": "davert.php@codegyre.com", "homepage": "http://codegyre.com" } ], @@ -7336,27 +7356,27 @@ "code coverage", "codecoverage" ], - "time": "2014-11-18 22:06:45" + "time": "2015-11-25 04:03:09" }, { "name": "codeception/codeception", - "version": "2.1.4", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/Codeception/Codeception.git", - "reference": "6a812e8a0d1b1db939a29b4dc14cb398b21b6112" + "reference": "521adbb2ee34e9debdd8508a2c41ab2b5c2f042b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/Codeception/zipball/6a812e8a0d1b1db939a29b4dc14cb398b21b6112", - "reference": "6a812e8a0d1b1db939a29b4dc14cb398b21b6112", + "url": "https://api.github.com/repos/Codeception/Codeception/zipball/521adbb2ee34e9debdd8508a2c41ab2b5c2f042b", + "reference": "521adbb2ee34e9debdd8508a2c41ab2b5c2f042b", "shasum": "" }, "require": { "ext-json": "*", "ext-mbstring": "*", "facebook/webdriver": ">=1.0.1", - "guzzlehttp/guzzle": ">=4.1.4 <7.0", + "guzzlehttp/guzzle": ">=4.0|<7.0", "guzzlehttp/psr7": "~1.0", "php": ">=5.4.0", "phpunit/phpunit": "~4.8.0", @@ -7416,7 +7436,7 @@ "functional testing", "unit testing" ], - "time": "2015-11-12 03:57:06" + "time": "2015-08-09 13:48:55" }, { "name": "doctrine/instantiator", @@ -8479,16 +8499,16 @@ }, { "name": "symfony/browser-kit", - "version": "v2.7.6", + "version": "v2.7.7", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "07d664a052572ccc28eb2ab7dbbe82155b1ad367" + "reference": "bd28847ea2193916074c7b11d4fdd78570049694" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/07d664a052572ccc28eb2ab7dbbe82155b1ad367", - "reference": "07d664a052572ccc28eb2ab7dbbe82155b1ad367", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/bd28847ea2193916074c7b11d4fdd78570049694", + "reference": "bd28847ea2193916074c7b11d4fdd78570049694", "shasum": "" }, "require": { @@ -8511,7 +8531,10 @@ "autoload": { "psr-4": { "Symfony\\Component\\BrowserKit\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -8529,20 +8552,20 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2015-10-23 14:47:27" + "time": "2015-11-02 20:20:53" }, { "name": "symfony/dom-crawler", - "version": "v2.7.6", + "version": "v2.7.7", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "5fef7d8b80d8f9992df99d8ee283f420484c9612" + "reference": "b33593cbfe1d81b50d48353f338aca76a08658d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/5fef7d8b80d8f9992df99d8ee283f420484c9612", - "reference": "5fef7d8b80d8f9992df99d8ee283f420484c9612", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/b33593cbfe1d81b50d48353f338aca76a08658d8", + "reference": "b33593cbfe1d81b50d48353f338aca76a08658d8", "shasum": "" }, "require": { @@ -8563,7 +8586,10 @@ "autoload": { "psr-4": { "Symfony\\Component\\DomCrawler\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -8581,20 +8607,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2015-10-11 09:39:48" + "time": "2015-11-02 20:20:53" }, { "name": "symfony/yaml", - "version": "v2.7.6", + "version": "v2.7.7", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "eca9019c88fbe250164affd107bc8057771f3f4d" + "reference": "4cfcd7a9fceba662b3c036b7d9a91f6197af046c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/eca9019c88fbe250164affd107bc8057771f3f4d", - "reference": "eca9019c88fbe250164affd107bc8057771f3f4d", + "url": "https://api.github.com/repos/symfony/yaml/zipball/4cfcd7a9fceba662b3c036b7d9a91f6197af046c", + "reference": "4cfcd7a9fceba662b3c036b7d9a91f6197af046c", "shasum": "" }, "require": { @@ -8609,7 +8635,10 @@ "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -8627,7 +8656,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-10-11 09:39:48" + "time": "2015-11-18 13:41:01" } ], "aliases": [], diff --git a/tests/_support/_generated/AcceptanceTesterActions.php b/tests/_support/_generated/AcceptanceTesterActions.php index 94bb9b320601..3135d9aa0510 100644 --- a/tests/_support/_generated/AcceptanceTesterActions.php +++ b/tests/_support/_generated/AcceptanceTesterActions.php @@ -1,4 +1,4 @@ -getScenario()->runStep(new \Codeception\Step\Action('debugWebDriverLogs', func_get_args())); - } - - /** * [!] Method is generated. Documentation taken from corresponding module. * @@ -260,6 +249,7 @@ trait AcceptanceTesterActions * $I->amOnPage('/'); * // opens /register page * $I->amOnPage('/register'); + * ?> * ``` * * @param $page @@ -273,31 +263,16 @@ trait AcceptanceTesterActions /** * [!] Method is generated. Documentation taken from corresponding module. * - * 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. + * Checks that the current page contains the given string. + * Specify a locator as the second parameter to match a specific region. * * ``` php * 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('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 + * ?> * ``` - * - * Note that the search is done after stripping all HTML tags from the body, - * so `$I->see('strong')` will return true for strings like: - * - * - `
I am Stronger than thou
` - * - `` - * - * But will *not* be true for strings like: - * - * - `Home` - * - `I am Stronger than thou
` - * - `` - * - * But will *not* be true for strings like: - * - * - `Home` - * - `I am Stronger than thou
` - * - `` - * - * But will ignore strings like: - * - * - `Home` - * - `I am Stronger than thou
` - * - `` - * - * But will ignore strings like: - * - * - `Home` - * - `I am Stronger than thou
` - * - `` - * - * But will *not* be true for strings like: - * - * - `Home` - * - `I am Stronger than thou
` - * - `` - * - * But will *not* be true for strings like: - * - * - `Home` - * - `I am Stronger than thou
` - * - `` - * - * But will ignore strings like: - * - * - `Home` - * - `I am Stronger than thou
` - * - `` - * - * But will ignore strings like: - * - * - `Home` - * - `