Skip to content

Commit

Permalink
[update] combine union test in single class
Browse files Browse the repository at this point in the history
  • Loading branch information
georgehristov committed Jul 27, 2020
1 parent 7083cf5 commit 189782c
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 323 deletions.
2 changes: 1 addition & 1 deletion tests/Model/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class Client extends User
{
public $table = 'client';

public function init(): void
{
parent::init();
Expand Down
1 change: 0 additions & 1 deletion tests/Model/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace atk4\data\tests\Model;

use atk4\data\Model;
use atk4\data\tests\Model\Client;

class Payment extends Model
{
Expand Down
6 changes: 4 additions & 2 deletions tests/Model/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ class Transaction extends Union
{
public $nestedInvoice;
public $nestedPayment;


public $subtractInvoice;

public function init(): void
{
parent::init();

// first lets define nested models
$this->nestedInvoice = $this->addNestedModel(new Invoice());
$this->nestedInvoice = $this->addNestedModel(new Invoice(), $this->subtractInvoice ? ['amount' => '-[]'] : []);
$this->nestedPayment = $this->addNestedModel(new Payment());

// next, define common fields
Expand Down
30 changes: 0 additions & 30 deletions tests/Model/Transaction2.php

This file was deleted.

6 changes: 3 additions & 3 deletions tests/ModelAggregateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ protected function setUp(): void
parent::setUp();
$this->setDB($this->init_db);

$m_invoice = new Model\Invoice($this->db);
$m_invoice->getRef('client_id')->addTitle();
$invoice = new Model\Invoice($this->db);
$invoice->getRef('client_id')->addTitle();

$this->aggregate = new Aggregate($m_invoice);
$this->aggregate = new Aggregate($invoice);
$this->aggregate->addField('client');
}

Expand Down
276 changes: 0 additions & 276 deletions tests/ModelUnionExprTest.php

This file was deleted.

Loading

0 comments on commit 189782c

Please sign in to comment.