Skip to content

Commit

Permalink
fix queries using CommonDate
Browse files Browse the repository at this point in the history
  • Loading branch information
tooyz committed Oct 28, 2017
1 parent bd117f6 commit c4f3052
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Components/Specs/QuerySpecs/QuerySpecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ public function toArray()
}
foreach ( $res as $k=>$v ){
if ( $v === null ) unset($res->{$k});
if ( $v instanceof CommonDate ){
$res->{$k} = $v->format();
}
}
return $res;
}
Expand Down
10 changes: 9 additions & 1 deletion tests/Cases/EntityCreateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
namespace Tests\Cases;


use MoySklad\Components\Http\RequestLog;
use MoySklad\Components\Specs\LinkingSpecs;
use MoySklad\Entities\Currency;
use MoySklad\Entities\Misc\Characteristics;
use MoySklad\Entities\Products\Product;
use MoySklad\Entities\Products\Variant;
Expand All @@ -20,7 +22,13 @@ public function setUp()
public function testCreation(){
$this->methodStart();

$product = new Product($this->sklad, ["name" => "random_name_" . time()]);
$product = new Product($this->sklad, [
"name" => "random_name_" . time(),
"salePrices" => [[
"value" => 99,
"priceType" => "Цена продажи"
]]
]);
$product = $product->create();
$this->assertTrue(isset($product->id));

Expand Down

0 comments on commit c4f3052

Please sign in to comment.