コード例 #1
0
 public function testCreateFromArray()
 {
     $expected = new \InFog\SimpleFinance\Entities\Movement();
     $expected->setDate(new \DateTime('2013-01-01'));
     $expected->setAmount(new \InFog\SimpleFinance\Types\Money(100));
     $expected->setName(new \InFog\SimpleFinance\Types\SmallString('Test'));
     $expected->setDescription(new \InFog\SimpleFinance\Types\Text('Just a test'));
     $result = \InFog\SimpleFinance\Entities\Movement::createFromArray(array('date' => '2013-01-01', 'amount' => 100, 'name' => 'Test', 'description' => 'Just a test'));
     $this->assertEquals($expected, $result);
 }
コード例 #2
0
ファイル: Movement.php プロジェクト: rcastardo/SimpleFinance
 private function createCollection(array $movements)
 {
     $collection = new \InFog\SimpleFinance\Collections\Movement();
     foreach ($movements as $movement) {
         $collection->add(\InFog\SimpleFinance\Entities\Movement::createFromArray((array) $movement));
     }
     return $collection;
 }
コード例 #3
0
ファイル: Movement.php プロジェクト: asanoturna/SimpleFinance
 private function createCollection(array $movements)
 {
     $collection = new MovementCollection();
     foreach ($movements as $movement) {
         $collection->add(MovementEntity::createFromArray((array) $movement));
     }
     return $collection;
 }