/** * @test */ public function shouldGetDocumentWithAccounts() { //when $document = Document::where(array('document_name' => "LIKE 'Zrzut ekranu%'"))->fetch(); //then Assert::thatArray($document->accounts)->hasSize(2)->onProperty('name')->containsOnly("Air Safety Inc", "Airline Maintenance Co"); }
/** * @test */ public function shouldGetModuleFields() { //when $moduleFields = ModuleFields::forModule('Contacts')->all(); //then Assert::thatArray($moduleFields)->hasSize(63); }
/** * @test */ public function shouldReturnAccountWithBugs() { //when $account = Account::where(array('name' => "LIKE 'Air Sa%'"))->fetch(); //then Assert::thatArray($account->bugs)->hasSize(2)->onProperty('name')->containsOnly("Syntax error appears when running old reports", "Broken image appears in home page"); }
/** * @test */ public function shouldReturnContactsForBug() { //given //when $bug = Bug::findById('b0d20087-ef60-36cf-8d79-5404b012b723'); //then Assert::thatArray($bug->contacts)->hasSize(1)->onProperty('name')->containsOnly("Dante Tibbs"); }
/** * @test */ public function shouldBuildNotExistsClause() { // when $result = WhereClause::notExists(Product::where(array('name' => 'phone'))); // then $this->assertEquals(array('phone'), $result->getParameters()); Assert::thatString($result->toSql())->startsWith('NOT EXISTS (SELECT')->endsWith('FROM products WHERE name = ?)'); }
/** * @test */ public function shouldReplaceClassNameAndNamespace() { //given $generator = new ControllerGenerator('users'); //when $templateContents = $generator->templateContents(); //then Assert::thatString($templateContents)->contains('namespace \\Application\\Controller;')->contains('class UsersController extends Controller'); }
/** * @test */ public function shouldParseTwoFields() { //given $method = 'findByShippingAddressPostalcodeAndName'; //when $match = DynamicFinder::match($method); //then Assert::thatArray($match->getNames())->containsExactly('shipping_address_postalcode', 'name'); }
/** * @test */ public function shouldReturnReplacedTemplateContents() { //given $actionGenerator = new ActionGenerator('index'); //when $templateContents = $actionGenerator->templateContents(); //then Assert::thatString($templateContents)->contains('public function index'); }
/** * @test */ public function shouldResolveDirectoryPath() { //given $resolver = ClassPathResolver::forClassAndNamespace('UserAcl', '\\Application\\View'); //when $directoryPath = $resolver->getClassDirectory(); //then Assert::thatString($directoryPath)->endsWith(Path::join('Application', 'View', 'UserAcl')); }
/** * @test */ public function shouldOrderEagerlyFetchedRelation() { //given $category = Category::where(array('name' => 'sony'))->fetch(); //when $products = $category->products_ordered_by_name; //then Assert::thatArray($products)->onProperty('name')->containsExactly('a', 'b', 'c'); }
/** * @test */ public function shouldCreateRouteForResource() { //given GroupedRoute::resource('users'); //when $routes = Route::getRoutes(); //then Assert::thatArray($routes)->onMethod('getUri')->containsOnly('/api/users', '/api/users/fresh', '/api/users/:id/edit', '/api/users/:id', '/api/users', '/api/users/:id', '/api/users/:id', '/api/users/:id'); }
/** * @test */ public function shouldPassIfModelsAreEqual() { //given $product = new Product(array('name' => 'abc')); //when $otherProduct = new Product(array('name' => 'abc')); //then Assert::thatModel($product)->isEqualTo($otherProduct); }
/** * @test */ public function shouldTreatEmptyWhereClauseAsNothingWasGivenAsParameter() { // given Product::create(array('name' => 'one')); Product::create(array('name' => 'two')); // when $products = Product::where(new EmptyWhereClause())->fetchAll(); // then Assert::thatArray($products)->hasSize(2); }
/** * @test */ public function shouldNotReplaceWhenTableNameIsPartOfOtherTableName() { //given $onClauses = array(WhereClause::create('products.active = true'), WhereClause::create('order_products.active = true')); $joinClause = new JoinClause('products', 'id', 'product_id', 'order_products', 'p', 'LEFT', $onClauses); //when $buildJoinQueryPart = DialectUtil::buildJoinQueryPart($joinClause); //then Assert::thatString($buildJoinQueryPart)->isEqualTo('LEFT JOIN products AS p ON p.id = order_products.product_id AND p.active = true AND order_products.active = true'); }
/** * @test */ public function shouldAssociateRelationsWithAliasesByRelationNames() { //given $relation1 = new Relation('relation1', 'Test\\OrderProduct', 'id', 'id_product', false); $relation2 = new Relation('relation2', 'Test\\OrderProduct', 'id', 'id_product', false); //when $relationToAlias = ModelQueryBuilderHelper::associateRelationsWithAliases(array($relation1, $relation2), array('relation2' => 'r2')); //then Assert::thatArray($relationToAlias)->containsExactly(new RelationWithAlias($relation1, null), new RelationWithAlias($relation2, 'r2')); }
/** * @test */ public function shouldGenerateClassWithShortArrays() { //given $classStub = new ClassStub(true); //when $classStub->addColumn(new DatabaseColumn('field1', 'string'))->addColumn(new DatabaseColumn('field2', 'string')); //then Assert::thatString($classStub->contents())->contains("['field1', 'field2']")->contains('$attributes = []')->contains('parent::__construct([ {table_table}'); }
/** * @test */ public function shouldReturnTableInformation() { //given $generator = new Generator('products'); //when $dialectAdapter = $generator->dialectAdapter(); //then $this->assertEquals('id', $dialectAdapter->primaryKey()); Assert::thatArray($dialectAdapter->columns())->onProperty('name')->containsOnly('id', 'id_category', 'name', 'description', 'sale', 'id_manufacturer'); Assert::thatArray($dialectAdapter->columns())->onProperty('type')->contains('string', 'string', 'int', 'int'); }
/** * @test */ public function shouldCreateTicketModels() { //given $curl = Mock::create('\\Cerb\\CurlCaller'); Mock::when($curl)->call(Mock::anyArgList())->thenReturn(json_decode('{"__build":2015090201,"__status":"success","__version":"7.0.5","count":1,"page":1,"results":[{"_context":"cerberusweb.contexts.ticket","_label":"[#ACB-99934-772] second","closed_at":0,"created":1453283445,"elapsed_response_first":"0","elapsed_resolution_first":"0","id":2,"importance":50,"mask":"ACB-99934-772","num_messages":"1","org_id":0,"reopen_date":0,"spam_score":0.0001,"spam_training":"N","subject":"second","updated":1453283445,"status":"waiting","url":"http:\\/\\/localhost:8080\\/cerb-7.0.5\\/profiles\\/ticket\\/ACB-99934-772","group_id":1,"bucket_id":1,"initial_message_id":2,"initial_response_message_id":0,"latest_message_id":2,"owner_id":0,"group__context":"cerberusweb.contexts.group","bucket__context":"cerberusweb.contexts.bucket","initial_message__context":"cerberusweb.contexts.message","initial_message_sender__context":"cerberusweb.contexts.address","initial_message_sender_org__context":"cerberusweb.contexts.org","initial_message_worker__context":"cerberusweb.contexts.worker","initial_message_worker_address__context":"cerberusweb.contexts.address","initial_message_worker_address_org__context":"cerberusweb.contexts.org","initial_message_worker_calendar__context":"cerberusweb.contexts.calendar","initial_response_message__context":"cerberusweb.contexts.message","initial_response_message_sender__context":"cerberusweb.contexts.address","initial_response_message_sender_org__context":"cerberusweb.contexts.org","initial_response_message_worker__context":"cerberusweb.contexts.worker","initial_response_message_worker_address__context":"cerberusweb.contexts.address","initial_response_message_worker_address_org__context":"cerberusweb.contexts.org","initial_response_message_worker_calendar__context":"cerberusweb.contexts.calendar","latest_message__context":"cerberusweb.contexts.message","latest_message_sender__context":"cerberusweb.contexts.address","latest_message_sender_org__context":"cerberusweb.contexts.org","latest_message_worker__context":"cerberusweb.contexts.worker","latest_message_worker_address__context":"cerberusweb.contexts.address","latest_message_worker_address_org__context":"cerberusweb.contexts.org","latest_message_worker_calendar__context":"cerberusweb.contexts.calendar","owner__context":"cerberusweb.contexts.worker","owner_address__context":"cerberusweb.contexts.address","owner_calendar__context":"cerberusweb.contexts.calendar","org__context":"cerberusweb.contexts.org"}],"results_meta":{"labels":{"_label":"Ticket","num_messages":"Ticket # messages","bucket__label":"Ticket bucket","bucket_is_default":"Ticket bucket default","bucket_id":"Ticket bucket id","bucket_name":"Ticket bucket name","bucket_record_url":"Ticket bucket record url","bucket_updated_at":"Ticket bucket updated","created":"Ticket created","elapsed_resolution_first":"Ticket first resolution","elapsed_response_first":"Ticket first response","group__label":"Ticket group","group_created":"Ticket group created","group_is_default":"Ticket group default","group_id":"Ticket group id","group_name":"Ticket group name","group_is_private":"Ticket group private","group_record_url":"Ticket group record url","group_updated":"Ticket group updated","id":"Ticket id","custom_1":"Ticket identifier","importance":"Ticket importance","initial_message__label":"Ticket initial message","initial_message_content":"Ticket initial message content","initial_message_created":"Ticket initial message created","initial_message_headers":"Ticket initial message headers","initial_message_html_attachment_id":"Ticket initial message html attachment id","initial_message_id":"Ticket initial message id","initial_message_is_broadcast":"Ticket initial message is broadcast","initial_message_is_not_sent":"Ticket initial message is not sent","initial_message_is_outgoing":"Ticket initial message is outgoing","initial_message_record_url":"Ticket initial message record url","initial_message_response_time":"Ticket initial message response time","initial_message_sender__label":"Ticket initial message sender","initial_message_sender_num_nonspam":"Ticket initial message sender # nonspam","initial_message_sender_num_spam":"Ticket initial message sender # spam","initial_message_sender_address":"Ticket initial message sender address","initial_message_sender_first_name":"Ticket initial message sender first name","initial_message_sender_full_name":"Ticket initial message sender full name","initial_message_sender_id":"Ticket initial message sender id","initial_message_sender_is_banned":"Ticket initial message sender is banned","initial_message_sender_is_contact":"Ticket initial message sender is contact","initial_message_sender_is_defunct":"Ticket initial message sender is defunct","initial_message_sender_last_name":"Ticket initial message sender last name","initial_message_sender_org__label":"Ticket initial message sender org","initial_message_sender_org_city":"Ticket initial message sender org city","initial_message_sender_org_country":"Ticket initial message sender org country","initial_message_sender_org_created":"Ticket initial message sender org created","initial_message_sender_org_id":"Ticket initial message sender org id","initial_message_sender_org_name":"Ticket initial message sender org name","initial_message_sender_org_phone":"Ticket initial message sender org phone","initial_message_sender_org_postal":"Ticket initial message sender org postal","initial_message_sender_org_record_url":"Ticket initial message sender org record url","initial_message_sender_org_province":"Ticket initial message sender org state\\/prov","initial_message_sender_org_street":"Ticket initial message sender org street","initial_message_sender_org_updated":"Ticket initial message sender org updated","initial_message_sender_org_website":"Ticket initial message sender org website","initial_message_sender_record_url":"Ticket initial message sender record url","initial_message_sender_updated":"Ticket initial message sender updated","initial_message_worker__label":"Ticket initial message sender worker","initial_message_worker_is_superuser":"******","initial_message_worker_calendar__label":"Ticket initial message sender worker calendar","initial_message_worker_calendar_id":"Ticket initial message sender worker calendar id","initial_message_worker_calendar_name":"Ticket initial message sender worker calendar name","initial_message_worker_calendar_owner__label":"Ticket initial message sender worker calendar owner","initial_message_worker_calendar_record_url":"Ticket initial message sender worker calendar record url","initial_message_worker_calendar_updated_at":"Ticket initial message sender worker calendar updated","initial_message_worker_is_disabled":"Ticket initial message sender worker disabled","initial_message_worker_address__label":"Ticket initial message sender worker email","initial_message_worker_address_num_nonspam":"Ticket initial message sender worker email # nonspam","initial_message_worker_address_num_spam":"Ticket initial message sender worker email # spam","initial_message_worker_address_address":"Ticket initial message sender worker email address","initial_message_worker_address_first_name":"Ticket initial message sender worker email first name","initial_message_worker_address_full_name":"Ticket initial message sender worker email full name","initial_message_worker_address_id":"Ticket initial message sender worker email id","initial_message_worker_address_is_banned":"Ticket initial message sender worker email is banned","initial_message_worker_address_is_contact":"Ticket initial message sender worker email is contact","initial_message_worker_address_is_defunct":"Ticket initial message sender worker email is defunct","initial_message_worker_address_last_name":"Ticket initial message sender worker email last name","initial_message_worker_address_org__label":"Ticket initial message sender worker email org","initial_message_worker_address_org_city":"Ticket initial message sender worker email org city","initial_message_worker_address_org_country":"Ticket initial message sender worker email org country","initial_message_worker_address_org_created":"Ticket initial message sender worker email org created","initial_message_worker_address_org_id":"Ticket initial message sender worker email org id","initial_message_worker_address_org_name":"Ticket initial message sender worker email org name","initial_message_worker_address_org_phone":"Ticket initial message sender worker email org phone","initial_message_worker_address_org_postal":"Ticket initial message sender worker email org postal","initial_message_worker_address_org_record_url":"Ticket initial message sender worker email org record url","initial_message_worker_address_org_province":"Ticket initial message sender worker email org state\\/prov","initial_message_worker_address_org_street":"Ticket initial message sender worker email org street","initial_message_worker_address_org_updated":"Ticket initial message sender worker email org updated","initial_message_worker_address_org_website":"Ticket initial message sender worker email org website","initial_message_worker_address_record_url":"Ticket initial message sender worker email record url","initial_message_worker_address_updated":"Ticket initial message sender worker email updated","initial_message_worker_first_name":"Ticket initial message sender worker first name","initial_message_worker_full_name":"Ticket initial message sender worker full name","initial_message_worker_id":"Ticket initial message sender worker id","initial_message_worker_language":"Ticket initial message sender worker language","initial_message_worker_last_activity_date":"Ticket initial message sender worker last activity date","initial_message_worker_last_name":"Ticket initial message sender worker last name","initial_message_worker_record_url":"Ticket initial message sender worker record url","initial_message_worker_time_format":"Ticket initial message sender worker time format","initial_message_worker_timezone":"Ticket initial message sender worker timezone","initial_message_worker_title":"Ticket initial message sender worker title","initial_message_worker_updated":"Ticket initial message sender worker updated","initial_message_storage_size":"Ticket initial message size","initial_response_message__label":"Ticket initial response message","initial_response_message_content":"Ticket initial response message content","initial_response_message_created":"Ticket initial response message created","initial_response_message_headers":"Ticket initial response message headers","initial_response_message_html_attachment_id":"Ticket initial response message html attachment id","initial_response_message_id":"Ticket initial response message id","initial_response_message_is_broadcast":"Ticket initial response message is broadcast","initial_response_message_is_not_sent":"Ticket initial response message is not sent","initial_response_message_is_outgoing":"Ticket initial response message is outgoing","initial_response_message_record_url":"Ticket initial response message record url","initial_response_message_response_time":"Ticket initial response message response time","initial_response_message_sender__label":"Ticket initial response message sender","initial_response_message_sender_num_nonspam":"Ticket initial response message sender # nonspam","initial_response_message_sender_num_spam":"Ticket initial response message sender # spam","initial_response_message_sender_address":"Ticket initial response message sender address","initial_response_message_sender_first_name":"Ticket initial response message sender first name","initial_response_message_sender_full_name":"Ticket initial response message sender full name","initial_response_message_sender_id":"Ticket initial response message sender id","initial_response_message_sender_is_banned":"Ticket initial response message sender is banned","initial_response_message_sender_is_contact":"Ticket initial response message sender is contact","initial_response_message_sender_is_defunct":"Ticket initial response message sender is defunct","initial_response_message_sender_last_name":"Ticket initial response message sender last name","initial_response_message_sender_org__label":"Ticket initial response message sender org","initial_response_message_sender_org_city":"Ticket initial response message sender org city","initial_response_message_sender_org_country":"Ticket initial response message sender org country","initial_response_message_sender_org_created":"Ticket initial response message sender org created","initial_response_message_sender_org_id":"Ticket initial response message sender org id","initial_response_message_sender_org_name":"Ticket initial response message sender org name","initial_response_message_sender_org_phone":"Ticket initial response message sender org phone","initial_response_message_sender_org_postal":"Ticket initial response message sender org postal","initial_response_message_sender_org_record_url":"Ticket initial response message sender org record url","initial_response_message_sender_org_province":"Ticket initial response message sender org state\\/prov","initial_response_message_sender_org_street":"Ticket initial response message sender org street","initial_response_message_sender_org_updated":"Ticket initial response message sender org updated","initial_response_message_sender_org_website":"Ticket initial response message sender org website","initial_response_message_sender_record_url":"Ticket initial response message sender record url","initial_response_message_sender_updated":"Ticket initial response message sender updated","initial_response_message_worker__label":"Ticket initial response message sender worker","initial_response_message_worker_is_superuser":"******","initial_response_message_worker_calendar__label":"Ticket initial response message sender worker calendar","initial_response_message_worker_calendar_id":"Ticket initial response message sender worker calendar id","initial_response_message_worker_calendar_name":"Ticket initial response message sender worker calendar name","initial_response_message_worker_calendar_owner__label":"Ticket initial response message sender worker calendar owner","initial_response_message_worker_calendar_record_url":"Ticket initial response message sender worker calendar record url","initial_response_message_worker_calendar_updated_at":"Ticket initial response message sender worker calendar updated","initial_response_message_worker_is_disabled":"Ticket initial response message sender worker disabled","initial_response_message_worker_address__label":"Ticket initial response message sender worker email","initial_response_message_worker_address_num_nonspam":"Ticket initial response message sender worker email # nonspam","initial_response_message_worker_address_num_spam":"Ticket initial response message sender worker email # spam","initial_response_message_worker_address_address":"Ticket initial response message sender worker email address","initial_response_message_worker_address_first_name":"Ticket initial response message sender worker email first name","initial_response_message_worker_address_full_name":"Ticket initial response message sender worker email full name","initial_response_message_worker_address_id":"Ticket initial response message sender worker email id","initial_response_message_worker_address_is_banned":"Ticket initial response message sender worker email is banned","initial_response_message_worker_address_is_contact":"Ticket initial response message sender worker email is contact","initial_response_message_worker_address_is_defunct":"Ticket initial response message sender worker email is defunct","initial_response_message_worker_address_last_name":"Ticket initial response message sender worker email last name","initial_response_message_worker_address_org__label":"Ticket initial response message sender worker email org","initial_response_message_worker_address_org_city":"Ticket initial response message sender worker email org city","initial_response_message_worker_address_org_country":"Ticket initial response message sender worker email org country","initial_response_message_worker_address_org_created":"Ticket initial response message sender worker email org created","initial_response_message_worker_address_org_id":"Ticket initial response message sender worker email org id","initial_response_message_worker_address_org_name":"Ticket initial response message sender worker email org name","initial_response_message_worker_address_org_phone":"Ticket initial response message sender worker email org phone","initial_response_message_worker_address_org_postal":"Ticket initial response message sender worker email org postal","initial_response_message_worker_address_org_record_url":"Ticket initial response message sender worker email org record url","initial_response_message_worker_address_org_province":"Ticket initial response message sender worker email org state\\/prov","initial_response_message_worker_address_org_street":"Ticket initial response message sender worker email org street","initial_response_message_worker_address_org_updated":"Ticket initial response message sender worker email org updated","initial_response_message_worker_address_org_website":"Ticket initial response message sender worker email org website","initial_response_message_worker_address_record_url":"Ticket initial response message sender worker email record url","initial_response_message_worker_address_updated":"Ticket initial response message sender worker email updated","initial_response_message_worker_first_name":"Ticket initial response message sender worker first name","initial_response_message_worker_full_name":"Ticket initial response message sender worker full name","initial_response_message_worker_id":"Ticket initial response message sender worker id","initial_response_message_worker_language":"Ticket initial response message sender worker language","initial_response_message_worker_last_activity_date":"Ticket initial response message sender worker last activity date","initial_response_message_worker_last_name":"Ticket initial response message sender worker last name","initial_response_message_worker_record_url":"Ticket initial response message sender worker record url","initial_response_message_worker_time_format":"Ticket initial response message sender worker time format","initial_response_message_worker_timezone":"Ticket initial response message sender worker timezone","initial_response_message_worker_title":"Ticket initial response message sender worker title","initial_response_message_worker_updated":"Ticket initial response message sender worker updated","initial_response_message_storage_size":"Ticket initial response message size","latest_message__label":"Ticket latest message","latest_message_content":"Ticket latest message content","latest_message_created":"Ticket latest message created","latest_message_headers":"Ticket latest message headers","latest_message_html_attachment_id":"Ticket latest message html attachment id","latest_message_id":"Ticket latest message id","latest_message_is_broadcast":"Ticket latest message is broadcast","latest_message_is_not_sent":"Ticket latest message is not sent","latest_message_is_outgoing":"Ticket latest message is outgoing","latest_message_record_url":"Ticket latest message record url","latest_message_response_time":"Ticket latest message response time","latest_message_sender__label":"Ticket latest message sender","latest_message_sender_num_nonspam":"Ticket latest message sender # nonspam","latest_message_sender_num_spam":"Ticket latest message sender # spam","latest_message_sender_address":"Ticket latest message sender address","latest_message_sender_first_name":"Ticket latest message sender first name","latest_message_sender_full_name":"Ticket latest message sender full name","latest_message_sender_id":"Ticket latest message sender id","latest_message_sender_is_banned":"Ticket latest message sender is banned","latest_message_sender_is_contact":"Ticket latest message sender is contact","latest_message_sender_is_defunct":"Ticket latest message sender is defunct","latest_message_sender_last_name":"Ticket latest message sender last name","latest_message_sender_org__label":"Ticket latest message sender org","latest_message_sender_org_city":"Ticket latest message sender org city","latest_message_sender_org_country":"Ticket latest message sender org country","latest_message_sender_org_created":"Ticket latest message sender org created","latest_message_sender_org_id":"Ticket latest message sender org id","latest_message_sender_org_name":"Ticket latest message sender org name","latest_message_sender_org_phone":"Ticket latest message sender org phone","latest_message_sender_org_postal":"Ticket latest message sender org postal","latest_message_sender_org_record_url":"Ticket latest message sender org record url","latest_message_sender_org_province":"Ticket latest message sender org state\\/prov","latest_message_sender_org_street":"Ticket latest message sender org street","latest_message_sender_org_updated":"Ticket latest message sender org updated","latest_message_sender_org_website":"Ticket latest message sender org website","latest_message_sender_record_url":"Ticket latest message sender record url","latest_message_sender_updated":"Ticket latest message sender updated","latest_message_worker__label":"Ticket latest message sender worker","latest_message_worker_is_superuser":"******","latest_message_worker_calendar__label":"Ticket latest message sender worker calendar","latest_message_worker_calendar_id":"Ticket latest message sender worker calendar id","latest_message_worker_calendar_name":"Ticket latest message sender worker calendar name","latest_message_worker_calendar_owner__label":"Ticket latest message sender worker calendar owner","latest_message_worker_calendar_record_url":"Ticket latest message sender worker calendar record url","latest_message_worker_calendar_updated_at":"Ticket latest message sender worker calendar updated","latest_message_worker_is_disabled":"Ticket latest message sender worker disabled","latest_message_worker_address__label":"Ticket latest message sender worker email","latest_message_worker_address_num_nonspam":"Ticket latest message sender worker email # nonspam","latest_message_worker_address_num_spam":"Ticket latest message sender worker email # spam","latest_message_worker_address_address":"Ticket latest message sender worker email address","latest_message_worker_address_first_name":"Ticket latest message sender worker email first name","latest_message_worker_address_full_name":"Ticket latest message sender worker email full name","latest_message_worker_address_id":"Ticket latest message sender worker email id","latest_message_worker_address_is_banned":"Ticket latest message sender worker email is banned","latest_message_worker_address_is_contact":"Ticket latest message sender worker email is contact","latest_message_worker_address_is_defunct":"Ticket latest message sender worker email is defunct","latest_message_worker_address_last_name":"Ticket latest message sender worker email last name","latest_message_worker_address_org__label":"Ticket latest message sender worker email org","latest_message_worker_address_org_city":"Ticket latest message sender worker email org city","latest_message_worker_address_org_country":"Ticket latest message sender worker email org country","latest_message_worker_address_org_created":"Ticket latest message sender worker email org created","latest_message_worker_address_org_id":"Ticket latest message sender worker email org id","latest_message_worker_address_org_name":"Ticket latest message sender worker email org name","latest_message_worker_address_org_phone":"Ticket latest message sender worker email org phone","latest_message_worker_address_org_postal":"Ticket latest message sender worker email org postal","latest_message_worker_address_org_record_url":"Ticket latest message sender worker email org record url","latest_message_worker_address_org_province":"Ticket latest message sender worker email org state\\/prov","latest_message_worker_address_org_street":"Ticket latest message sender worker email org street","latest_message_worker_address_org_updated":"Ticket latest message sender worker email org updated","latest_message_worker_address_org_website":"Ticket latest message sender worker email org website","latest_message_worker_address_record_url":"Ticket latest message sender worker email record url","latest_message_worker_address_updated":"Ticket latest message sender worker email updated","latest_message_worker_first_name":"Ticket latest message sender worker first name","latest_message_worker_full_name":"Ticket latest message sender worker full name","latest_message_worker_id":"Ticket latest message sender worker id","latest_message_worker_language":"Ticket latest message sender worker language","latest_message_worker_last_activity_date":"Ticket latest message sender worker last activity date","latest_message_worker_last_name":"Ticket latest message sender worker last name","latest_message_worker_record_url":"Ticket latest message sender worker record url","latest_message_worker_time_format":"Ticket latest message sender worker time format","latest_message_worker_timezone":"Ticket latest message sender worker timezone","latest_message_worker_title":"Ticket latest message sender worker title","latest_message_worker_updated":"Ticket latest message sender worker updated","latest_message_storage_size":"Ticket latest message size","mask":"Ticket mask","org__label":"Ticket org","org_city":"Ticket org city","org_country":"Ticket org country","org_created":"Ticket org created","org_id":"Ticket org id","org_name":"Ticket org name","org_phone":"Ticket org phone","org_postal":"Ticket org postal","org_record_url":"Ticket org record url","org_province":"Ticket org state\\/prov","org_street":"Ticket org street","org_updated":"Ticket org updated","org_website":"Ticket org website","owner__label":"Ticket owner","owner_is_superuser":"******","owner_calendar__label":"Ticket owner calendar","owner_calendar_id":"Ticket owner calendar id","owner_calendar_name":"Ticket owner calendar name","owner_calendar_owner__label":"Ticket owner calendar owner","owner_calendar_record_url":"Ticket owner calendar record url","owner_calendar_updated_at":"Ticket owner calendar updated","owner_is_disabled":"Ticket owner disabled","owner_address__label":"Ticket owner email","owner_address_num_nonspam":"Ticket owner email # nonspam","owner_address_num_spam":"Ticket owner email # spam","owner_address_address":"Ticket owner email address","owner_address_id":"Ticket owner email id","owner_address_is_banned":"Ticket owner email is banned","owner_address_is_contact":"Ticket owner email is contact","owner_address_is_defunct":"Ticket owner email is defunct","owner_address_record_url":"Ticket owner email record url","owner_address_updated":"Ticket owner email updated","owner_first_name":"Ticket owner first name","owner_full_name":"Ticket owner full name","owner_id":"Ticket owner id","owner_language":"Ticket owner language","owner_last_activity_date":"Ticket owner last activity date","owner_last_name":"Ticket owner last name","owner_record_url":"Ticket owner record url","owner_time_format":"Ticket owner time format","owner_timezone":"Ticket owner timezone","owner_title":"Ticket owner title","owner_updated":"Ticket owner updated","reopen_date":"Ticket reopen at","spam_score":"Ticket spam score","spam_training":"Ticket spam training","status":"Ticket status","subject":"Ticket subject","updated":"Ticket updated","url":"Ticket url"},"types":{"_label":"context_url","created":"E","elapsed_response_first":"time_secs","elapsed_resolution_first":"time_secs","id":"id","importance":"N","mask":"S","num_messages":"N","reopen_date":"E","spam_score":"percent","spam_training":null,"status":"","subject":"S","updated":"E","url":"U","custom_1":"S","group__label":"context_url","group_created":"E","group_id":"N","group_is_default":"C","group_is_private":"C","group_name":"S","group_updated":"E","group_record_url":"U","group_reply_address_id":"N","bucket__label":"context_url","bucket_id":"N","bucket_is_default":"C","bucket_name":"S","bucket_updated_at":"E","bucket_record_url":"U","initial_message__label":"context_url","initial_message_html_attachment_id":"N","initial_message_id":"N","initial_message_content":"T","initial_message_created":"E","initial_message_is_broadcast":"C","initial_message_is_not_sent":"C","initial_message_is_outgoing":"C","initial_message_response_time":"time_secs","initial_message_storage_size":"size_bytes","initial_message_record_url":"U","initial_message_headers":null,"initial_message_sender__label":"context_url","initial_message_sender_id":"N","initial_message_sender_address":"S","initial_message_sender_first_name":"S","initial_message_sender_full_name":"S","initial_message_sender_last_name":"S","initial_message_sender_num_spam":"N","initial_message_sender_num_nonspam":"N","initial_message_sender_is_banned":"C","initial_message_sender_is_contact":"C","initial_message_sender_is_defunct":"C","initial_message_sender_updated":"E","initial_message_sender_record_url":"U","initial_message_sender_org__label":"context_url","initial_message_sender_org_id":"N","initial_message_sender_org_name":"S","initial_message_sender_org_city":"S","initial_message_sender_org_country":"S","initial_message_sender_org_created":"E","initial_message_sender_org_phone":"phone","initial_message_sender_org_postal":"S","initial_message_sender_org_province":"S","initial_message_sender_org_street":"S","initial_message_sender_org_updated":"E","initial_message_sender_org_website":"U","initial_message_sender_org_record_url":"U","initial_message_worker__label":"context_url","initial_message_worker_first_name":"S","initial_message_worker_full_name":"S","initial_message_worker_id":"N","initial_message_worker_is_disabled":"C","initial_message_worker_is_superuser":"******","initial_message_worker_language":"S","initial_message_worker_last_name":"S","initial_message_worker_last_activity_date":"E","initial_message_worker_time_format":"S","initial_message_worker_timezone":"S","initial_message_worker_title":"S","initial_message_worker_updated":"E","initial_message_worker_record_url":"U","initial_message_worker_address__label":"context_url","initial_message_worker_address_id":"N","initial_message_worker_address_address":"S","initial_message_worker_address_first_name":"S","initial_message_worker_address_full_name":"S","initial_message_worker_address_last_name":"S","initial_message_worker_address_num_spam":"N","initial_message_worker_address_num_nonspam":"N","initial_message_worker_address_is_banned":"C","initial_message_worker_address_is_contact":"C","initial_message_worker_address_is_defunct":"C","initial_message_worker_address_updated":"E","initial_message_worker_address_record_url":"U","initial_message_worker_address_org__label":"context_url","initial_message_worker_address_org_id":"N","initial_message_worker_address_org_name":"S","initial_message_worker_address_org_city":"S","initial_message_worker_address_org_country":"S","initial_message_worker_address_org_created":"E","initial_message_worker_address_org_phone":"phone","initial_message_worker_address_org_postal":"S","initial_message_worker_address_org_province":"S","initial_message_worker_address_org_street":"S","initial_message_worker_address_org_updated":"E","initial_message_worker_address_org_website":"U","initial_message_worker_address_org_record_url":"U","initial_message_worker_calendar__label":"context_url","initial_message_worker_calendar_id":"N","initial_message_worker_calendar_name":"S","initial_message_worker_calendar_owner__label":"context_url","initial_message_worker_calendar_updated_at":"E","initial_message_worker_calendar_record_url":"U","initial_response_message__label":"context_url","initial_response_message_html_attachment_id":"N","initial_response_message_id":"N","initial_response_message_content":"T","initial_response_message_created":"E","initial_response_message_is_broadcast":"C","initial_response_message_is_not_sent":"C","initial_response_message_is_outgoing":"C","initial_response_message_response_time":"time_secs","initial_response_message_storage_size":"size_bytes","initial_response_message_record_url":"U","initial_response_message_headers":null,"initial_response_message_sender__label":"context_url","initial_response_message_sender_id":"N","initial_response_message_sender_address":"S","initial_response_message_sender_first_name":"S","initial_response_message_sender_full_name":"S","initial_response_message_sender_last_name":"S","initial_response_message_sender_num_spam":"N","initial_response_message_sender_num_nonspam":"N","initial_response_message_sender_is_banned":"C","initial_response_message_sender_is_contact":"C","initial_response_message_sender_is_defunct":"C","initial_response_message_sender_updated":"E","initial_response_message_sender_record_url":"U","initial_response_message_sender_org__label":"context_url","initial_response_message_sender_org_id":"N","initial_response_message_sender_org_name":"S","initial_response_message_sender_org_city":"S","initial_response_message_sender_org_country":"S","initial_response_message_sender_org_created":"E","initial_response_message_sender_org_phone":"phone","initial_response_message_sender_org_postal":"S","initial_response_message_sender_org_province":"S","initial_response_message_sender_org_street":"S","initial_response_message_sender_org_updated":"E","initial_response_message_sender_org_website":"U","initial_response_message_sender_org_record_url":"U","initial_response_message_worker__label":"context_url","initial_response_message_worker_first_name":"S","initial_response_message_worker_full_name":"S","initial_response_message_worker_id":"N","initial_response_message_worker_is_disabled":"C","initial_response_message_worker_is_superuser":"******","initial_response_message_worker_language":"S","initial_response_message_worker_last_name":"S","initial_response_message_worker_last_activity_date":"E","initial_response_message_worker_time_format":"S","initial_response_message_worker_timezone":"S","initial_response_message_worker_title":"S","initial_response_message_worker_updated":"E","initial_response_message_worker_record_url":"U","initial_response_message_worker_address__label":"context_url","initial_response_message_worker_address_id":"N","initial_response_message_worker_address_address":"S","initial_response_message_worker_address_first_name":"S","initial_response_message_worker_address_full_name":"S","initial_response_message_worker_address_last_name":"S","initial_response_message_worker_address_num_spam":"N","initial_response_message_worker_address_num_nonspam":"N","initial_response_message_worker_address_is_banned":"C","initial_response_message_worker_address_is_contact":"C","initial_response_message_worker_address_is_defunct":"C","initial_response_message_worker_address_updated":"E","initial_response_message_worker_address_record_url":"U","initial_response_message_worker_address_org__label":"context_url","initial_response_message_worker_address_org_id":"N","initial_response_message_worker_address_org_name":"S","initial_response_message_worker_address_org_city":"S","initial_response_message_worker_address_org_country":"S","initial_response_message_worker_address_org_created":"E","initial_response_message_worker_address_org_phone":"phone","initial_response_message_worker_address_org_postal":"S","initial_response_message_worker_address_org_province":"S","initial_response_message_worker_address_org_street":"S","initial_response_message_worker_address_org_updated":"E","initial_response_message_worker_address_org_website":"U","initial_response_message_worker_address_org_record_url":"U","initial_response_message_worker_calendar__label":"context_url","initial_response_message_worker_calendar_id":"N","initial_response_message_worker_calendar_name":"S","initial_response_message_worker_calendar_owner__label":"context_url","initial_response_message_worker_calendar_updated_at":"E","initial_response_message_worker_calendar_record_url":"U","latest_message__label":"context_url","latest_message_html_attachment_id":"N","latest_message_id":"N","latest_message_content":"T","latest_message_created":"E","latest_message_is_broadcast":"C","latest_message_is_not_sent":"C","latest_message_is_outgoing":"C","latest_message_response_time":"time_secs","latest_message_storage_size":"size_bytes","latest_message_record_url":"U","latest_message_headers":null,"latest_message_sender__label":"context_url","latest_message_sender_id":"N","latest_message_sender_address":"S","latest_message_sender_first_name":"S","latest_message_sender_full_name":"S","latest_message_sender_last_name":"S","latest_message_sender_num_spam":"N","latest_message_sender_num_nonspam":"N","latest_message_sender_is_banned":"C","latest_message_sender_is_contact":"C","latest_message_sender_is_defunct":"C","latest_message_sender_updated":"E","latest_message_sender_record_url":"U","latest_message_sender_org__label":"context_url","latest_message_sender_org_id":"N","latest_message_sender_org_name":"S","latest_message_sender_org_city":"S","latest_message_sender_org_country":"S","latest_message_sender_org_created":"E","latest_message_sender_org_phone":"phone","latest_message_sender_org_postal":"S","latest_message_sender_org_province":"S","latest_message_sender_org_street":"S","latest_message_sender_org_updated":"E","latest_message_sender_org_website":"U","latest_message_sender_org_record_url":"U","latest_message_worker__label":"context_url","latest_message_worker_first_name":"S","latest_message_worker_full_name":"S","latest_message_worker_id":"N","latest_message_worker_is_disabled":"C","latest_message_worker_is_superuser":"******","latest_message_worker_language":"S","latest_message_worker_last_name":"S","latest_message_worker_last_activity_date":"E","latest_message_worker_time_format":"S","latest_message_worker_timezone":"S","latest_message_worker_title":"S","latest_message_worker_updated":"E","latest_message_worker_record_url":"U","latest_message_worker_address__label":"context_url","latest_message_worker_address_id":"N","latest_message_worker_address_address":"S","latest_message_worker_address_first_name":"S","latest_message_worker_address_full_name":"S","latest_message_worker_address_last_name":"S","latest_message_worker_address_num_spam":"N","latest_message_worker_address_num_nonspam":"N","latest_message_worker_address_is_banned":"C","latest_message_worker_address_is_contact":"C","latest_message_worker_address_is_defunct":"C","latest_message_worker_address_updated":"E","latest_message_worker_address_record_url":"U","latest_message_worker_address_org__label":"context_url","latest_message_worker_address_org_id":"N","latest_message_worker_address_org_name":"S","latest_message_worker_address_org_city":"S","latest_message_worker_address_org_country":"S","latest_message_worker_address_org_created":"E","latest_message_worker_address_org_phone":"phone","latest_message_worker_address_org_postal":"S","latest_message_worker_address_org_province":"S","latest_message_worker_address_org_street":"S","latest_message_worker_address_org_updated":"E","latest_message_worker_address_org_website":"U","latest_message_worker_address_org_record_url":"U","latest_message_worker_calendar__label":"context_url","latest_message_worker_calendar_id":"N","latest_message_worker_calendar_name":"S","latest_message_worker_calendar_owner__label":"context_url","latest_message_worker_calendar_updated_at":"E","latest_message_worker_calendar_record_url":"U","owner__label":"context_url","owner_first_name":"S","owner_full_name":"S","owner_id":"N","owner_is_disabled":"C","owner_is_superuser":"******","owner_language":"S","owner_last_name":"S","owner_last_activity_date":"E","owner_time_format":"S","owner_timezone":"S","owner_title":"S","owner_updated":"E","owner_record_url":"U","owner_address__label":"context_url","owner_address_id":"N","owner_address_address":"S","owner_address_first_name":"S","owner_address_full_name":"S","owner_address_last_name":"S","owner_address_num_spam":"N","owner_address_num_nonspam":"N","owner_address_is_banned":"C","owner_address_is_contact":"C","owner_address_is_defunct":"C","owner_address_updated":"E","owner_address_record_url":"U","owner_address_org__label":"context_url","owner_address_org_id":"N","owner_address_org_name":"S","owner_address_org_city":"S","owner_address_org_country":"S","owner_address_org_created":"E","owner_address_org_phone":"phone","owner_address_org_postal":"S","owner_address_org_province":"S","owner_address_org_street":"S","owner_address_org_updated":"E","owner_address_org_website":"U","owner_address_org_record_url":"U","owner_calendar__label":"context_url","owner_calendar_id":"N","owner_calendar_name":"S","owner_calendar_owner__label":"context_url","owner_calendar_updated_at":"E","owner_calendar_record_url":"U","org__label":"context_url","org_id":"N","org_name":"S","org_city":"S","org_country":"S","org_created":"E","org_phone":"phone","org_postal":"S","org_province":"S","org_street":"S","org_updated":"E","org_website":"U","org_record_url":"U"}},"total":1}')); $client = new Client('', '', '', $curl); //when $tickets = $client->getTickets([['q', 'identifier:1557751']]); //then $this->assertEquals(1, $tickets->getTotal()); Assert::thatArray($tickets->getResults())->onProperty('mask')->containsExactly('ACB-99934-772'); }
/** * @test */ public function shouldReturnFieldsWithPrimaryKeyWhenIsDefault() { //given /** @var Dialect $dialect */ $dialect = Mock::mock('Ouzo\\Tools\\Model\\Template\\Dialect\\Dialect'); Mock::when($dialect)->primaryKey()->thenReturn('id'); Mock::when($dialect)->columns()->thenReturn(array(new DatabaseColumn('sale', 'text'), new DatabaseColumn('description', 'text'), new DatabaseColumn('id', 'int'))); $tableInfo = new TableInfo($dialect); //when $columns = $tableInfo->tableColumns; //then Assert::thatArray($columns)->onProperty('name')->containsOnly('sale', 'description', 'id'); }
/** * @test */ public function shouldAddEmptyPrimaryKeyEntryWhenNoFoundPrimaryKeyInTable() { //given /** @var Dialect $dialect */ $dialect = Mock::mock('Ouzo\\Tools\\Model\\Template\\Dialect\\Dialect'); Mock::when($dialect)->primaryKey()->thenReturn(''); Mock::when($dialect)->columns()->thenReturn(array()); $classStubReplacer = new ClassStubPlaceholderReplacer('Customer', new TableInfo($dialect)); //when $classContents = $classStubReplacer->contents(); //then Assert::thatString($classContents)->isNotEqualTo('')->contains('primaryKey'); }
/** * @test */ public function shouldGenerateDOMElementsForMessage() { //given $nodes = [new Node('int', '$age', false), new Node('object', '$user', false, [new Node('string', '$name', false)]), new Node('string', '$numbers', true)]; //when $DOMElements = $this->XMLDocumentStyle->generateMessagePart($this->DOMDocument, $nodes); //then Assert::thatArray($DOMElements)->extracting('tagName')->containsExactly('part', 'part', 'part'); $this->assertEquals('age', $DOMElements[0]->getAttribute('name')); $this->assertEquals('ns:age', $DOMElements[0]->getAttribute('element')); $this->assertEquals('user', $DOMElements[1]->getAttribute('name')); $this->assertEquals('ns:user', $DOMElements[1]->getAttribute('element')); $this->assertEquals('numbers', $DOMElements[2]->getAttribute('name')); $this->assertEquals('ns:numbers', $DOMElements[2]->getAttribute('element')); }
/** * @test */ public function shouldGetArrayOfAllHeaders() { //given $_SERVER['HTTP_ACCEPT'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'; $_SERVER['HTTP_ACCEPT_CHARSET'] = 'UTF-8,*;q=0.5'; $_SERVER['HTTP_ACCEPT_ENCODING'] = 'gzip,deflate,sdch'; $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en-US,en;q=0.8'; $_SERVER['HTTP_CACHE_CONTROL'] = 'max-age=0'; $_SERVER['HTTP_CONNECTION'] = 'keep-alive'; $_SERVER['HTTP_COOKIE'] = '__utmz=179618234.1309856897.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=179618234.703966342.1309856897.1309856897.1309856897.1'; $_SERVER['HTTP_HOST'] = 'www.yoursite.com'; $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.30 (KHTML, like Gecko) Ubuntu/11.04 Chromium/12.0.742.112 Chrome/12.0.742.112 Safari/534.30'; //when $all = RequestHeaders::all(); //then Assert::thatArray($all)->hasSize(9)->containsKeyAndValue(array('Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Charset' => 'UTF-8,*;q=0.5', 'Accept-Encoding' => 'gzip,deflate,sdch', 'Accept-Language' => 'en-US,en;q=0.8', 'Cache-Control' => 'max-age=0', 'Connection' => 'keep-alive', 'Cookie' => '__utmz=179618234.1309856897.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=179618234.703966342.1309856897.1309856897.1309856897.1', 'Host' => 'www.yoursite.com', 'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.30 (KHTML, like Gecko) Ubuntu/11.04 Chromium/12.0.742.112 Chrome/12.0.742.112 Safari/534.30')); }
/** * @test */ public function shouldGetHitsOnlyForPlayersInCurrentGame() { //given $user = User::create(['login' => 'test', 'password' => 'a']); $game1 = Game::create(); $game1->addPlayer($user->getId()); /** @var GameUser $gameUser1 */ $gameUser1 = Arrays::first($game1->game_users); $game2 = Game::create(); $game2->addPlayer($user->getId()); /** @var GameUser $gameUser2 */ $gameUser2 = Arrays::first($game2->game_users); Hit::createFor('4d', $gameUser1); Hit::createFor('15t', $gameUser2); //when $hits = Hit::findForGame($game1); //then Assert::thatArray($hits)->onProperty('field')->containsExactly('4'); }
/** * @test */ public function shouldIgnoreDebugMessageIfDebugIsOff() { //given Config::overrideProperty('debug')->with(false); //when $this->logger->debug('My debug log line without params.'); //then $logContent = $this->_readStreamContent('test://stdout'); Assert::thatString($logContent)->hasSize(0); }
/** * @test */ public function shouldSetRelationship() { //given $account = new Account(); $account->name = 'New Company'; $account->insert(); $contact = new Contact(); $contact->first_name = 'John'; $contact->last_name = 'Doe'; $contact->insert(); //when $account->relatedWith($contact); //then $search = Account::findById($account->id); Assert::thatArray($search->contacts)->hasSize(1); }
/** * @test */ public function shouldFindRouteRuleDelete() { //given Route::delete('/user/:id/delete', 'user#delete'); $router = $this->_createRouter('DELETE', '/user/12/delete'); //when $rule = $router->findRoute(); //then $this->assertEquals('/user/:id/delete', $rule->getUri()); $this->assertEquals('DELETE', $rule->getMethod()); $this->assertEquals('user', $rule->getController()); $this->assertEquals('delete', $rule->getAction()); Assert::thatArray($rule->getParameters())->hasSize(1)->containsKeyAndValue(array('id' => 12)); }
/** * @test */ public function shouldCheckIsStringIsNotEmpty() { Assert::thatString('Lady Stoneheart')->isNotEmpty(); }
/** * @test */ public function shouldParseObjectWithArrayOfWrapper() { //given $parameter = ParameterFactory::createParameterObjectWithArrayOfWrapper(); //when $types = $this->_rpcEncoded->typeParameters($parameter); //then $type = $types[0]; $this->assertEquals('ListOfAgents', $type->getName()); $this->assertEquals(array(array('type' => 'type', 'value' => 'ns:ArrayOfAgents', 'name' => 'agents'), array('type' => 'type', 'value' => 'xsd:int', 'name' => 'id')), $type->getElementAttributes()); $actualComplex = $type->getComplex(); Assert::thatArray($actualComplex)->onMethod('getName')->containsExactly('ArrayOfAgents'); Assert::thatArray($actualComplex)->onMethod('getArrayType')->containsExactly('ns:MocksMockUserWrapper[]'); $this->assertEquals('MocksMockUserWrapper', $actualComplex[0]->getComplex()->getName()); $this->assertEquals(array(array('type' => 'type', 'value' => 'xsd:int', 'name' => 'id'), array('type' => 'type', 'value' => 'xsd:string', 'name' => 'name'), array('type' => 'type', 'value' => 'xsd:int', 'name' => 'age')), $actualComplex[0]->getComplex()->getElementAttributes()); }
private function _assertNot() { $args = func_get_args(); $method = array_shift($args); $array = array_shift($args); call_user_func_array(array(CatchException::when(Assert::thatArray($array)), $method), $args); CatchException::assertThat()->isInstanceOf('PHPUnit_Framework_ExpectationFailedException'); }
public function assertHasCookie($cookieAttributes) { $actual = $this->frontController->getCookiesSetter()->getCookies(); Assert::thatArray($actual)->contains($cookieAttributes); }