Пример #1
0
 public function testNestedView()
 {
     $c = new Category();
     $c->create(array('name' => 'Foo'));
     $action = new CreateProduct();
     $view = $action->asView('ActionKit\\View\\StackView', array('no_form' => true, 'no_layout' => true));
     $this->assertNotNull($view);
     $view->buildRelationalActionViewForExistingRecords('categories');
     $html = $view->getContainer()->render();
     ok($html);
     #          $dom = new DOMDocument;
     #          $dom->load($html);
     $c->delete();
 }
Пример #2
0
 public function testCreateSubActionWithRelationshipForSubRecordCreate()
 {
     $tmpfile = tempnam('/tmp', 'test_image_');
     copy('tests/data/404.png', $tmpfile);
     $files = ['images' => CreateFilesArrayWithAssociateKey(['a' => ['image' => CreateFileArray('404.png', 'image/png', $tmpfile)], 'b' => ['image' => CreateFileArray('404.png', 'image/png', $tmpfile)]])];
     $args = ['name' => 'Test Product', 'images' => ['a' => [], 'b' => []]];
     $request = new ActionRequest($args, $files);
     $createProduct = new CreateProduct($args, ['request' => $request]);
     $relation = clone $createProduct->getRelation('images');
     $relation['create_action'] = 'ProductBundle\\Action\\CreateProductImage';
     $createProduct->addRelation('images', $relation);
     $this->assertActionInvokeSuccess($createProduct);
 }