/** * example [null,null] */ public function testRemovedLinkListRelation() { // create relations $price1 = $this->testCreatePrice(); $price2 = $this->testCreatePrice(); //simulate form input $post = ['oOrganization' => ['role' => 'buyer', 'Country' => '643', 'OrganizationName' => 'Sender organization full name', 'ShortName' => 'Sender organization', 'Phone' => '+7988878787', 'Email' => '*****@*****.**', 'Skype' => 'org_test', 'Site' => 'www.testSender.te', 'INN' => '252525454545', 'CreateDate' => date('Y-m-d')]]; $organization = new oOrganization(); // $services = [$price1, $price1]; // $organization->services = $services; $organization->link('services', $price1); $organization->link('services', $price2); $this->assertTrue($organization->load($post), 'Load organization POST data'); $this->assertTrue($organization->validate(), 'Validate organization'); $this->assertTrue($organization->save(), 'Create organization'); $organizationFind = oOrganization::find()->where(['@rid' => $organization['@rid']])->with(['services'])->one(); $this->assertTrue($organizationFind->role == 'buyer', 'Check organization role'); $this->assertTrue($organizationFind->services[0]->QuantityMeasure == '796', 'Check link list relation services[0]->Name'); $organizationFind->services[0]->delete(); $organizationFind2 = oOrganization::find()->where(['@rid' => $organizationFind['@rid']])->with(['services'])->one(); $this->assertTrue(count($organizationFind2->services) == 1, 'Check link list count after save == 1'); return $organizationFind2; }