예제 #1
0
 public function setUp()
 {
     parent::setUp();
     $this->initModels([new User(), new Group(), new Membership(), new Customer()]);
     $group = new Group();
     $group->name = 'Administrators';
     $group->save();
     $group_prog = new Group();
     $group_prog->name = 'Programmers';
     $group_prog->save();
     $anton = new User();
     $anton->username = '******';
     $anton->password = '******';
     $anton->save();
     $group_prog->users->link($anton);
     $anton_home = new Customer();
     $anton_home->address = "Anton home";
     $anton_home->user = $anton;
     $anton_home->save();
     $anton_work = new Customer();
     $anton_work->address = "Anton work";
     $anton_work->user = $anton;
     $anton_work->save();
     $max = new User();
     $max->username = '******';
     $max->password = '******';
     $max->save();
     $group->users->link($max);
     $max_home = new Customer();
     $max_home->address = "Max home";
     $max_home->user = $max;
     $max_home->save();
 }
예제 #2
0
 public function setUp()
 {
     parent::setUp();
     foreach (range(0, 11) as $i) {
         (new Category(['name' => 'foo' . $i]))->save();
     }
 }
예제 #3
0
 public function setUp()
 {
     parent::setUp();
     $this->basePath = realpath(__DIR__ . '/../../protected');
     $group = new Group();
     $group->name = 'Administrators';
     $group->save();
     $group_prog = new Group();
     $group_prog->name = 'Programmers';
     $group_prog->save();
     $anton = new User();
     $anton->username = '******';
     $anton->password = '******';
     $anton->save();
     $group_prog->users->link($anton);
     $anton_home = new Customer();
     $anton_home->address = "Anton home";
     $anton_home->user = $anton;
     $anton_home->save();
     $anton_work = new Customer();
     $anton_work->address = "Anton work";
     $anton_work->user = $anton;
     $anton_work->save();
     $max = new User();
     $max->username = '******';
     $max->password = '******';
     $max->save();
     $group->users->link($max);
     $group_prog->users->link($max);
     $max_home = new Customer();
     $max_home->address = "Max home";
     $max_home->user = $max;
     $max_home->save();
 }
예제 #4
0
 public function setUp()
 {
     parent::setUp();
     $user = new User(['username' => 'foo']);
     $user->save();
     (new User(['username' => 'bar']))->save();
     (new Customer(['user' => $user, 'address' => 'address']))->save();
 }
예제 #5
0
 public function setUp()
 {
     parent::setUp();
     $model_one = new Category();
     $model_one->name = 'one';
     $model_one->save();
     $model_two = new Category();
     $model_two->name = 'two';
     $model_two->save();
 }
예제 #6
0
 public function setUp()
 {
     parent::setUp();
     $user = new User(['username' => 'foo']);
     $user->save();
     (new User(['username' => 'bar']))->save();
     (new Customer(['user' => $user, 'address' => 'address']))->save();
     $tyre = new Tyre();
     $tyre->save();
     $modelTyre = new ModelTyre(['tyre' => $tyre, 'name' => 'Nordman 4']);
     $modelTyre->save();
     $modelTyre = new ModelTyre(['tyre' => $tyre, 'name' => 'Nordman 3']);
     $modelTyre->save();
     $modelTyre = new ModelTyre(['tyre' => $tyre, 'name' => 'Nordman 2']);
     $modelTyre->save();
 }
예제 #7
0
 public function setUp()
 {
     parent::setUp();
     $category = new Category(['name' => 'cat']);
     $category->save();
     $product1 = new Product(['name' => 'foo', 'category' => $category]);
     $product1->save();
     $product2 = new Product(['name' => 'bar', 'category' => $category]);
     $product2->save();
     $list = new ProductList(['name' => 'test']);
     $list->save();
     $list->products->link($product1);
     $list->products->link($product2);
     $list = new ProductList(['name' => 'asd']);
     $list->save();
     $list->products->link($product1);
 }
예제 #8
0
 public function setUp()
 {
     parent::setUp();
     $group = new Group();
     $group->name = 'test';
     $group->save();
     $this->items = [['username' => 'Anton', 'password' => 'VeryGoodPassWord'], ['username' => 'Max', 'password' => 'The6estP@$$w0rd']];
     $users = [];
     foreach ($this->items as $item) {
         $tmp = new User($item);
         $tmp->save();
         $users[] = $tmp;
     }
     foreach ($users as $user) {
         $group->users->link($user);
         Customer::objects()->getOrCreate(['address' => 'test', 'user' => $user]);
     }
     $model = new User();
     $this->prefix = $model->getDb()->tablePrefix;
 }
예제 #9
0
 public function setUp()
 {
     parent::setUp();
     $category = new Category();
     $category->name = 'test';
     $category->save();
     $product_list = new ProductList();
     $product_list->name = 'First product list';
     $product_list->date_action = '2014-04-29 10:35:45';
     $product_list->save();
     $user = new User();
     $user->password = 123456;
     $user->username = '******';
     $user->save();
     $customer = new Customer();
     $customer->user = $user;
     $customer->address = 'example super address';
     $customer->save();
     $products = [];
     foreach ([1, 2, 3, 4, 5] as $i) {
         $product = new Product();
         $product->name = $i;
         $product->price = $i;
         $product->description = $i;
         $product->category = $category;
         $product->save();
         $products[] = $product;
     }
     $order = new Order();
     $order->customer = $customer;
     $order->save();
     $order->products = $products;
     $order->save();
     $model = new Category();
     $this->prefix = $model->getDb()->tablePrefix;
 }
 public function setUp()
 {
     parent::setUp();
     $group = new Group();
     $group->name = 'Administrators';
     $group->save();
     $group_prog = new Group();
     $group_prog->name = 'Programmers';
     $group_prog->save();
     $anton = new User();
     $anton->username = '******';
     $anton->password = '******';
     $anton->save();
     $group->users->link($anton);
     $group_prog->users->link($anton);
     $anton_home = new Customer();
     $anton_home->address = "Anton home";
     $anton_home->user = $anton;
     $anton_home->save();
     $anton_work = new Customer();
     $anton_work->address = "Anton work";
     $anton_work->user = $anton;
     $anton_work->save();
     $max = new User();
     $max->username = '******';
     $max->password = '******';
     $max->save();
     $group->users->link($max);
     $group_prog->users->link($max);
     $max_home = new Customer();
     $max_home->address = "Max home";
     $max_home->user = $max;
     $max_home->save();
     $model = new Customer();
     $this->prefix = $model->getDb()->tablePrefix;
 }