/** * test create method, trigger error * * @expectedException \PHPUnit_Framework_Error * @return void */ public function testCreateError() { $fixture = new ArticlesFixture(); $db = $this->getMock('Cake\\Database\\Connection', [], [], '', false); $table = $this->getMock('Cake\\Database\\Schema\\Table', [], ['articles']); $table->expects($this->once())->method('createSql')->with($db)->will($this->throwException(new Exception('oh noes'))); $fixture->schema($table); $fixture->create($db); }
/** * test create method, trigger error * * @expectedException \PHPUnit_Framework_Error * @return void */ public function testCreateError() { $fixture = new ArticlesFixture(); $db = $this->getMockBuilder('Cake\\Database\\Connection')->disableOriginalConstructor()->getMock(); $table = $this->getMockBuilder('Cake\\Database\\Schema\\Table')->setConstructorArgs(['articles'])->getMock(); $table->expects($this->once())->method('createSql')->with($db)->will($this->throwException(new Exception('oh noes'))); $fixture->schema($table); $fixture->create($db); }