Skip to content

Instantly share code, notes, and snippets.

@ohcibi
Created September 28, 2012 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohcibi/3799873 to your computer and use it in GitHub Desktop.
Save ohcibi/3799873 to your computer and use it in GitHub Desktop.
<?php
class GlassTest extends CakeTestCase {
public function setUp() {
parent::setUp();
$this->Glass = ClassRegistry::init('Glass');
}
public function tearDown() {
parent::tearDown();
$this->Glass->query('TRUNCATE ' . $this->Glass->tablePrefix . $this->Glass->table);
}
public function testProperties() {
$this->Glass->save(array('properties' => array('for_reading', 'xl')));
debug($this->Glass->find('all'));
$glass = $this->Glass->find('first');
debug($glass);
$this->assertEquals(array('for_reading', 'xl'), $glass['Glass']['properties']);
}
public function testMaskFor() {
$this->assertEquals(20, $this->Glass->maskFor(array('for_reading', 'xl')));
$this->assertEquals(1, $this->Glass->maskFor(array('bifocal')));
$this->assertEquals(3, $this->Glass->maskFor(array('bifocal', 'varifocal')));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment