/** * @dataProvider updateMethodProvider */ public function testUpdateSetsUpdatedAtField($update_method) { $article = new Article($this->conn, ['id' => 1]); $article->setStored(); $article->title = 'foo'; $article->{$update_method}(); $this->assertEquals(new \DateTime(), $article->updated_at); }
/** * @dataProvider updateMethodProvider */ public function testSlugIsNotOverriddenOnUpdate($update_method) { $article = new Article($this->conn); $article->id = 3; $article->title = 'Something something foo'; $article->slug = 'something-something-foo'; $article->setStored(); $article->title = 'Another title'; $article->slug = 'custom-slug'; $article->{$update_method}(); $this->assertSame('custom-slug', $article->slug); }