AuthorBooks\Tests\BookModelTest::testCreateOrUpdateOnTimestampColumn PHP Метод

testCreateOrUpdateOnTimestampColumn() публичный Метод

    public function testCreateOrUpdateOnTimestampColumn()
    {
        $date = new DateTime();
        $book = new Book();
        $ret = $book->create(['title' => 'Create With Time', 'view' => 0, 'published_at' => $date]);
        $this->assertResultSuccess($ret);
        $this->assertCount(1, new BookCollection());
        $id = $book->id;
        $this->assertNotNull($id);
        $ret = $book->load(['published_at' => $date]);
        $this->assertResultSuccess($ret);
        $ret = $book->createOrUpdate(['title' => 'Update With Time', 'view' => 0, 'published_at' => $date], ['published_at']);
        $this->assertResultSuccess($ret);
        $this->assertCount(1, new BookCollection());
        $this->assertEquals('Update With Time', $book->title);
        $this->assertEquals($id, $book->id);
    }