/** * @dataProvider insertMethodProvider() */ public function testInsertOne($insert_method) { $conn = $this->getConn(); $book = new Book($conn); $book->name = 'Foo'; $book->description = 'Bar'; $book->authors_id = 0; $book->{$insert_method}(); //select it to check it has been inserted $selected = Book::selectOne($conn)->execute(); $this->assertInstanceOf('ActiveDoctrine\\Tests\\Fixtures\\Bookshop\\Book', $selected); $this->assertEquals($book->getValues(), $selected->getValues()); }
public function testSetValuesSafeAllowsRelations() { $book = new Book($this->conn); $author = new Author($this->conn, ['id' => 1]); $book->setValuesSafe(['id' => 34, 'name' => 'Far From The Madding Crowd', 'author' => $author]); $this->assertSame(['name' => 'Far From The Madding Crowd', 'authors_id' => 1], $book->getValues()); $this->assertSame($author, $book->author); }