当前位置: 首页>>代码示例>>PHP>>正文


PHP Entrepot::initAsSpecimen方法代码示例

本文整理汇总了PHP中Entrepot::initAsSpecimen方法的典型用法代码示例。如果您正苦于以下问题:PHP Entrepot::initAsSpecimen方法的具体用法?PHP Entrepot::initAsSpecimen怎么用?PHP Entrepot::initAsSpecimen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Entrepot的用法示例。


在下文中一共展示了Entrepot::initAsSpecimen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testMouvementCreate

 /**
  * testMouvementCreate
  *
  * @return	int
  */
 public function testMouvementCreate()
 {
     global $conf, $user, $langs, $db;
     $conf = $this->savconf;
     $user = $this->savuser;
     $langs = $this->savlangs;
     $db = $this->savdb;
     // We create a product for tests
     $product1 = new Product($db);
     $product1->initAsSpecimen();
     $product1->ref .= ' 1';
     $product1->label .= ' 1';
     $product1id = $product1->create($user);
     $product2 = new Product($db);
     $product2->initAsSpecimen();
     $product2->ref .= ' 2';
     $product2->label .= ' 2';
     $product2id = $product2->create($user);
     // We create a product for tests
     $warehouse1 = new Entrepot($db);
     $warehouse1->initAsSpecimen();
     $warehouse1->libelle .= ' 1';
     $warehouse1->description .= ' 1';
     $warehouse1id = $warehouse1->create($user);
     $warehouse2 = new Entrepot($db);
     $warehouse2->initAsSpecimen();
     $warehouse2->libelle .= ' 2';
     $warehouse2->description .= ' 2';
     $warehouse2id = $warehouse2->create($user);
     $localobject = new MouvementStock($this->savdb);
     // Do a list of movement into warehouse 1
     // Create an input movement (type = 3) of price 9.9 -> shoul dupdate PMP to 9.9
     $result = $localobject->_create($user, $product1id, $warehouse1id, 10, 3, 9.9, 'Movement for unit test 1', 'Inventory Code Test');
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     // Create an input movement (type = 3) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
     $result = $localobject->_create($user, $product1id, $warehouse1id, 10, 3, 9.699999999999999, 'Movement for unit test 2', 'Inventory Code Test');
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     // Create an output movement (type = 2) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
     $result = $localobject->_create($user, $product1id, $warehouse1id, -5, 2, 999, 'Movement for unit test 3', 'Inventory Code Test');
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     // Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
     $result = $localobject->_create($user, $product1id, $warehouse1id, 1, 0, 0, 'Input from transfer', 'Transfert X');
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     // Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
     $result = $localobject->_create($user, $product1id, $warehouse1id, -2, 1, 0, 'Output from transfer', 'Transfert Y');
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     // Do same but into warehouse 2
     // Create an input movement (type = 3) of price 9.9 -> shoul dupdate PMP to 9.9
     $result = $localobject->_create($user, $product1id, $warehouse2id, 10, 3, 9.9, 'Movement for unit test 1 wh 2', 'Inventory Code Test 2');
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     // Create an input movement (type = 3) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
     $result = $localobject->_create($user, $product1id, $warehouse2id, 10, 3, 9.699999999999999, 'Movement for unit test 2 wh 2', 'Inventory Code Test 2');
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     // Create an output movement (type = 2) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
     $result = $localobject->_create($user, $product1id, $warehouse2id, -5, 2, 999, 'Movement for unit test 3 wh 2', 'Inventory Code Test 2');
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     // Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
     $result = $localobject->_create($user, $product1id, $warehouse2id, 1, 0, 0, 'Input from transfer wh 2', 'Transfert X 2');
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     // Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
     $result = $localobject->_create($user, $product1id, $warehouse2id, -2, 1, 0, 'Output from transfer wh 2', 'Transfert Y 2');
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     return $localobject;
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:79,代码来源:MouvementStockTest.php

示例2: testEntrepotCreate

 /**
  * testEntrepotCreate
  *
  * @return	void
  */
 public function testEntrepotCreate()
 {
     global $conf, $user, $langs, $db;
     $conf = $this->savconf;
     $user = $this->savuser;
     $langs = $this->savlangs;
     $db = $this->savdb;
     $localobject = new Entrepot($this->savdb);
     $localobject->initAsSpecimen();
     $result = $localobject->create($user);
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertLessThanOrEqual($result, 0);
     return $result;
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:19,代码来源:EntrepotTest.php


注:本文中的Entrepot::initAsSpecimen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。