I then always switch on xdebug on the unit test to see what happens

Tyler Trout

@wmk Thank you for the swift response. Unfortunately my values in my fixture are still getting converted to 0.0. Failed asserting that 0.0 matches expected 100.

`public function testOrder()`
    `$expectedTotalCosts = [`
      `'inprogress' => 100`
    `foreach ($expectedTotalCosts as $fixture => $cost) {`
        `$obj = $this->objFromFixture(Order::class, $fixture);`
        `$this->assertEquals($cost, $obj->TotalCost);`

so TotalCost: 100 should do for your test


DBCurrency is just a DBDecimal with some extra logic. From the DB side it's a decimal field

Tyler Trout

Hello all, I'm trying to assert a currency field. the values in my fixture were being evaluated as 0.0. I thought I might need to reference the DBCurrency class to fix this, but I guess that is not a subclass of DataObject. https://docs.silverstripe.org/en/4/developer_guides/testing/fixtures/

SilverStripe\ORM\FieldType\DBCurrency: cost: defaultValue: 100.00

Order: inprogress: ID: 1 TotalCost: =>DBCurrency.cost

Show 1 attachment(s)

Developer documentation for Silverstripe CMS and framework

Hide attachment content

I always create a "silverstripe-cache" folder in my project root. This is used by SS if available, then you don't have to delete cache in temp. I also created an "external tool" task in Phpstorm to delete the subfolders of "silverstripe-cache" for CLI and webserver user. You often need to flush caches for CLI user seperatly, running flush in the browser flushes a different cache

✔️ (1)

Colleague got the same issue as ^ - temp-resolved by going to temp folder & deleting the silverstripe cache manually


Looks like a colleague is dealing w/ the same getItemPath issue 🙈