Created
April 10, 2017 12:29
-
-
Save c9s/f42ecf45093f85ccab7c5157d319c563 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function testRepoFetchColumn() | |
{ | |
$this->assertResultSuccess(Book::create([ 'title' => 'Book 1' ])); | |
$this->assertResultSuccess(Book::create([ 'title' => 'Book 2' ])); | |
// create one book with duplicated title | |
$this->assertResultSuccess(Book::create([ 'title' => 'Book 2' ])); | |
$q = Book::masterRepo()->select('DISTINCT title'); | |
$titles = $q->fetchColumn(0); | |
$this->assertCount(2, $titles); | |
foreach ($titles as $title) { | |
$this->assertStringMatchesFormat('Book %i', $title); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment